aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-12-05 09:38:56 +0100
committerLoïc Hoguin <[email protected]>2018-12-05 11:38:02 +0100
commit672f9310b5a1fc9e6b7bb65f725f278666511db3 (patch)
tree3065f0542330189998b7a864339faf61e60877ec /test
parentf221d99c4188a64352a77f28441985572313ed0f (diff)
downloaderlang.mk-672f9310b5a1fc9e6b7bb65f725f278666511db3.tar.gz
erlang.mk-672f9310b5a1fc9e6b7bb65f725f278666511db3.tar.bz2
erlang.mk-672f9310b5a1fc9e6b7bb65f725f278666511db3.zip
Allow hooking before/after autopatch
Diffstat (limited to 'test')
-rw-r--r--test/core_autopatch.mk39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/core_autopatch.mk b/test/core_autopatch.mk
index 11da189..21fad4b 100644
--- a/test/core_autopatch.mk
+++ b/test/core_autopatch.mk
@@ -6,6 +6,45 @@ CORE_AUTOPATCH_TARGETS = $(call list_targets,core-autopatch)
core-autopatch: $(CORE_AUTOPATCH_TARGETS)
+core-autopatch-extended: build clean
+
+ $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 Ranch to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = ranch\n"}' $(APP)/Makefile
+
+ $i "Extend autopatch-ranch to create an additional module"
+ $t echo "autopatch-ranch:: ; rm -f \$$(DEPS_DIR)/ranch/src/ranch_protocol.erl" >> $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that the module was removed"
+ $t ! test -e $(APP)/deps/ranch/src/ranch_protocol.erl
+ $t ! test -e $(APP)/deps/ranch/ebin/ranch_protocol.beam
+
+core-autopatch-extended-erlc-opts: build clean
+
+ $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 couchbeam to the list of dependencies"
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = couchbeam\n"}' $(APP)/Makefile
+
+ $i "Extend autopatch-couchbeam to add options to its ERLC_OPTS"
+ $t echo "autopatch-couchbeam:: ; printf '\nERLC_OPTS += -DWITH_JIFFY\n' >> \$$(DEPS_DIR)/couchbeam/Makefile" >> $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that couchbeam_ejson was compiled with the added option"
+ $t $(ERL) -pa $(APP)/deps/couchbeam/ebin -eval 'c:m(couchbeam_ejson), halt()' | grep -c "WITH_JIFFY" | grep -q 1
+
core-autopatch-no-autopatch: build clean
$i "Bootstrap a new OTP library named $(APP)"