aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
authorPeter Andersson <peppe@erlang.org>2010-06-04 01:06:03 +0200
committerRaimo Niskanen <raimo@erlang.org>2010-06-09 16:19:22 +0200
commita3af252253c1fbc642cf6229ff1e23f095b75b59 (patch)
tree348bcbc556c0972becb2fa39400fd0fb93ba8177 /lib/common_test
parent470063d25f6128ef83cba6864533fc05e45cca74 (diff)
downloadotp-a3af252253c1fbc642cf6229ff1e23f095b75b59.tar.gz
otp-a3af252253c1fbc642cf6229ff1e23f095b75b59.tar.bz2
otp-a3af252253c1fbc642cf6229ff1e23f095b75b59.zip
Have end_per_testcase run even after timetrap_timeout and abort_testcase
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/src/ct_run.erl4
-rw-r--r--lib/common_test/test/ct_error_SUITE.erl38
2 files changed, 38 insertions, 4 deletions
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index c2fe2ababd..f993985f52 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -89,7 +89,7 @@ script_start() ->
end, Flags)
end,
%% used for purpose of testing the run_test interface
- io:format(user, "~n--------------- START ARGS ---------------~n", []),
+ io:format(user, "~n-------------------- START ARGS --------------------~n", []),
io:format(user, "--- Init args:~n~p~n", [FlagFilter(Init)]),
io:format(user, "--- CT args:~n~p~n", [FlagFilter(CtArgs)]),
EnvArgs = opts2args(EnvStartOpts),
@@ -97,7 +97,7 @@ script_start() ->
[EnvStartOpts,EnvArgs]),
Merged = merge_arguments(CtArgs ++ EnvArgs),
io:format(user, "--- Merged args:~n~p~n", [FlagFilter(Merged)]),
- io:format(user, "------------------------------------------~n~n", []),
+ io:format(user, "----------------------------------------------------~n~n", []),
Merged;
_ ->
merge_arguments(CtArgs)
diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl
index d5d91706d9..edf28e0bca 100644
--- a/lib/common_test/test/ct_error_SUITE.erl
+++ b/lib/common_test/test/ct_error_SUITE.erl
@@ -63,7 +63,8 @@ all(suite) ->
[
cfg_error,
lib_error,
- no_compile
+ no_compile,
+ timetrap
].
@@ -133,6 +134,23 @@ no_compile(Config) when is_list(Config) ->
TestEvents = events_to_check(no_compile),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
+%%%-----------------------------------------------------------------
+%%%
+timetrap(Config) when is_list(Config) ->
+ DataDir = ?config(data_dir, Config),
+ Join = fun(D, S) -> filename:join(D, "error/test/"++S) end,
+ Suites = [Join(DataDir, "timetrap_1_SUITE")],
+ {Opts,ERPid} = setup({suite,Suites}, Config),
+ ok = ct_test_support:run(Opts, Config),
+ Events = ct_test_support:get_events(ERPid, Config),
+
+ ct_test_support:log_events(timetrap,
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config)),
+
+ TestEvents = events_to_check(timetrap),
+ ok = ct_test_support:verify_events(TestEvents, Events, Config).
+
%%%-----------------------------------------------------------------
%%% HELP FUNCTIONS
@@ -564,4 +582,20 @@ test_events(lib_error) ->
];
test_events(no_compile) ->
- [].
+ [];
+
+test_events(timetrap) ->
+ [
+ {?eh,start_logging,{'DEF','RUNDIR'}},
+ {?eh,test_start,{'DEF',{'START_TIME','LOGDIR'}}},
+ {?eh,start_info,{1,1,1}},
+ {?eh,tc_start,{timetrap_1_SUITE,init_per_suite}},
+ {?eh,tc_done,{timetrap_1_SUITE,init_per_suite,ok}},
+ {?eh,tc_start,{timetrap_1_SUITE,tc1}},
+ {?eh,tc_done,{timetrap_1_SUITE,tc1,{failed,{timetrap_timeout,1000}}}},
+ {?eh,test_stats,{0,1,{0,0}}},
+ {?eh,tc_start,{timetrap_1_SUITE,end_per_suite}},
+ {?eh,tc_done,{timetrap_1_SUITE,end_per_suite,ok}},
+ {?eh,test_done,{'DEF','STOP_TIME'}},
+ {?eh,stop_logging,[]}
+ ].