summaryrefslogtreecommitdiff
path: root/inttest/proto_gpb
diff options
context:
space:
mode:
authorTomas Abrahamsson <tomas.abrahamsson@gmail.com>2014-12-23 15:56:06 +0100
committerTomas Abrahamsson <tomas.abrahamsson@gmail.com>2014-12-23 16:28:23 +0100
commita7b7205d072702247518019ae2a1540a323871fe (patch)
tree508a656d364038a159c40bdc692a196148e69e53 /inttest/proto_gpb
parentae7a7aae18116eedd582662bf28644428f175029 (diff)
downloadrebar-a7b7205d072702247518019ae2a1540a323871fe.tar.gz
Revert "Merge pull request #386 from tomas-abrahamsson/gpb-recompilation-detection"
This reverts commit 81063d33f0939416f9bc0a7fc6a4cc326a0059d2, reversing changes made to 6584defdda209d43505baee21b0f9f4d7f829573. This was reverted because it changed the gpb compiler to not use rebar_base_compiler. That change was to add support for target name prefixes, but it is better to add that support to rebar_base_compiler.
Diffstat (limited to 'inttest/proto_gpb')
-rw-r--r--inttest/proto_gpb/proto_gpb_rt.erl50
1 files changed, 0 insertions, 50 deletions
diff --git a/inttest/proto_gpb/proto_gpb_rt.erl b/inttest/proto_gpb/proto_gpb_rt.erl
index cfbd1b4..aafc677 100644
--- a/inttest/proto_gpb/proto_gpb_rt.erl
+++ b/inttest/proto_gpb/proto_gpb_rt.erl
@@ -29,8 +29,6 @@
run/1]).
-include_lib("eunit/include/eunit.hrl").
--include_lib("kernel/include/file.hrl").
--include_lib("deps/retest/include/retest.hrl").
-define(MODULES,
[foo,
@@ -44,13 +42,6 @@
test4_gpb,
test5_gpb]).
--define(SOURCE_PROTO_FILES,
- ["test.proto",
- "a/test2.proto",
- "a/b/test3.proto",
- "c/test4.proto",
- "c/d/test5.proto"]).
-
files() ->
[
{copy, "../../rebar", "rebar"},
@@ -69,17 +60,6 @@ run(_Dir) ->
%% generating the test_gpb.hrl file, and also that it generated
%% the .hrl file was generated before foo was compiled.
ok = check_beams_generated(),
-
- ?DEBUG("Verifying recompilation~n", []),
- TestErl = hd(generated_erl_files()),
- TestProto = hd(source_proto_files()),
- make_proto_newer_than_erl(TestProto, TestErl),
- TestMTime1 = read_mtime(TestErl),
- ?assertMatch({ok, _}, retest_sh:run("./rebar compile", [])),
- TestMTime2 = read_mtime(TestErl),
- ?assert(TestMTime2 > TestMTime1),
-
- ?DEBUG("Verify cleanup~n", []),
?assertMatch({ok, _}, retest_sh:run("./rebar clean", [])),
ok = check_files_deleted(),
ok.
@@ -101,12 +81,6 @@ generated_erl_files() ->
generated_hrl_files() ->
add_dir("include", add_ext(?GENERATED_MODULES, ".hrl")).
-generated_beam_files() ->
- add_dir("ebin", add_ext(?GENERATED_MODULES, ".beam")).
-
-source_proto_files() ->
- add_dir("src", ?SOURCE_PROTO_FILES).
-
file_does_not_exist(F) ->
not filelib:is_regular(F).
@@ -116,30 +90,6 @@ add_ext(Modules, Ext) ->
add_dir(Dir, Files) ->
[filename:join(Dir, File) || File <- Files].
-read_mtime(File) ->
- {ok, #file_info{mtime=MTime}} = file:read_file_info(File),
- MTime.
-
-
-make_proto_newer_than_erl(Proto, Erl) ->
- %% Do this by back-dating the erl file instead of touching the
- %% proto file. Do this instead of sleeping for a second to get a
- %% reliable test. Sleeping would have been needed sin ce the
- %% #file_info{} (used by eg. filelib:last_modified) does not have
- %% sub-second resolution (even though most file systems have).
- {ok, #file_info{mtime=ProtoMTime}} = file:read_file_info(Proto),
- {ok, ErlInfo} = file:read_file_info(Erl),
- OlderMTime = update_seconds_to_datetime(ProtoMTime, -2),
- OlderErlInfo = ErlInfo#file_info{mtime = OlderMTime},
- ok = file:write_file_info(Erl, OlderErlInfo).
-
-update_seconds_to_datetime(DT, ToAdd) ->
- calendar:gregorian_seconds_to_datetime(
- calendar:datetime_to_gregorian_seconds(DT) + ToAdd).
-
-touch_file(File) ->
- ?assertMatch({ok, _}, retest_sh:run("touch " ++ File, [])).
-
check(Check, Files) ->
lists:foreach(
fun(F) ->