mirror of
https://github.com/correl/rebar.git
synced 2024-11-27 11:09:55 +00:00
allow suite[s] or test[s] as options for eunit and ct
This commit is contained in:
parent
af91604053
commit
cc72cd8fce
3 changed files with 60 additions and 36 deletions
|
@ -333,51 +333,51 @@ show_info_maybe_halt(O, Opts, F) ->
|
|||
%%
|
||||
commands() ->
|
||||
S = <<"
|
||||
clean Clean
|
||||
compile Compile sources
|
||||
clean Clean
|
||||
compile Compile sources
|
||||
|
||||
escriptize Generate escript archive
|
||||
escriptize Generate escript archive
|
||||
|
||||
create template= [var=foo,...] Create skel based on template and vars
|
||||
create-app [appid=myapp] Create simple app skel
|
||||
create-lib [libid=mylib] Create simple lib skel
|
||||
create-node [nodeid=mynode] Create simple node skel
|
||||
list-templates List available templates
|
||||
create template= [var=foo,...] Create skel based on template and vars
|
||||
create-app [appid=myapp] Create simple app skel
|
||||
create-lib [libid=mylib] Create simple lib skel
|
||||
create-node [nodeid=mynode] Create simple node skel
|
||||
list-templates List available templates
|
||||
|
||||
doc Generate Erlang program documentation
|
||||
doc Generate Erlang program documentation
|
||||
|
||||
check-deps Display to be fetched dependencies
|
||||
get-deps Fetch dependencies
|
||||
update-deps Update fetched dependencies
|
||||
delete-deps Delete fetched dependencies
|
||||
list-deps List dependencies
|
||||
check-deps Display to be fetched dependencies
|
||||
get-deps Fetch dependencies
|
||||
update-deps Update fetched dependencies
|
||||
delete-deps Delete fetched dependencies
|
||||
list-deps List dependencies
|
||||
|
||||
generate [dump_spec=0/1] Build release with reltool
|
||||
overlay Run reltool overlays only
|
||||
generate [dump_spec=0/1] Build release with reltool
|
||||
overlay Run reltool overlays only
|
||||
|
||||
generate-upgrade previous_release=path Build an upgrade package
|
||||
|
||||
generate-appups previous_release=path Generate appup files
|
||||
|
||||
eunit [suites=foo] Run eunit tests in foo.erl and
|
||||
test/foo_tests.erl
|
||||
[suites=foo] [tests=bar] Run specific eunit tests [first test name
|
||||
starting with 'bar' in foo.erl and
|
||||
test/foo_tests.erl]
|
||||
[tests=bar] For every existing suite, run the first
|
||||
test whose name starts with bar and, if
|
||||
no such test exists, run the test whose
|
||||
name starts with bar in the suite's
|
||||
_tests module
|
||||
eunit [suite[s]=foo] Run eunit tests in foo.erl and
|
||||
test/foo_tests.erl
|
||||
[suite[s]=foo] [test[s]=bar] Run specific eunit tests [first test
|
||||
name starting with 'bar' in foo.erl
|
||||
and test/foo_tests.erl]
|
||||
[test[s]=bar] For every existing suite, run the first
|
||||
test whose name starts with bar and, if
|
||||
no such test exists, run the test whose
|
||||
name starts with bar in the suite's
|
||||
_tests module
|
||||
|
||||
ct [suites=] [case=] Run common_test suites
|
||||
ct [suite[s]=] [case=] Run common_test suites
|
||||
|
||||
qc Test QuickCheck properties
|
||||
qc Test QuickCheck properties
|
||||
|
||||
xref Run cross reference analysis
|
||||
xref Run cross reference analysis
|
||||
|
||||
help Show the program options
|
||||
version Show version information
|
||||
help Show the program options
|
||||
version Show version information
|
||||
">>,
|
||||
io:put_chars(S).
|
||||
|
||||
|
|
|
@ -320,7 +320,7 @@ get_config_file(TestDir) ->
|
|||
end.
|
||||
|
||||
get_suites(Config, TestDir) ->
|
||||
case rebar_config:get_global(Config, suites, undefined) of
|
||||
case get_suites(Config) of
|
||||
undefined ->
|
||||
" -dir " ++ TestDir;
|
||||
Suites ->
|
||||
|
@ -329,6 +329,14 @@ get_suites(Config, TestDir) ->
|
|||
string:join([" -suite"] ++ Suites2, " ")
|
||||
end.
|
||||
|
||||
get_suites(Config) ->
|
||||
case rebar_config:get_global(Config, suites, undefined) of
|
||||
undefined ->
|
||||
rebar_config:get_global(Config, suite, undefined);
|
||||
Suites ->
|
||||
Suites
|
||||
end.
|
||||
|
||||
find_suite_path(Suite, TestDir) ->
|
||||
Path = filename:join(TestDir, Suite ++ "_SUITE.erl"),
|
||||
case filelib:is_regular(Path) of
|
||||
|
|
|
@ -120,9 +120,9 @@ info_help(Description) ->
|
|||
" ~p~n"
|
||||
" ~p~n"
|
||||
"Valid command line options:~n"
|
||||
" suites=\"foo,bar\" (Run tests in foo.erl, test/foo_tests.erl and~n"
|
||||
" suite[s]=\"foo,bar\" (Run tests in foo.erl, test/foo_tests.erl and~n"
|
||||
" tests in bar.erl, test/bar_tests.erl)~n"
|
||||
" tests=\"baz\" (For every existing suite, run the first test whose~n"
|
||||
" test[s]=\"baz\" (For every existing suite, run the first test whose~n"
|
||||
" name starts with bar and, if no such test exists,~n"
|
||||
" run the test whose name starts with bar in the~n"
|
||||
" suite's _tests module)~n"
|
||||
|
@ -215,7 +215,7 @@ setup_code_path() ->
|
|||
%%
|
||||
|
||||
filter_suites(Config, Modules) ->
|
||||
RawSuites = rebar_config:get_global(Config, suites, ""),
|
||||
RawSuites = get_suites(Config),
|
||||
SuitesProvided = RawSuites =/= "",
|
||||
Suites = [list_to_atom(Suite) || Suite <- string:tokens(RawSuites, ",")],
|
||||
{SuitesProvided, filter_suites1(Modules, Suites)}.
|
||||
|
@ -225,6 +225,14 @@ filter_suites1(Modules, []) ->
|
|||
filter_suites1(Modules, Suites) ->
|
||||
[M || M <- Suites, lists:member(M, Modules)].
|
||||
|
||||
get_suites(Config) ->
|
||||
case rebar_config:get_global(Config, suites, "") of
|
||||
"" ->
|
||||
rebar_config:get_global(Config, suite, "");
|
||||
Suites ->
|
||||
Suites
|
||||
end.
|
||||
|
||||
%%
|
||||
%% == get matching tests ==
|
||||
%%
|
||||
|
@ -259,8 +267,16 @@ get_tests(Config, SuitesProvided, ModuleBeamFiles, FilteredModules) ->
|
|||
end,
|
||||
get_matching_tests(Config, Modules).
|
||||
|
||||
get_tests(Config) ->
|
||||
case rebar_config:get_global(Config, tests, "") of
|
||||
"" ->
|
||||
rebar_config:get_global(Config, test, "");
|
||||
Suites ->
|
||||
Suites
|
||||
end.
|
||||
|
||||
get_matching_tests(Config, Modules) ->
|
||||
RawFunctions = rebar_config:get_global(Config, tests, ""),
|
||||
RawFunctions = get_tests(Config),
|
||||
Tests = [list_to_atom(F1) || F1 <- string:tokens(RawFunctions, ",")],
|
||||
case Tests of
|
||||
[] ->
|
||||
|
|
Loading…
Reference in a new issue