1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 2010-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20-module(cfg_error_12_SUITE). 21 22-compile(export_all). 23 24-include_lib("common_test/include/ct.hrl"). 25 26init_per_testcase(_, Config) -> 27 Config. 28 29end_per_testcase(tc2, _Config) -> 30 ct:sleep(2000), 31 exit(this_should_not_be_printed); 32end_per_testcase(tc4, _Config) -> 33 ct:sleep(2000), 34 exit(this_should_not_be_printed); 35end_per_testcase(_, _) -> 36 ok. 37 38all() -> 39 [tc1, tc2, tc3, tc4]. 40 41%%%----------------------------------------------------------------- 42tc1() -> 43 put('$test_server_framework_test', 44 fun(init_tc, _Default) -> 45 ct:pal("init_tc(~p): Night time...",[self()]), 46 ct:sleep(2000), 47 ct:pal("init_tc(~p): Day time!",[self()]), 48 exit(this_should_not_be_printed); 49 (_, Default) -> Default 50 end), 51 [{timetrap,500}]. 52 53tc1(_) -> 54 exit(this_should_not_be_printed). 55 56%%%----------------------------------------------------------------- 57tc2() -> 58 [{timetrap,500}]. 59 60tc2(_) -> 61 ok. 62 63%%%----------------------------------------------------------------- 64tc3() -> 65 [{timetrap,500}]. 66 67tc3(_) -> 68 put('$test_server_framework_test', 69 fun(end_tc, _Default) -> 70 ct:pal("end_tc(~p): Night time...",[self()]), 71 ct:sleep(1000), 72 ct:pal("end_tc(~p): Day time!",[self()]); 73 (_, Default) -> Default 74 end), 75 {comment,"should succeed since ct_fw cancels timetrap in end_tc"}. 76 77%%%----------------------------------------------------------------- 78tc4() -> 79 put('$test_server_framework_test', 80 fun(end_tc, _Default) -> 81 ct:pal("end_tc(~p): Night time...",[self()]), 82 ct:sleep(1000), 83 ct:pal("end_tc(~p): Day time!",[self()]); 84 (_, Default) -> Default 85 end), 86 [{timetrap,500}]. 87 88tc4(_) -> 89 ok. 90