diff options
author | Peter Andersson <[email protected]> | 2012-08-23 15:11:06 +0200 |
---|---|---|
committer | Peter Andersson <[email protected]> | 2012-08-23 15:15:46 +0200 |
commit | 55a885431333e263228e069c2aa7d56ec8e2b25c (patch) | |
tree | 4b4a0e4cbb0cd5170e075fefb392eeab9516f3a7 /lib/common_test/src/cth_surefire.erl | |
parent | db5288a7ee4a60aff143f65b90a2bebcbe1bf15d (diff) | |
parent | e711632042d1538fce80d565a2add309a88efa1b (diff) | |
download | otp-55a885431333e263228e069c2aa7d56ec8e2b25c.tar.gz otp-55a885431333e263228e069c2aa7d56ec8e2b25c.tar.bz2 otp-55a885431333e263228e069c2aa7d56ec8e2b25c.zip |
Merge remote branch 'origin/peppe/common_test/ct_hooks_errors' into maint
* origin/peppe/common_test/ct_hooks_errors:
Fix IO printout crash caused by hook function
Fix timetrap error in pre-hooks
Conflicts:
lib/common_test/src/cth_surefire.erl
OTP-10050
OTP-10069
OTP-10072
Diffstat (limited to 'lib/common_test/src/cth_surefire.erl')
-rw-r--r-- | lib/common_test/src/cth_surefire.erl | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/common_test/src/cth_surefire.erl b/lib/common_test/src/cth_surefire.erl index d04a8b07db..e7bd84e51b 100644 --- a/lib/common_test/src/cth_surefire.erl +++ b/lib/common_test/src/cth_surefire.erl @@ -82,21 +82,26 @@ pre_init_per_testcase(_TC,Config,State) -> {Config, init_tc(State, Config)}. post_end_per_testcase(TC,Config,Result,State) -> {Result, end_tc(TC,Config, Result,State)}. +on_tc_fail(_TC, _Res, State = #state{test_cases = []}) -> + State; on_tc_fail(_TC, Res, State) -> TCs = State#state.test_cases, - TC = hd(State#state.test_cases), - NewTC = TC#testcase{ failure = - {fail,lists:flatten(io_lib:format("~p",[Res]))} }, + TC = hd(TCs), + NewTC = TC#testcase{ + failure = + {fail,lists:flatten(io_lib:format("~p",[Res]))} }, State#state{ test_cases = [NewTC | tl(TCs)]}. on_tc_skip(Tc,{Type,Reason} = Res, State) when Type == tc_auto_skip -> do_tc_skip(Res, end_tc(Tc,[],Res,init_tc(State,[]))); +on_tc_skip(_Tc, _Res, State = #state{test_cases = []}) -> + State; on_tc_skip(_Tc, Res, State) -> do_tc_skip(Res, State). do_tc_skip(Res, State) -> TCs = State#state.test_cases, - TC = hd(State#state.test_cases), + TC = hd(TCs), NewTC = TC#testcase{ failure = {skipped,lists:flatten(io_lib:format("~p",[Res]))} }, |