Browse Source

Fix "make eunit/ct" not fetching apps dependencies

Loïc Hoguin 5 years ago
parent
commit
3d4edcf314
2 changed files with 21 additions and 2 deletions
  1. 1 1
      core/test.mk
  2. 20 1
      test/plugin_eunit.mk

+ 1 - 1
core/test.mk

@@ -55,7 +55,7 @@ endif
 # We only care about compiling the current application.
 ifdef IS_APP
 test-build-app:: ERLC_OPTS=$(TEST_ERLC_OPTS)
-test-build-app:: test-deps
+test-build-app:: deps test-deps
 ifneq ($(wildcard $(TEST_DIR)),)
 	$(verbose) $(MAKE) --no-print-directory test-dir ERLC_OPTS="$(call escape_dquotes,$(TEST_ERLC_OPTS))"
 endif

+ 20 - 1
test/plugin_eunit.mk

@@ -71,7 +71,7 @@ eunit-apps-include-lib: init
 	$t $(MAKE) -C $(APP) $v
 
 	$i "Run eunit"
-	$t $(MAKE) -C $(APP) $v
+	$t $(MAKE) -C $(APP) eunit $v
 
 	$i "Distclean the application"
 	$t $(MAKE) -C $(APP) distclean $v
@@ -82,6 +82,25 @@ eunit-apps-include-lib: init
 	$i "Distclean the application"
 	$t $(MAKE) -C $(APP) distclean $v
 
+eunit-apps-include-lib-deps: 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 "Create new library the_app"
+	$t $(MAKE) -C $(APP) new-lib in=the_app $v
+
+	$i "Add Cowlib to the list of dependencies of the_app"
+	$t perl -ni.bak -e 'print;if ($$.==1) {print "DEPS = cowlib\ndep_cowlib_commit = master\n"}' $(APP)/apps/the_app/Makefile
+
+	$i "Generate .erl file that uses include_lib()"
+	$t echo '-module(the).  -include_lib("cowlib/include/cow_parse.hrl").  -export([thing/0]).  thing() -> true.' > $(APP)/apps/the_app/src/the.erl
+
+	$i "Run eunit"
+	$t $(MAKE) -C $(APP) eunit $v
+
 eunit-apps-one-app-tested: init
 
 	$i "Bootstrap a new OTP library named $(APP)"