diff options
author | Loïc Hoguin <[email protected]> | 2015-09-05 20:06:04 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2015-09-05 20:06:04 +0200 |
commit | 3d285eb6ca85225fb8fb5529d188ebe2450060b6 (patch) | |
tree | b196e60d25429ada0fd78d6e8b6d5937e6478a4c /test | |
parent | 80aa28a28d6dca8aaaceff20c401a1d568304439 (diff) | |
download | erlang.mk-3d285eb6ca85225fb8fb5529d188ebe2450060b6.tar.gz erlang.mk-3d285eb6ca85225fb8fb5529d188ebe2450060b6.tar.bz2 erlang.mk-3d285eb6ca85225fb8fb5529d188ebe2450060b6.zip |
Add a test for .yrl files that include headers
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile | 110 |
1 files changed, 109 insertions, 1 deletions
diff --git a/test/Makefile b/test/Makefile index cc185c3..9601f64 100644 --- a/test/Makefile +++ b/test/Makefile @@ -77,7 +77,7 @@ clean-core: clean-core-app clean-core-upgrade # Core: Building applications. -CORE_APP_CASES = asn1 hrl hrl-recursive mib xrl xrl-include yrl +CORE_APP_CASES = asn1 hrl hrl-recursive mib xrl xrl-include yrl yrl-include CORE_APP_TARGETS = $(addprefix core-app-,$(CORE_APP_CASES)) CORE_APP_CLEAN_TARGETS = $(addprefix clean-,$(CORE_APP_TARGETS)) @@ -797,6 +797,114 @@ core-app-yrl: build clean-core-app-yrl [{module, M} = code:load_file(M) || M <- Mods], \ halt()" +core-app-yrl-include: build clean-core-app-yrl-include + + $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 "Download a .yrl file with includes from Erlang/OTP" + $t curl -s -o $(APP)/src/core_parse.yrl $(OTP_MASTER)/lib/compiler/src/core_parse.yrl + $t curl -s -o $(APP)/src/core_parse.hrl $(OTP_MASTER)/lib/compiler/src/core_parse.hrl + + $i "Generate unrelated .erl files" + $t echo "-module(boy)." > $(APP)/src/boy.erl + $t echo "-module(girl)." > $(APP)/src/girl.erl + + $i "Build the application" + $t $(MAKE) -C $(APP) $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/boy.beam + $t test -f $(APP)/ebin/core_parse.beam + $t test -f $(APP)/ebin/girl.beam + $t test -f $(APP)/src/core_parse.erl + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:start($(APP)), \ + {ok, Mods = [boy, core_parse, girl]} \ + = application:get_key($(APP), modules), \ + [{module, M} = code:load_file(M) || M <- Mods], \ + halt()" + + $i "Touch the .yrl file; check that only required files are rebuilt" + $t printf "%s\n" \ + $(APP)/$(APP).d \ + $(APP)/ebin/$(APP).app \ + $(APP)/ebin/core_parse.beam \ + $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT + $t touch $(APP)/src/core_parse.yrl + $t $(MAKE) -C $(APP) $v + $t find $(APP) -type f -newer $(APP)/src/core_parse.yrl | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:start($(APP)), \ + {ok, Mods = [boy, core_parse, girl]} \ + = application:get_key($(APP), modules), \ + [{module, M} = code:load_file(M) || M <- Mods], \ + halt()" + + $i "Touch the .hrl file included; check that only required files are rebuilt" + $t printf "%s\n" \ + $(APP)/$(APP).d \ + $(APP)/ebin/$(APP).app \ + $(APP)/ebin/core_parse.beam \ + $(APP)/src/core_parse.erl | sort > $(APP)/EXPECT + $t touch $(APP)/src/core_parse.hrl + $t $(MAKE) -C $(APP) $v + $t find $(APP) -type f -newer $(APP)/src/core_parse.hrl | sort | diff $(APP)/EXPECT - + $t rm $(APP)/EXPECT + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:start($(APP)), \ + {ok, Mods = [boy, core_parse, girl]} \ + = application:get_key($(APP), modules), \ + [{module, M} = code:load_file(M) || M <- Mods], \ + halt()" + + $i "Clean the application" + $t $(MAKE) -C $(APP) clean $v + + $i "Check that source files still exist" + $t test -f $(APP)/Makefile + $t test -f $(APP)/erlang.mk + $t test -f $(APP)/src/$(APP).app.src + $t test -f $(APP)/src/boy.erl + $t test -f $(APP)/src/core_parse.hrl + $t test -f $(APP)/src/core_parse.yrl + $t test -f $(APP)/src/girl.erl + + $i "Check that all build artifacts are removed, including intermediates" + $t test ! -e $(APP)/$(APP).d + $t test ! -e $(APP)/ebin/ + $t test ! -e $(APP)/src/core_parse.erl + + $i "Build the application again" + $t $(MAKE) -C $(APP) $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/boy.beam + $t test -f $(APP)/ebin/core_parse.beam + $t test -f $(APP)/ebin/girl.beam + $t test -f $(APP)/src/core_parse.erl + + $i "Check that the application was compiled correctly" + $t $(ERL) -pa $(APP)/ebin/ -eval " \ + ok = application:start($(APP)), \ + {ok, Mods = [boy, core_parse, girl]} \ + = application:get_key($(APP), modules), \ + [{module, M} = code:load_file(M) || M <- Mods], \ + halt()" + clean-core-app: $(CORE_APP_CLEAN_TARGETS) $(CORE_APP_CLEAN_TARGETS): |