From 6a46aaaa0a79c8b4af8425a8fd930a7ba7dad54e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Thu, 24 Sep 2015 00:27:13 +0200 Subject: Add test for the cp fetch method --- test/core_deps.mk | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/test/core_deps.mk b/test/core_deps.mk index e755f38..88c2137 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 dep-commit doc fetch-git fetch-hg fetch-svn otp pkg rel search shell test +CORE_DEPS_CASES = build-c-8cc build-c-imagejs build-erl build-js dep-commit doc fetch-cp fetch-git fetch-hg fetch-svn otp pkg rel search shell test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -200,6 +200,43 @@ EDOC_OPTS = {doclet, edown_doclet}\ $t test -f $(APP)/doc/boy.md $t test -f $(APP)/doc/girl.md +core-deps-fetch-cp: build clean-core-deps-fetch-cp + + $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 "Bootstrap a new OTP library named my_dep inside $(APP)" + $t mkdir $(APP)/my_dep + $t cp ../erlang.mk $(APP)/my_dep/ + $t $(MAKE) -C $(APP)/my_dep/ -f erlang.mk bootstrap-lib $v + + $i "Add my_dep to the list of dependencies" + $t sed -i.bak '2i\ +DEPS = my_dep\ +dep_my_dep = cp $(CURDIR)/$(APP)/my_dep/\ +' $(APP)/Makefile + +ifdef LEGACY + $i "Add my_dep to the applications key in the .app.src file" + $t sed -i.bak '8i\ + my_dep,' $(APP)/src/$(APP).app.src +endif + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/my_dep + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ $(APP)/deps/*/ebin/ -eval " \ + [ok = application:load(App) || App <- [$(APP), my_dep]], \ + {ok, Deps} = application:get_key($(APP), applications), \ + true = lists:member(my_dep, Deps), \ + halt()" + core-deps-fetch-git: build clean-core-deps-fetch-git $i "Bootstrap a new OTP library named $(APP)" -- cgit v1.2.3