From b60900f47650edbeb575ba2740db48e99afbbd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 22 Sep 2015 20:00:07 +0200 Subject: Add tests for TEST_DEPS --- test/core_deps.mk | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/test/core_deps.mk b/test/core_deps.mk index 996f4c5..c9862ed 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 shell +CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js doc otp pkg rel search shell test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -341,3 +341,45 @@ SHELL_DEPS = tddreloader\ {ok, Deps} = application:get_key($(APP), applications), \ false = lists:member(tddreloader, Deps), \ halt()" + +core-deps-test: build clean-core-deps-test + + $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 "Generate .erl files" + $t echo "-module(boy)." > $(APP)/src/boy.erl + $t echo "-module(girl)." > $(APP)/src/girl.erl + + $i "Add triq to the list of test dependencies" + $t sed -i.bak '2i\ +TEST_DEPS = triq\ +' $(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(triq, Deps), \ + halt()" + + $i "Run tests" + $t $(MAKE) -C $(APP) tests $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/triq + + $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(triq, Deps), \ + halt()" -- cgit v1.2.3