aboutsummaryrefslogtreecommitdiffstats
path: root/lib/tools/test/make_SUITE.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-04-12 12:35:52 +0200
committerSiri Hansen <[email protected]>2017-04-12 12:35:52 +0200
commit1a2e7f14aafaac1209458dcedebd4fe723e0f302 (patch)
tree4fddb50cfcbd458ac60eff62ecd780eb1438d57e /lib/tools/test/make_SUITE.erl
parent3a29920a05cedee8c1f7501ee7b1aa22e068efed (diff)
downloadotp-1a2e7f14aafaac1209458dcedebd4fe723e0f302.tar.gz
otp-1a2e7f14aafaac1209458dcedebd4fe723e0f302.tar.bz2
otp-1a2e7f14aafaac1209458dcedebd4fe723e0f302.zip
[tools/make] Add current directory to include path
This is to ensure that files are recompiled if a .hrl file in the current directory is changed.
Diffstat (limited to 'lib/tools/test/make_SUITE.erl')
-rw-r--r--lib/tools/test/make_SUITE.erl44
1 files changed, 38 insertions, 6 deletions
diff --git a/lib/tools/test/make_SUITE.erl b/lib/tools/test/make_SUITE.erl
index 2a94ead329..2db5c6844a 100644
--- a/lib/tools/test/make_SUITE.erl
+++ b/lib/tools/test/make_SUITE.erl
@@ -19,11 +19,7 @@
%%
-module(make_SUITE).
--export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
- init_per_group/2,end_per_group/2, make_all/1, make_files/1, emake_opts/1]).
--export([otp_6057_init/1,
- otp_6057_a/1, otp_6057_b/1, otp_6057_c/1,
- otp_6057_end/1]).
+-compile(export_all).
-include_lib("common_test/include/ct.hrl").
@@ -40,7 +36,8 @@
suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
- [make_all, make_files, emake_opts, {group, otp_6057}].
+ [make_all, make_files, recompile_on_changed_include,
+ emake_opts, {group, otp_6057}].
groups() ->
[{otp_6057,[],[otp_6057_a, otp_6057_b,
@@ -86,6 +83,41 @@ make_files(Config) when is_list(Config) ->
ensure_no_messages(),
ok.
+recompile_on_changed_include(Config) ->
+ Current = prepare_data_dir(Config),
+
+ Files = [test_incl1,"incl_src/test_incl2"],
+ up_to_date = make:files(Files),
+ ok = ensure_exists([test_incl1,test_incl2]),
+
+ {ok, FileInfo11} = file:read_file_info("test_incl1.beam"),
+ Date11 = FileInfo11#file_info.mtime,
+ {ok, FileInfo21} = file:read_file_info("test_incl2.beam"),
+ Date21 = FileInfo21#file_info.mtime,
+ timer:sleep(2000),
+
+ %% Touch the include file
+ {ok,Bin} = file:read_file("test_incl.hrl"),
+ ok = file:delete("test_incl.hrl"),
+ ok = file:write_file("test_incl.hrl",Bin),
+
+ up_to_date = make:files(Files),
+
+ {ok, FileInfo12} = file:read_file_info("test_incl1.beam"),
+ case FileInfo12#file_info.mtime of
+ Date11 -> ct:fail({"file not recompiled", "test_incl1.beam"});
+ _Date12 -> ok
+ end,
+ {ok, FileInfo22} = file:read_file_info("test_incl2.beam"),
+ case FileInfo22#file_info.mtime of
+ Date21 -> ct:fail({"file not recompiled", "test_incl2.beam"});
+ _Date22 -> ok
+ end,
+
+ file:set_cwd(Current),
+ ensure_no_messages(),
+ ok.
+
emake_opts(Config) when is_list(Config) ->
Current = prepare_data_dir(Config),