|
@@ -175,3 +175,40 @@ escript-extra: init
|
|
|
$i "Check that the escript contains the extra files"
|
|
|
$t unzip -l $(APP)/$(APP) 2> /dev/null | grep -q Makefile
|
|
|
$t unzip -l $(APP)/$(APP) 2> /dev/null | grep -q erlang.mk
|
|
|
+
|
|
|
+escript-zip-file: init
|
|
|
+
|
|
|
+ $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 "Set ESCRIPT_ZIP_FILE to a custom location"
|
|
|
+ $t perl -ni.bak -e 'print;if ($$.==1) {print "ESCRIPT_ZIP_FILE = tmp/my_escript.zip\n"}' $(APP)/Makefile
|
|
|
+
|
|
|
+ $i "Generate a module containing a function main/1"
|
|
|
+ $t printf "%s\n" \
|
|
|
+ "-module($(APP))." \
|
|
|
+ "-export([main/1])." \
|
|
|
+ 'main(_) -> io:format("good~n").' > $(APP)/src/$(APP).erl
|
|
|
+
|
|
|
+ $i "Build the escript"
|
|
|
+ $t $(MAKE) -C $(APP) escript $v
|
|
|
+
|
|
|
+ $i "Check that the file at ESCRIPT_ZIP_FILE exists"
|
|
|
+ $t test -f $(APP)/tmp/my_escript.zip
|
|
|
+
|
|
|
+ $i "Check that the escript exists"
|
|
|
+ $t test -f $(APP)/$(APP)
|
|
|
+
|
|
|
+ $i "Check that the escript runs"
|
|
|
+ $t $(APP)/$(APP) | grep -q good
|
|
|
+
|
|
|
+ $i "Distclean the application"
|
|
|
+ $t $(MAKE) -C $(APP) distclean $v
|
|
|
+
|
|
|
+ $i "Check that the file at ESCRIPT_ZIP_FILE was removed"
|
|
|
+ $t test ! -e $(APP)/tmp/my_escript.zip
|
|
|
+
|
|
|
+ $i "Check that the escript was removed"
|
|
|
+ $t test ! -e $(APP)/$(APP)
|