mirror of
https://github.com/correl/rebar.git
synced 2024-12-18 11:06:20 +00:00
ct: skip instead of halt on missing/unknown suite
This allows `rebar ct suites=abc` to consider all suites when you have a rebar setup with multiple sub_dirs. Previously, rebar halted after it could not find the suite in the first dir. But the suite might be present in another dir (when sub_dirs contains multiple dirs). This commit makes it so instead of halting, it prints a warning and continues with looking for the suite in the other `sub_dir`s. Note -- This uses try/catch to cause the test to be skipped because otherwise I needed to adjust the return values of 4 functions, the code path is pretty deeply nested here. Otherwise the whole call chain needed to be adjusted for this return value: `run_test -> make_cmd -> get_suites -> find_suite_path` IMHO, I think for exceptional cases like this it is fine to use throw; specially since only the {skip} is catched and nothing else.
This commit is contained in:
parent
380506c380
commit
cc67814b65
1 changed files with 10 additions and 3 deletions
|
@ -65,7 +65,12 @@ run_test_if_present(TestDir, LogDir, Config, File) ->
|
||||||
++ " SUITES - skipping\n", [TestDir]),
|
++ " SUITES - skipping\n", [TestDir]),
|
||||||
ok;
|
ok;
|
||||||
_ ->
|
_ ->
|
||||||
|
try
|
||||||
run_test(TestDir, LogDir, Config, File)
|
run_test(TestDir, LogDir, Config, File)
|
||||||
|
catch
|
||||||
|
throw:skip ->
|
||||||
|
ok
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -270,8 +275,10 @@ find_suite_path(Suite, TestDir) ->
|
||||||
Path = filename:join(TestDir, Suite ++ "_SUITE.erl"),
|
Path = filename:join(TestDir, Suite ++ "_SUITE.erl"),
|
||||||
case filelib:is_regular(Path) of
|
case filelib:is_regular(Path) of
|
||||||
false ->
|
false ->
|
||||||
?ERROR("Suite ~s not found\n", [Suite]),
|
?WARN("Suite ~s not found\n", [Suite]),
|
||||||
?FAIL;
|
%% Note - this throw is caught in run_test_if_present/3;
|
||||||
|
%% this solution was easier than refactoring the entire module.
|
||||||
|
throw(skip);
|
||||||
true ->
|
true ->
|
||||||
Path
|
Path
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in a new issue