diff options
author | Loïc Hoguin <[email protected]> | 2018-11-23 23:37:52 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2018-11-23 23:37:52 +0100 |
commit | f713103ddc22ac8fdaf80198dc7e24f9032c84b1 (patch) | |
tree | db896cff6d62455fbb6d3e08d054aa67182e4a55 /test | |
parent | bc6864dcc846aae785599799c653a8f1f9ce0502 (diff) | |
download | erlang.mk-f713103ddc22ac8fdaf80198dc7e24f9032c84b1.tar.gz erlang.mk-f713103ddc22ac8fdaf80198dc7e24f9032c84b1.tar.bz2 erlang.mk-f713103ddc22ac8fdaf80198dc7e24f9032c84b1.zip |
Ensure apps eunit tests only run once when called directly
Diffstat (limited to 'test')
-rw-r--r-- | test/plugin_eunit.mk | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/plugin_eunit.mk b/test/plugin_eunit.mk index 05aebae..9039b1d 100644 --- a/test/plugin_eunit.mk +++ b/test/plugin_eunit.mk @@ -82,6 +82,38 @@ eunit-apps-include-lib: build clean $i "Distclean the application" $t $(MAKE) -C $(APP) distclean $v +eunit-apps-one-app-tested: 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 "Create a new application named my_app" + $t $(MAKE) -C $(APP) new-app in=my_app $v + + $i "Create a new library named my_lib" + $t $(MAKE) -C $(APP) new-lib in=my_lib $v + + $i "Generate a module containing EUnit tests in my_app" + $t printf "%s\n" \ + "-module(my_app)." \ + "-ifdef(TEST)." \ + "-include_lib(\"eunit/include/eunit.hrl\")." \ + "ok_test() -> ok." \ + "-endif." > $(APP)/apps/my_app/src/my_app.erl + + $i "Generate a module containing EUnit tests in my_lib" + $t printf "%s\n" \ + "-module(my_lib)." \ + "-ifdef(TEST)." \ + "-include_lib(\"eunit/include/eunit.hrl\")." \ + "ok_test() -> ok." \ + "-endif." > $(APP)/apps/my_lib/src/my_lib.erl + + $i "Run EUnit on my_app only" + $t $(MAKE) -C $(APP)/apps/my_app eunit | grep "Test passed." | wc -l | grep -q "1" + eunit-apps-only: build clean $i "Create a multi application repository with no root application" |