Browse Source

Use two colons for the shell target

Loïc Hoguin 6 years ago
parent
commit
f1ff84ab74
2 changed files with 20 additions and 1 deletions
  1. 1 1
      plugins/shell.mk
  2. 19 0
      test/plugin_shell.mk

+ 1 - 1
plugins/shell.mk

@@ -26,5 +26,5 @@ $(foreach dep,$(SHELL_DEPS),$(eval $(call dep_target,$(dep))))
 build-shell-deps: $(ALL_SHELL_DEPS_DIRS)
 	$(verbose) set -e; for dep in $(ALL_SHELL_DEPS_DIRS) ; do $(MAKE) -C $$dep ; done
 
-shell: build-shell-deps
+shell:: build-shell-deps
 	$(gen_verbose) $(SHELL_ERL) -pa $(SHELL_PATHS) $(SHELL_OPTS)

+ 19 - 0
test/plugin_shell.mk

@@ -6,6 +6,25 @@ SHELL_TARGETS = $(call list_targets,shell)
 
 shell: $(SHELL_TARGETS)
 
+shell-compile: build clean
+
+	$i "Bootstrap a new OTP application named $(APP)"
+	$t mkdir $(APP)/
+	$t cp ../erlang.mk $(APP)/
+	$t $(MAKE) -C $(APP) -f erlang.mk bootstrap $v
+
+	$i "Ensure our application is recompiled before the shell runs"
+	$t perl -ni.bak -e 'print;if ($$.==1) {print "shell:: app\n"}' $(APP)/Makefile
+
+	$i "Run the shell"
+	$t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
+
+	$i "Check that all compiled files exist"
+	$t test -f $(APP)/$(APP).d
+	$t test -f $(APP)/ebin/$(APP).app
+	$t test -f $(APP)/ebin/$(APP)_app.beam
+	$t test -f $(APP)/ebin/$(APP)_sup.beam
+
 shell-default: build clean
 
 	$i "Bootstrap a new OTP library named $(APP)"