109109% %--------------------------------------------------------------------
110110
111111suite () ->
112- [{ct_hooks ,[ts_install_cth ]},
112+ [{ct_hooks ,[ts_install_cth ,
113+ {cth_events ,
114+ [{verify_fun , fun verify_events /2 }]}]},
113115 {timetrap ,{seconds ,90 }}].
114116
115117all () ->
@@ -190,10 +192,9 @@ init_per_group(_, Config) ->
190192end_per_group (_ , Config ) ->
191193 Config .
192194% %--------------------------------------------------------------------
193- init_per_testcase (TestCase , Config0 )
195+ init_per_testcase (TestCase , Config )
194196 when TestCase == shell_no_unicode ;
195197 TestCase == shell_unicode_string ->
196- Config = ssh_test_lib :add_log_handler (TestCase , Config0 ),
197198 PrivDir = proplists :get_value (priv_dir , Config ),
198199 UserDir = proplists :get_value (priv_dir , Config ),
199200 SysDir = proplists :get_value (data_dir , Config ),
@@ -210,8 +211,7 @@ init_per_testcase(TestCase, Config0)
210211 ct :log (" file:native_name_encoding() = ~p ,~n io:getopts() = ~p " ,
211212 [file :native_name_encoding (),io :getopts ()]),
212213 wait_for_erlang_first_line ([{io ,IO }, {shell ,Shell }, {sftpd , Sftpd } | Config ]);
213- init_per_testcase (TestCase = inet6_option , Config0 ) ->
214- Config = ssh_test_lib :add_log_handler (TestCase , Config0 ),
214+ init_per_testcase (inet6_option , Config ) ->
215215 case ssh_test_lib :has_inet6_address () of
216216 true ->
217217 init_per_testcase ('__default__' , Config );
@@ -226,26 +226,13 @@ end_per_testcase(TestCase, Config)
226226 TestCase == shell_unicode_string ->
227227 case proplists :get_value (sftpd , Config ) of
228228 {Pid , _ , _ } ->
229- catch ssh :stop_daemon (Pid );
229+ catch ssh :stop_daemon (Pid ),
230+ ok ;
230231 _ ->
231232 ok
232- end ,
233- process_events (TestCase , Config );
234- end_per_testcase (TestCase , Config ) ->
235- process_events (TestCase , Config ).
236-
237- % % FIXME in parallel executions (p_basic group) this setup does not
238- % % work log handlers are uniq per testcase, but they all receive same
239- % % logger events; so if one testcase fails due to logger events, rest
240- % % of group might fail as well
241- process_events (TestCase , Config ) ->
242- {ok , Events } = ssh_test_lib :get_log_events (
243- proplists :get_value (log_handler_ref , Config )),
244- EventCnt = length (Events ),
245- {ok , InterestingEventCnt } = ssh_test_lib :analyze_events (Events , EventCnt ),
246- VerificationResult = verify_events (TestCase , InterestingEventCnt ),
247- ssh_test_lib :rm_log_handler (TestCase ),
248- VerificationResult .
233+ end ;
234+ end_per_testcase (_TestCase , _Config ) ->
235+ ok .
249236
250237verify_events (_TestCase , 0 ) ->
251238 ok ;
0 commit comments