diff options
author | Oliver Ferrigni <oliver.ferrigni@asolutions.com> | 2013-01-14 15:16:13 -0600 |
---|---|---|
committer | Oliver Ferrigni <oliver.ferrigni@asolutions.com> | 2013-01-14 15:16:13 -0600 |
commit | d89370856329459d5ff6a74457278835b6a027de (patch) | |
tree | 9cdb9fd74d520afeedb8db7ceeb22c925a149d30 | |
parent | 78fa8fc3d5215e076284b37394e5ca149e945997 (diff) |
Fix file handling on windows for tests
Running tests on windows creates false positive due to setup failures
not executing all tests. Checking for tmp_dir was failing on
subsequent runs. Added cases to tmp_dir creation to delete preexisting
tmp_dirs in .eunit directory.
-rw-r--r-- | test/rebar_eunit_tests.erl | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/rebar_eunit_tests.erl b/test/rebar_eunit_tests.erl index 7b2eec5..61a9bbf 100644 --- a/test/rebar_eunit_tests.erl +++ b/test/rebar_eunit_tests.erl @@ -337,7 +337,15 @@ basic_setup_test_() -> "myfunc_test() -> ?assertMatch(ok, myapp_mymod:myfunc()).\n"]). make_tmp_dir() -> - ok = file:make_dir(?TMP_DIR). + case file:make_dir(?TMP_DIR) of + ok -> + ok; + {error, eexist} -> + remove_tmp_dir(), + make_tmp_dir(); + Error -> + throw(Error) + end. setup_environment() -> ok = make_tmp_dir(), @@ -389,8 +397,8 @@ prepare_rebar_script() -> {unix, _} -> [] = os:cmd("chmod u+x " ++ Rebar); {win32, _} -> - {ok, _} = file:copy(?REBAR_SCRIPT ++ ".bat", - ?TMP_DIR ++ "rebar.bat") + {ok, _} = file:copy(?REBAR_SCRIPT ++ ".cmd", + ?TMP_DIR ++ "rebar.cmd") end. rebar() -> |