diff options
author | Loïc Hoguin <[email protected]> | 2015-11-20 17:40:01 +0100 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-11-20 17:40:01 +0100 |
commit | beec62e994fbf0003dd637a3b093ef65a9bbc8ff (patch) | |
tree | 72e8edb7e532fda908aea0ea486afb5d7a8d14de /test/plugin_bootstrap.mk | |
parent | c110f49b16ebf3cf23fbfee2f81cc6760a04dc7b (diff) | |
download | erlang.mk-beec62e994fbf0003dd637a3b093ef65a9bbc8ff.tar.gz erlang.mk-beec62e994fbf0003dd637a3b093ef65a9bbc8ff.tar.bz2 erlang.mk-beec62e994fbf0003dd637a3b093ef65a9bbc8ff.zip |
Add tests and document the SP variable
People who prefer spaces instead of tabs are now covered.
Diffstat (limited to 'test/plugin_bootstrap.mk')
-rw-r--r-- | test/plugin_bootstrap.mk | 63 |
1 files changed, 62 insertions, 1 deletions
diff --git a/test/plugin_bootstrap.mk b/test/plugin_bootstrap.mk index 16bfb58..47a81d1 100644 --- a/test/plugin_bootstrap.mk +++ b/test/plugin_bootstrap.mk @@ -1,6 +1,6 @@ # Bootstrap plugin. -BOOTSTRAP_CASES = app lib rel templates +BOOTSTRAP_CASES = app lib rel sp tab templates BOOTSTRAP_TARGETS = $(addprefix bootstrap-,$(BOOTSTRAP_CASES)) BOOTSTRAP_CLEAN_TARGETS = $(addprefix clean-,$(BOOTSTRAP_TARGETS)) @@ -116,6 +116,67 @@ endif $i "Check that there's no erl_crash.dump file" $t test ! -f $(APP)/_rel/$(APP)_release/erl_crash.dump +bootstrap-sp: build clean-bootstrap-sp + + $i "Bootstrap a new OTP application named $(APP)" + $t mkdir $(APP)/ + $t cp ../erlang.mk $(APP)/ + $t $(MAKE) -C $(APP) -f erlang.mk bootstrap SP=2 $v + + $i "Check that all bootstrapped files exist" + $t test -f $(APP)/Makefile +ifdef LEGACY + $t test -f $(APP)/src/$(APP).app.src +endif + $t test -f $(APP)/src/$(APP)_app.erl + $t test -f $(APP)/src/$(APP)_sup.erl + + $i "Check that bootstrapped files have no tabs" +ifdef LEGACY + $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP).app.src`" +endif + $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_app.erl`" + $t test -z "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_sup.erl`" + +# Everything looks OK, but let's compile the application to make sure. + $i "Build the application" + $t $(MAKE) -C $(APP) $v + + $i "Check that all compiled files exist" + $t test -f $(APP)/ebin/$(APP).app + $t test -f $(APP)/ebin/$(APP)_app.beam + $t test -f $(APP)/ebin/$(APP)_sup.beam + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:start($(APP)), \ + {ok, [$(APP)_app, $(APP)_sup]} = application:get_key($(APP), modules), \ + {module, $(APP)_app} = code:load_file($(APP)_app), \ + {module, $(APP)_sup} = code:load_file($(APP)_sup), \ + halt()" + +bootstrap-tab: build clean-bootstrap-tab + + $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 "Check that all bootstrapped files exist" + $t test -f $(APP)/Makefile +ifdef LEGACY + $t test -f $(APP)/src/$(APP).app.src +endif + $t test -f $(APP)/src/$(APP)_app.erl + $t test -f $(APP)/src/$(APP)_sup.erl + + $i "Check that bootstrapped files have tabs" +ifdef LEGACY + $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP).app.src`" +endif + $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_app.erl`" + $t test "`awk -F "\t" 'NF > 1' $(APP)/src/$(APP)_sup.erl`" + bootstrap-templates: build clean-bootstrap-templates $i "Bootstrap a new OTP library named $(APP)" |