diff options
author | Peter Andersson <peppe@erlang.org> | 2012-03-12 21:15:54 +0100 |
---|---|---|
committer | Peter Andersson <peppe@erlang.org> | 2012-03-12 21:50:45 +0100 |
commit | 4db5923978dff90b5c14f2a526783aadfc3e5af2 (patch) | |
tree | 53c3801fecfe3cd7f3a9568064c6a3e893b1f48e /lib/common_test/src/ct_run.erl | |
parent | 5b64a7eff49fdf3cfaafe9181161b8198e64cd59 (diff) | |
download | otp-4db5923978dff90b5c14f2a526783aadfc3e5af2.tar.gz otp-4db5923978dff90b5c14f2a526783aadfc3e5af2.tar.bz2 otp-4db5923978dff90b5c14f2a526783aadfc3e5af2.zip |
Have ct_run clean up the code path after each test run
OTP-9595
Diffstat (limited to 'lib/common_test/src/ct_run.erl')
-rw-r--r-- | lib/common_test/src/ct_run.erl | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 57000a1c56..b496d2694f 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -1746,25 +1746,31 @@ set_group_leader_same_as_shell() -> false end. -check_and_add([{TestDir0,M,_} | Tests], Added) -> +check_and_add([{TestDir0,M,_} | Tests], Added, PA) -> case locate_test_dir(TestDir0, M) of {ok,TestDir} -> case lists:member(TestDir, Added) of true -> - check_and_add(Tests, Added); + check_and_add(Tests, Added, PA); false -> - true = code:add_patha(TestDir), - check_and_add(Tests, [TestDir|Added]) + case lists:member(rm_trailing_slash(TestDir), + code:get_path()) of + false -> + true = code:add_patha(TestDir), + check_and_add(Tests, [TestDir|Added], [TestDir|PA]); + true -> + check_and_add(Tests, [TestDir|Added], PA) + end end; {error,_} -> {error,{invalid_directory,TestDir0}} end; -check_and_add([], _) -> - ok. +check_and_add([], _, PA) -> + {ok,PA}. do_run_test(Tests, Skip, Opts) -> - case check_and_add(Tests, []) of - ok -> + case check_and_add(Tests, [], []) of + {ok,AddedToPath} -> ct_util:set_testdata({stats,{0,0,{0,0}}}), ct_util:set_testdata({cover,undefined}), test_server_ctrl:start_link(local), @@ -1858,7 +1864,9 @@ do_run_test(Tests, Skip, Opts) -> end, lists:foreach(fun(Suite) -> maybe_cleanup_interpret(Suite, Opts#opts.step) - end, CleanUp); + end, CleanUp), + [code:del_path(Dir) || Dir <- AddedToPath], + ok; Error -> Error end. |