diff options
author | Tristan Sloughter <t@crashfast.com> | 2018-11-09 12:22:12 -0700 |
---|---|---|
committer | Tristan Sloughter <t@crashfast.com> | 2018-11-09 12:51:20 -0700 |
commit | 8d31d559c18b12d3d06655de2ca9c7f76c67c948 (patch) | |
tree | b4115c9aff9fdec6c4bcb752c9a28d2980f443c1 /test | |
parent | 60dc0504bf46e9ece179da9b20c54e0e2a3e11c6 (diff) |
check last modified time on erl files for xrl and yrl files before compiling
Diffstat (limited to 'test')
-rw-r--r-- | test/rebar_compile_SUITE.erl | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl index 6b1d791..4d51f2a 100644 --- a/test/rebar_compile_SUITE.erl +++ b/test/rebar_compile_SUITE.erl @@ -845,20 +845,33 @@ dont_recompile_yrl_or_xrl(Config) -> "F -> number : '$1'.\n"], ok = ec_file:write(Yrl, YrlBody), - XrlBeam = filename:join([AppDir, "ebin", filename:basename(Xrl, ".xrl") ++ ".beam"]), - YrlBeam = filename:join([AppDir, "ebin", filename:basename(Yrl, ".yrl") ++ ".beam"]), + XrlErl = filename:join([AppDir, "src", filename:basename(Xrl, ".xrl") ++ ".erl"]), + YrlErl = filename:join([AppDir, "src", filename:basename(Yrl, ".yrl") ++ ".erl"]), + + EbinDir = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]), + XrlBeam = filename:join([EbinDir, filename:basename(Xrl, ".xrl") ++ ".beam"]), + YrlBeam = filename:join([EbinDir, filename:basename(Yrl, ".yrl") ++ ".beam"]), rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}), - XrlModTime = filelib:last_modified(XrlBeam), - YrlModTime = filelib:last_modified(YrlBeam), + XrlModTime = filelib:last_modified(XrlErl), + YrlModTime = filelib:last_modified(YrlErl), + + XrlBeamModTime = filelib:last_modified(XrlBeam), + YrlBeamModTime = filelib:last_modified(YrlBeam), timer:sleep(1000), rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}), - NewXrlModTime = filelib:last_modified(XrlBeam), - NewYrlModTime = filelib:last_modified(YrlBeam), + NewXrlModTime = filelib:last_modified(XrlErl), + NewYrlModTime = filelib:last_modified(YrlErl), + + NewXrlBeamModTime = filelib:last_modified(XrlBeam), + NewYrlBeamModTime = filelib:last_modified(YrlBeam), + + ?assert(XrlBeamModTime == NewXrlBeamModTime), + ?assert(YrlBeamModTime == NewYrlBeamModTime), ?assert(XrlModTime == NewXrlModTime), ?assert(YrlModTime == NewYrlModTime). |