diff options
author | Siri Hansen <[email protected]> | 2017-02-16 15:38:05 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-02-20 12:40:08 +0100 |
commit | 6b7463094db2ec3c2c0e4f8784dcd64ef186c96b (patch) | |
tree | daac80c3c2155c7c98aa7edfa2d0762cff07d972 /lib/common_test/src/test_server.erl | |
parent | 2031e6ceb5588bbecd480f1fb9ca5026f189d7d2 (diff) | |
download | otp-6b7463094db2ec3c2c0e4f8784dcd64ef186c96b.tar.gz otp-6b7463094db2ec3c2c0e4f8784dcd64ef186c96b.tar.bz2 otp-6b7463094db2ec3c2c0e4f8784dcd64ef186c96b.zip |
[ct] Fix faulty hook callbacks for skipped tests
The following bugs are corrected:
* Tests that were skipped before calling pre_init_per_* got faulty
calls to the corresponding post_init_per_*. E.g. if a test was
skipped because suite/0 returned a 'require' statement that was not
fulfilled, then post_init_per_suite would be called, even though
pre_init_per_suite and init_per_suite were not called.
* Tests that were skipped before or in init_per_testcase got faulty
calls to pre_end_per_testcase and post_end_per_testcase
(end_per_testcase is not called in these situations).
Test are added to make sure that the expected callbacks, and only
those, are called when tests are skipped in different ways.
Conflicts:
lib/common_test/test/ct_hooks_SUITE.erl
Diffstat (limited to 'lib/common_test/src/test_server.erl')
-rw-r--r-- | lib/common_test/src/test_server.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/common_test/src/test_server.erl b/lib/common_test/src/test_server.erl index 0787a323f3..be49191f2e 100644 --- a/lib/common_test/src/test_server.erl +++ b/lib/common_test/src/test_server.erl @@ -778,9 +778,9 @@ spawn_fw_call(Mod,IPTC={init_per_testcase,Func},CurrConf,Pid, %% if init_per_testcase fails, the test case %% should be skipped try begin do_end_tc_call(Mod,IPTC, {Pid,Skip,[CurrConf]}, Why), - do_init_tc_call(Mod,{end_per_testcase,Func}, + do_init_tc_call(Mod,{end_per_testcase_not_run,Func}, [CurrConf],{ok,[CurrConf]}), - do_end_tc_call(Mod,{end_per_testcase,Func}, + do_end_tc_call(Mod,{end_per_testcase_not_run,Func}, {Pid,Skip,[CurrConf]}, Why) end of _ -> ok catch @@ -1151,14 +1151,14 @@ do_end_tc_call(Mod, IPTC={init_per_testcase,Func}, Res, Return) -> Args end, EPTCInitRes = - case do_init_tc_call(Mod,{end_per_testcase,Func}, + case do_init_tc_call(Mod,{end_per_testcase_not_run,Func}, IPTCEndRes,Return) of {ok,EPTCInitConfig} when is_list(EPTCInitConfig) -> {Return,EPTCInitConfig}; _ -> {Return,IPTCEndRes} end, - do_end_tc_call1(Mod, {end_per_testcase,Func}, + do_end_tc_call1(Mod, {end_per_testcase_not_run,Func}, EPTCInitRes, Return); _Ok -> do_end_tc_call1(Mod, IPTC, Res, Return) |