aboutsummaryrefslogtreecommitdiffstats
path: root/lib/test_server/src/ts.erl
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2012-03-09 11:41:12 +0100
committerLukas Larsson <[email protected]>2012-03-09 11:41:12 +0100
commit89eda5d5783b7f81e238d8108f3a2e8ac9cbf02e (patch)
tree85fc3757807b645ba64c0ea4b8b6560a0388de77 /lib/test_server/src/ts.erl
parent91de0b23d35782b2059faa7323744138eb5545f8 (diff)
parent77db1eaa53b1c9d3aeef9d0608e5d4ee3f70fe82 (diff)
downloadotp-89eda5d5783b7f81e238d8108f3a2e8ac9cbf02e.tar.gz
otp-89eda5d5783b7f81e238d8108f3a2e8ac9cbf02e.tar.bz2
otp-89eda5d5783b7f81e238d8108f3a2e8ac9cbf02e.zip
Merge branch 'lukas/test_server/ts_skip_unknown_applications/OTP-9971' into maint
* lukas/test_server/ts_skip_unknown_applications/OTP-9971: Ignore non-app suites when checking suites to skip Create special spec file when application is missing
Diffstat (limited to 'lib/test_server/src/ts.erl')
-rw-r--r--lib/test_server/src/ts.erl25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/test_server/src/ts.erl b/lib/test_server/src/ts.erl
index 729a2b11fc..7e48a11f33 100644
--- a/lib/test_server/src/ts.erl
+++ b/lib/test_server/src/ts.erl
@@ -301,7 +301,15 @@ run(List, Opts) when is_list(List), is_list(Opts) ->
run(Testspec, Config) when is_atom(Testspec), is_list(Config) ->
Options=check_test_get_opts(Testspec, Config),
File=atom_to_list(Testspec),
- run_test(File, [{spec,[File++".spec"]}], Options);
+ Spec = case code:lib_dir(Testspec) of
+ {error, bad_name} when Testspec /= emulator,
+ Testspec /= system,
+ Testspec /= epmd ->
+ create_skip_spec(Testspec, tests(Testspec));
+ _ ->
+ File++".spec"
+ end,
+ run_test(File, [{spec,[Spec]}], Options);
%% Runs one module in a spec (interactive)
run(Testspec, Mod) when is_atom(Testspec), is_atom(Mod) ->
run_test({atom_to_list(Testspec), Mod},
@@ -332,6 +340,21 @@ run(Testspec, Mod, Case, Config) when is_atom(Testspec),
Args = [{suite,atom_to_list(Mod)}, {testcase,atom_to_list(Case)}],
run_test(atom_to_list(Testspec), Args, Options).
+%% Create a spec to skip all SUITES, this is used when the application
+%% to be tested is not part of the OTP release to be tested.
+create_skip_spec(Testspec, SuitesToSkip) ->
+ {ok,Cwd} = file:get_cwd(),
+ TestspecString = atom_to_list(Testspec),
+ Specname = TestspecString++"_skip.spec",
+ {ok,D} = file:open(filename:join([filename:dirname(Cwd),
+ TestspecString++"_test",Specname]),
+ [write]),
+ TestDir = "\"../"++TestspecString++"_test\"",
+ io:format(D,"{suites, "++TestDir++", all}.~n",[]),
+ io:format(D,"{skip_suites, "++TestDir++", ~w, \"Skipped as application"
+ " is not in path!\"}.",[SuitesToSkip]),
+ Specname.
+
%% Check testspec to be valid and get possible Options
%% from the config.
check_test_get_opts(Testspec, Config) ->