Browse Source

Add $(TEST_DIR) to the default value of SHELL_PATHS

Krzysztof Jurewicz 7 years ago
parent
commit
dfe090d1b4
3 changed files with 20 additions and 1 deletions
  1. 4 0
      doc/src/guide/shell.asciidoc
  2. 1 1
      plugins/shell.mk
  3. 15 0
      test/plugin_shell.mk

+ 4 - 0
doc/src/guide/shell.asciidoc

@@ -44,3 +44,7 @@ $ make shell
 
 
 The shell can be stopped as usual with a double Ctrl+C or the
 The shell can be stopped as usual with a double Ctrl+C or the
 command `q().`.
 command `q().`.
+
+Note that the `shell` target does not build the application. To do it,
+use either the `app` target or, if you want to include also test
+modules, the `test-build` target.

+ 1 - 1
plugins/shell.mk

@@ -7,7 +7,7 @@
 # Configuration.
 # Configuration.
 
 
 SHELL_ERL ?= erl
 SHELL_ERL ?= erl
-SHELL_PATHS ?= $(CURDIR)/ebin $(APPS_DIR)/*/ebin $(DEPS_DIR)/*/ebin
+SHELL_PATHS ?= $(CURDIR)/ebin $(APPS_DIR)/*/ebin $(DEPS_DIR)/*/ebin $(TEST_DIR)
 SHELL_OPTS ?=
 SHELL_OPTS ?=
 
 
 ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))
 ALL_SHELL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(SHELL_DEPS))

+ 15 - 0
test/plugin_shell.mk

@@ -28,3 +28,18 @@ shell-kjell: build clean
 
 
 	$i "Run the shell"
 	$i "Run the shell"
 	$t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
 	$t $(MAKE) -C $(APP) shell SHELL_OPTS="-eval 'halt()'" $v
+
+shell-test-dir: 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 "Generate a module in TEST_DIR"
+	$t mkdir $(APP)/test
+	$t printf "%s\n" \
+		"-module(foo)." > $(APP)/test/foo.erl
+
+	$i "Check that the module is visible"
+	$t $(MAKE) -C $(APP) test-build shell SHELL_OPTS="-eval 'foo:module_info()' -eval 'halt()'" $v