summaryrefslogtreecommitdiff
path: root/src/rebar_prv_common_test.erl
diff options
context:
space:
mode:
authorTristan Sloughter <tristan.sloughter@gmail.com>2015-01-09 20:59:11 -0600
committerTristan Sloughter <tristan.sloughter@gmail.com>2015-01-09 20:59:11 -0600
commit47269b1a8194e13a5a3de0f829cecaef85bf8419 (patch)
treecbf21f3ff777d7cbfdeb1bf455042679b8c1a85e /src/rebar_prv_common_test.erl
parentde6bba6ff683f80463a5f97d14f29f13bce6ebf1 (diff)
parent5e270a745632739f0a6af10014b906047cdb31bd (diff)
Merge pull request #95 from talentdeficit/stable_test_dirs
when compiling `common_test` or `eunit` use the same tmp dir
Diffstat (limited to 'src/rebar_prv_common_test.erl')
-rw-r--r--src/rebar_prv_common_test.erl22
1 files changed, 17 insertions, 5 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 7a52c92..f17134a 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -178,13 +178,25 @@ split_ct_dirs(State, RawOpts) ->
proplists:get_value(dir, CTOpts, []);
Dirs -> split_string(Dirs)
end,
- OutDir = case proplists:get_value(outdir, RawOpts) of
- undefined -> filename:join([rebar_state:dir(State),
- ec_file:insecure_mkdtemp()]);
- Out -> Out
- end,
+ OutDir = proplists:get_value(outdir, RawOpts, default_test_dir(State)),
{InDirs, OutDir}.
+default_test_dir(State) ->
+ Tmp = case erlang:system_info(system_architecture) of
+ "win32" ->
+ "./tmp";
+ _SysArch ->
+ "/tmp"
+ end,
+ Root = filename:join([rebar_state:dir(State), Tmp]),
+ Project = filename:basename(rebar_state:dir(State)),
+ OutDir = filename:join([Root, Project ++ "_rebar3_ct"]),
+ %% delete the directory if it exists so tests run with clean state
+ _ = ec_file:remove(OutDir, [recursive]),
+ %% recreate the directory
+ ok = filelib:ensure_dir(filename:join([OutDir, "dummy.beam"])),
+ OutDir.
+
transform_opts(Opts) ->
transform_opts(Opts, []).