summaryrefslogtreecommitdiff
path: root/test/rebar_compile_SUITE.erl
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2018-09-21 10:32:57 -0600
committerGitHub <noreply@github.com>2018-09-21 10:32:57 -0600
commit2dfba204e4dea5d1c3821fd26d22bd7201595f6c (patch)
tree147f7ab179d3342bc06d106e188d5c62637bc3ec /test/rebar_compile_SUITE.erl
parent8e0ef83de48968fed80114cc4518004ed59fa649 (diff)
properly support top level app erl_opts from REBAR_CONFIG os var (#1889)
When REBAR_CONFIG was set it would not effect the top level app's configuration because app_discover was rereading the top level rebar.config which ignored REBAR_CONFIG. Instead this patch has it use the existing configuration from REBAR_CONFIG.
Diffstat (limited to 'test/rebar_compile_SUITE.erl')
-rw-r--r--test/rebar_compile_SUITE.erl28
1 files changed, 26 insertions, 2 deletions
diff --git a/test/rebar_compile_SUITE.erl b/test/rebar_compile_SUITE.erl
index 269413e..e97b5fb 100644
--- a/test/rebar_compile_SUITE.erl
+++ b/test/rebar_compile_SUITE.erl
@@ -38,7 +38,8 @@ all() ->
recursive, no_recursive,
always_recompile_when_erl_compiler_options_set,
dont_recompile_when_erl_compiler_options_env_does_not_change,
- recompile_when_erl_compiler_options_env_changes].
+ recompile_when_erl_compiler_options_env_changes,
+ rebar_config_os_var].
groups() ->
[{basic_app, [], [build_basic_app, paths_basic_app, clean_basic_app]},
@@ -774,7 +775,7 @@ recompile_when_opts_change(Config) ->
rebar_test_utils:create_config(AppDir, [{erl_opts, [{d, some_define}]}]),
- rebar_test_utils:run_and_check(Config, [], ["compile"], {ok, [{app, Name}]}),
+ rebar_test_utils:run_and_check(Config, [{erl_opts, [{d, some_define}]}], ["compile"], {ok, [{app, Name}]}),
{ok, NewFiles} = rebar_utils:list_dir(EbinDir),
NewModTime = [filelib:last_modified(filename:join([EbinDir, F]))
@@ -1944,6 +1945,29 @@ recompile_when_erl_compiler_options_env_changes(Config) ->
_ -> os:putenv("ERL_COMPILER_OPTIONS", ExistingEnv)
end.
+rebar_config_os_var(Config) ->
+ AppDir = ?config(apps, Config),
+
+ Name = rebar_test_utils:create_random_name("rebar_config_os_var_"),
+ Vsn = rebar_test_utils:create_random_vsn(),
+ rebar_test_utils:create_app(AppDir, Name, Vsn, [kernel, stdlib]),
+
+ rebar_test_utils:create_config(AppDir, [{erl_opts, []}]),
+
+ AltConfig = filename:join(AppDir, "test.rebar.config"),
+ file:write_file(AltConfig, "{erl_opts, [compressed]}."),
+ true = os:putenv("REBAR_CONFIG", AltConfig),
+
+ rebar_test_utils:run_and_check(Config, ["compile"], {ok, [{app, Name}]}),
+
+ Path = filename:join([AppDir, "_build", "default", "lib", Name, "ebin"]),
+ code:add_patha(Path),
+
+ Mod = list_to_atom("not_a_real_src_" ++ Name),
+
+ true = lists:member(compressed, proplists:get_value(options, Mod:module_info(compile), [])),
+ ok.
+
%% this test sets the env var, compiles, records the file last modified
%% timestamp, recompiles and compares the file last modified timestamp to
%% ensure it has changed. this test should run on 18.x