Browse Source

Add tests for and fix NO_AUTOPATCH

Loïc Hoguin 9 years ago
parent
commit
9d33c41efa
2 changed files with 45 additions and 1 deletions
  1. 2 0
      core/deps.mk
  2. 43 1
      test/core_deps.mk

+ 2 - 0
core/deps.mk

@@ -33,6 +33,8 @@ endif
 endif
 endif
 export ERL_LIBS
 export ERL_LIBS
 
 
+export NO_AUTOPATCH
+
 # Verbosity.
 # Verbosity.
 
 
 dep_verbose_0 = @echo " DEP   " $(1);
 dep_verbose_0 = @echo " DEP   " $(1);

+ 43 - 1
test/core_deps.mk

@@ -1,6 +1,6 @@
 # Core: Packages and dependencies.
 # 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_TARGETS = $(addprefix core-deps-,$(CORE_DEPS_CASES))
 CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
 CORE_DEPS_CLEAN_TARGETS = $(addprefix clean-,$(CORE_DEPS_TARGETS))
 
 
@@ -908,6 +908,48 @@ endif
 		{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
 		{ok, \"1.0.0\"} = application:get_key(cowlib, vsn), \
 		halt()"
 		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
 ifndef LEGACY
 core-deps-otp: build clean-core-deps-otp
 core-deps-otp: build clean-core-deps-otp