summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSiri Hansen <siri@erlang.org>2017-03-06 11:36:26 +0100
committerSiri Hansen <siri@erlang.org>2017-03-06 11:36:26 +0100
commit64b5d878af4839ac7e2514bdc497cce818b1755e (patch)
treeecc174b4078817eb52986d6154668c80564d2d4c /src
parentdf432584dd75785c33d1fc075ee0a45e8aa9385a (diff)
Allow single test spec in ct_opts
The option {spec,Specs} is allowed in ct_opts, but rebar_prv_common_test:test_dirs did not take into account that Specs could also be a string only, i.e. not a list of strings.
Diffstat (limited to 'src')
-rw-r--r--src/rebar_prv_common_test.erl27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/rebar_prv_common_test.erl b/src/rebar_prv_common_test.erl
index 2ac8fc7..7a060f8 100644
--- a/src/rebar_prv_common_test.erl
+++ b/src/rebar_prv_common_test.erl
@@ -431,18 +431,21 @@ test_dirs(State, Apps, Opts) ->
set_compile_dirs(State, Apps, join(Suites, Dir));
{_Suites, _Dirs} -> {error, "Only a single directory may be specified when specifying suites"}
end;
- Specs0 ->
- case get_dirs_from_specs(Specs0) of
- {ok,{Specs,SuiteDirs}} ->
- {State1,Apps1} = set_compile_dirs1(State, Apps,
- {dir, SuiteDirs}),
- {State2,Apps2} = set_compile_dirs1(State1, Apps1,
- {spec, Specs}),
- [maybe_copy_spec(State2,Apps2,S) || S <- Specs],
- {ok, rebar_state:project_apps(State2, Apps2)};
- Error ->
- Error
- end
+ Spec when is_integer(hd(Spec)) ->
+ spec_test_dirs(State, Apps, [Spec]);
+ Specs ->
+ spec_test_dirs(State, Apps, Specs)
+ end.
+
+spec_test_dirs(State, Apps, Specs0) ->
+ case get_dirs_from_specs(Specs0) of
+ {ok,{Specs,SuiteDirs}} ->
+ {State1,Apps1} = set_compile_dirs1(State, Apps, {dir, SuiteDirs}),
+ {State2,Apps2} = set_compile_dirs1(State1, Apps1, {spec, Specs}),
+ [maybe_copy_spec(State2,Apps2,S) || S <- Specs],
+ {ok, rebar_state:project_apps(State2, Apps2)};
+ Error ->
+ Error
end.
join(Suite, Dir) when is_integer(hd(Suite)) ->