From e75301e0a2d7b11021b17a8b606a959b07497cc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 22 Sep 2015 19:53:49 +0200 Subject: Add a test for SHELL_DEPS --- test/core_deps.mk | 47 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 44 insertions(+), 3 deletions(-) (limited to 'test') diff --git a/test/core_deps.mk b/test/core_deps.mk index 09379c1..996f4c5 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js doc otp pkg rel search +CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js doc otp pkg rel search shell CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -227,12 +227,12 @@ endif core-deps-rel: build clean-core-deps-rel - $i "Bootstrap a new release-enabled OTP application named $(APP)" + $i "Bootstrap a new release-enabled OTP library named $(APP)" $t mkdir $(APP)/ $t cp ../erlang.mk $(APP)/ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib bootstrap-rel $v - $i "Add Recon to the list of dependencies" + $i "Add Recon to the list of release dependencies" $t sed -i.bak '2i\ REL_DEPS = recon\ ' $(APP)/Makefile @@ -300,3 +300,44 @@ core-deps-search: build clean-core-deps-search $i "Run 'make search q=cowboy' and check that it prints packages" $t test -n "`$(MAKE) -C $(APP) search q=cowboy`" + +core-deps-shell: build clean-core-deps-shell + + $i "Bootstrap a new OTP library named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v + + $i "Add TDDReloader to the list of shell dependencies" + $t sed -i.bak '2i\ +SHELL_DEPS = tddreloader\ +' $(APP)/Makefile + + $i "Build the application and its dependencies" + $t $(MAKE) -C $(APP) deps app $v + + $i "Check that no dependencies were fetched" + $t test ! -e $(APP)/deps + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \ + [ok = application:load(App) || App <- [$(APP)]], \ + {ok, Deps} = application:get_key($(APP), applications), \ + false = lists:member(tddreloader, Deps), \ + halt()" + + $i "Run the shell" + $t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval \" \ + ok = application:load($(APP)), \ + ok = application:load(tddreloader), \ + halt()\"" $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/tddreloader + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \ + [ok = application:load(App) || App <- [$(APP)]], \ + {ok, Deps} = application:get_key($(APP), applications), \ + false = lists:member(tddreloader, Deps), \ + halt()" -- cgit v1.2.3