From 9d33c41efaa778102c7606cfb19f2523fdba1c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 29 Sep 2015 17:38:51 +0200 Subject: Add tests for and fix NO_AUTOPATCH --- core/deps.mk | 2 ++ test/core_deps.mk | 44 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/core/deps.mk b/core/deps.mk index 00cc05f..8bc7b44 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -33,6 +33,8 @@ endif endif export ERL_LIBS +export NO_AUTOPATCH + # Verbosity. dep_verbose_0 = @echo " DEP " $(1); diff --git a/test/core_deps.mk b/test/core_deps.mk index 36bcbf7..1223187 100644 --- a/test/core_deps.mk +++ b/test/core_deps.mk @@ -1,6 +1,6 @@ # Core: Packages and dependencies. -CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore order-first order-top otp pkg rel search shell test +CORE_DEPS_CASES = apps apps-conflict apps-deep-conflict apps-dir apps-new-app apps-new-lib apps-new-tpl apps-only build-c-8cc build-c-imagejs build-erl build-js dep-commit dir doc fetch-cp fetch-custom fetch-fail-bad fetch-fail-unknown fetch-git fetch-hex fetch-hg fetch-legacy fetch-svn ignore no-autopatch no-autopatch-rebar order-first order-top otp pkg rel search shell test CORE_DEPS_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES)) CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS)) @@ -908,6 +908,48 @@ endif {ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \ halt()" +core-deps-no-autopatch: build clean-core-deps-no-autopatch + + $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 Cowboy to the list of dependencies and Cowlib to the NO_AUTOPATCH list" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowboy\nNO_AUTOPATCH = cowlib\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/cowboy + $t test -d $(APP)/deps/cowlib + $t test -d $(APP)/deps/ranch + + $i "Check that Cowlib was not autopatched" + $t grep -q Hoguin $(APP)/deps/cowlib/erlang.mk + +core-deps-no-autopatch-rebar: build clean-core-deps-no-autopatch-rebar + + $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 Lager to the list of dependencies and to the NO_AUTOPATCH list" + $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = lager\nNO_AUTOPATCH = lager\n"}' $(APP)/Makefile + + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all dependencies were fetched" + $t test -d $(APP)/deps/goldrush + $t test -d $(APP)/deps/lager + + $i "Check that Lager was not autopatched" + $t if grep -q erlang\.mk $(APP)/deps/goldrush/Makefile; then false; fi + $t if grep -q erlang\.mk $(APP)/deps/lager/Makefile; then false; fi + ifndef LEGACY core-deps-otp: build clean-core-deps-otp -- cgit v1.2.3