From cd0f2a81ebdd3b510821eef69ff3eafed8c41fb8 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Mon, 16 Feb 2015 23:54:17 +0100 Subject: Make it possible to print in the test case log from on_tc_* hook funcs OTP-12468 --- lib/common_test/src/ct_framework.erl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/common_test/src/ct_framework.erl') diff --git a/lib/common_test/src/ct_framework.erl b/lib/common_test/src/ct_framework.erl index e8ea7992b4..ec525784ec 100644 --- a/lib/common_test/src/ct_framework.erl +++ b/lib/common_test/src/ct_framework.erl @@ -1268,6 +1268,11 @@ report(What,Data) -> Data1 = if GrName == undefined -> {Suite,Func,Result}; true -> Data end, + %% Register the group leader for the process calling the report + %% function, making it possible for a hook function to print + %% in the test case log file + ReportingPid = self(), + ct_logs:register_groupleader(ReportingPid, group_leader()), case Result of {failed, _} -> ct_hooks:on_tc_fail(What, Data1); @@ -1282,6 +1287,7 @@ report(What,Data) -> _Else -> ok end, + ct_logs:unregister_groupleader(ReportingPid), case {Func,Result} of {init_per_suite,_} -> ok; -- cgit v1.2.3