diff options
author | Peter Andersson <[email protected]> | 2013-06-04 20:08:59 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2013-06-05 16:13:54 +0200 |
commit | 4f5f57d0bdd8b5ba9902c868758130a660c22606 (patch) | |
tree | 98e9c551e1099cf0911a198ef03bdc912bbca0e6 /lib | |
parent | 1afd0898f2c868df20e074ef3831dad0eac69095 (diff) | |
download | otp-4f5f57d0bdd8b5ba9902c868758130a660c22606.tar.gz otp-4f5f57d0bdd8b5ba9902c868758130a660c22606.tar.bz2 otp-4f5f57d0bdd8b5ba9902c868758130a660c22606.zip |
Improve error report if crash due to bad testspec
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common_test/src/ct_run.erl | 6 | ||||
-rw-r--r-- | lib/common_test/src/ct_testspec.erl | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl index 41d53c7b43..266ca73417 100644 --- a/lib/common_test/src/ct_run.erl +++ b/lib/common_test/src/ct_run.erl @@ -402,7 +402,8 @@ script_start2(Opts = #opts{vts = undefined, Relaxed = get_start_opt(allow_user_terms, true, false, Args), case catch ct_testspec:collect_tests_from_file(Specs1, Relaxed) of {E,Reason} when E == error ; E == 'EXIT' -> - {error,Reason}; + StackTrace = erlang:get_stacktrace(), + {error,{invalid_testspec,{Reason,StackTrace}}}; TestSpecData -> execute_all_specs(TestSpecData, Opts, Args, []) end; @@ -1101,7 +1102,8 @@ run_spec_file(Relaxed, AbsSpecs1 = get_start_opt(join_specs, [AbsSpecs], AbsSpecs, StartOpts), case catch ct_testspec:collect_tests_from_file(AbsSpecs1, Relaxed) of {Error,CTReason} when Error == error ; Error == 'EXIT' -> - exit({error,CTReason}); + StackTrace = erlang:get_stacktrace(), + exit({error,{invalid_testspec,{CTReason,StackTrace}}}); TestSpecData -> run_all_specs(TestSpecData, Opts, StartOpts, []) end. diff --git a/lib/common_test/src/ct_testspec.erl b/lib/common_test/src/ct_testspec.erl index 71b03c0ea6..a3a47db41c 100644 --- a/lib/common_test/src/ct_testspec.erl +++ b/lib/common_test/src/ct_testspec.erl @@ -262,8 +262,10 @@ collect_tests_from_file(Specs,Nodes,Relaxed) when is_list(Nodes) -> [filter_and_convert(Joined) | filter_and_convert(SeparateTestSpecs)] catch + _:Error={error,_} -> + Error; _:Error -> - Error + {error,Error} end. filter_and_convert(Joined) when is_tuple(Joined) -> |