aboutsummaryrefslogtreecommitdiffstats
path: root/test/core_app.mk
diff options
context:
space:
mode:
authorJean-Sébastien Pédron <[email protected]>2016-10-20 16:33:22 +0200
committerLoïc Hoguin <[email protected]>2016-10-23 21:08:12 +0200
commit10ffd2d2ee7bb22a59f1ff8a0a35c63e2696bc6b (patch)
treecc64416c95b1d9d81c067efd4192da6b4a2a4b8c /test/core_app.mk
parent4f5548d226f8efe21e253fd1da1eb1b3754571f8 (diff)
downloaderlang.mk-10ffd2d2ee7bb22a59f1ff8a0a35c63e2696bc6b.tar.gz
erlang.mk-10ffd2d2ee7bb22a59f1ff8a0a35c63e2696bc6b.tar.bz2
erlang.mk-10ffd2d2ee7bb22a59f1ff8a0a35c63e2696bc6b.zip
Support PROJECT_APP_EXTRA_KEYS to add keys to the .app file
This allows to add standard keys which do not have a corresponding `PROJECT_` Makefile variable, as well as non-standard keys.
Diffstat (limited to 'test/core_app.mk')
-rw-r--r--test/core_app.mk43
1 files changed, 42 insertions, 1 deletions
diff --git a/test/core_app.mk b/test/core_app.mk
index 0276390..2d6a40b 100644
--- a/test/core_app.mk
+++ b/test/core_app.mk
@@ -1,6 +1,6 @@
# Core: Building applications.
-CORE_APP_CASES = appsrc-change asn1 auto-git-id env erlc-exclude erlc-opts erlc-opts-filter error generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive makefile-change mib name-special-char no-app no-makedep project-mod pt pt-erlc-opts xrl xrl-include yrl yrl-header yrl-include
+CORE_APP_CASES = appsrc-change asn1 auto-git-id env erlc-exclude erlc-opts erlc-opts-filter error extra-keys generate-erl generate-erl-include generate-erl-prepend hrl hrl-recursive makefile-change mib name-special-char no-app no-makedep project-mod pt pt-erlc-opts xrl xrl-include yrl yrl-header yrl-include
CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES))
.PHONY: core-app $(CORE_APP_TARGETS)
@@ -330,6 +330,47 @@ core-app-error: build clean
$i "Check that trying to build returns non-zero"
$t ! $(MAKE) -C $(APP) $v
+ifndef LEGACY
+core-app-extra-keys: 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 "Define PROJECT_APP_EXTRA_KEYS"
+ $t printf "define PROJECT_APP_EXTRA_KEYS\n\t{maxT, 10000},\n\t{non_standard_key, test_value}\nendef\n" >> $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:load($(APP)), \
+ {ok, 10000} = application:get_key($(APP), maxT), \
+ AppFile = filename:join(code:lib_dir($(APP), ebin), atom_to_list($(APP)) ++ \".app\"), \
+ {ok, [App]} = file:consult(AppFile), \
+ {application, $(APP), Props} = App, \
+ test_value = proplists:get_value(non_standard_key, Props),\
+ halt()"
+
+ $i "Define PROJECT_APP_EXTRA_KEYS with escape in string, special char"
+ $t echo "PROJECT_APP_EXTRA_KEYS = {non_standard_atom, '\\\$$\$$my_app'}, {non_standard_string, \"\\\"test_\\tvalue\\\"\"}" >> $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Check that the application was compiled correctly"
+ $t $(ERL) -pa $(APP)/ebin/ -eval " \
+ ok = application:load($(APP)), \
+ AppFile = filename:join(code:lib_dir($(APP), ebin), atom_to_list($(APP)) ++ \".app\"), \
+ {ok, [App]} = file:consult(AppFile), \
+ {application, $(APP), Props} = App, \
+ '\\\$$my_app' = proplists:get_value(non_standard_atom, Props),\
+ \"\\\"test_\\tvalue\\\"\" = proplists:get_value(non_standard_string, Props),\
+ halt()"
+endif
+
core-app-generate-erl: build clean
$i "Bootstrap a new OTP library named $(APP)"