From 7899e5e923bfb3c124f1c900cb57c4b4f0e59447 Mon Sep 17 00:00:00 2001 From: Peter Andersson Date: Sun, 15 Mar 2015 23:14:09 +0100 Subject: Modify the top section of the test case log file --- lib/test_server/src/test_server.erl | 13 ++------- lib/test_server/src/test_server_ctrl.erl | 46 +++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) (limited to 'lib/test_server') diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index f1592d9442..1011791899 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -446,15 +446,6 @@ run_test_case_apply({CaseNum,Mod,Func,Args,Name, }). run_test_case_apply(Mod, Func, Args, Name, RunInit, TimetrapData) -> - {ok,Cwd} = file:get_cwd(), - Args2Print = case Args of - [Args1] when is_list(Args1) -> - lists:keydelete(tc_group_result, 1, Args1); - _ -> - Args - end, - print(minor, "Test case started with:\n~w:~w(~tp)\n", [Mod,Func,Args2Print]), - print(minor, "Current directory is ~tp\n", [Cwd]), print_timestamp(minor,"Started at "), print(minor, "", [], internal_raw), TCCallback = get(test_server_testcase_callback), @@ -1400,8 +1391,8 @@ fw_error_notify(Mod, Func, Args, Error, Loc) -> %% Just like io:format, except that depending on the Detail value, the output %% is directed to console, major and/or minor log files. -print(Detail,Format,Args) -> - test_server_ctrl:print(Detail, Format, Args). +%% print(Detail,Format,Args) -> +%% test_server_ctrl:print(Detail, Format, Args). print(Detail,Format,Args,Printer) -> test_server_ctrl:print(Detail, Format, Args, Printer). diff --git a/lib/test_server/src/test_server_ctrl.erl b/lib/test_server/src/test_server_ctrl.erl index 488f38d05d..68b03a5987 100644 --- a/lib/test_server/src/test_server_ctrl.erl +++ b/lib/test_server/src/test_server_ctrl.erl @@ -1808,20 +1808,32 @@ start_minor_log_file1(Mod, Func, LogDir, AbsName, MFA) -> put(test_server_minor_footer, Footer), io:put_chars(Fd, Header), + io:put_chars(Fd, ""), + io:put_chars(Fd, "
\n"),
+
     SrcListing = downcase(atom_to_list(Mod)) ++ ?src_listing_ext,
+    
+    {Info,Arity} =
+	if Func == init_per_suite; Func == end_per_suite ->
+		{"Config function: ", 1};
+	   Func == init_per_group; Func == end_per_group ->
+		{"Config function: ", 2};
+	   true ->
+		{"Test case: ", 1}
+	end,
+
     case {filelib:is_file(filename:join(LogDir, SrcListing)),
 	  lists:member(no_src, get(test_server_logopts))} of
 	{true,false} ->
-	    print(Lev, "source code for ~w:~w/1\n",
+	    print(Lev, Info ++ "~w:~w/~w "
+		  "(click for source code)\n",
 		  [uri_encode(SrcListing),
 		   uri_encode(atom_to_list(Func)++"-1",utf8),
-		   Mod,Func]);
+		   Mod,Func,Arity]);
 	_ ->
-	    ok
+	    print(Lev, Info ++ "~w:~w/~w\n", [Mod,Func,Arity])
     end,
 
-    io:put_chars(Fd, "
\n"),
-
     AbsName.
 
 stop_minor_log_file() ->
@@ -3076,13 +3088,11 @@ print_conf_time(ConfTime) ->
     print(major, "=group_time    ~.3fs", [ConfTime]),
     print(minor, "~n=== Total execution time of group: ~.3fs~n", [ConfTime]).
 
-print_props(_, []) ->
+print_props([]) ->
     ok;
-print_props(true, Props) ->
+print_props(Props) ->
     print(major, "=group_props   ~p", [Props]),
-    print(minor, "Group properties: ~p~n", [Props]);
-print_props(_, _) ->
-    ok.
+    print(minor, "Group properties: ~p~n", [Props]).
 
 %% repeat N times:                                  {repeat,N}
 %% repeat N times or until all successful:          {repeat_until_all_ok,N}
@@ -3687,7 +3697,6 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit,
 
     print(major, "=case          ~w:~w", [Mod, Func]),
     MinorName = start_minor_log_file(Mod, Func, self() /= Main),
-    print(minor, "", [], internal_raw),
     MinorBase = filename:basename(MinorName),
     print(major, "=logfile       ~ts", [filename:basename(MinorName)]),
 
@@ -3720,7 +3729,20 @@ run_test_case1(Ref, Num, Mod, Func, Args, RunInit,
 				   [tc_start,{{Mod,{Func,GrName}},
 					      MinorName}]),
 
-    print_props((RunInit==skip_init), get_props(Mode)),
+    {ok,Cwd} = file:get_cwd(),
+    Args2Print = if is_list(UpdatedArgs) ->
+			 lists:keydelete(tc_group_result, 1, UpdatedArgs);
+		     true ->
+			 UpdatedArgs
+		 end,
+    if RunInit == skip_init ->
+	    print_props(get_props(Mode));
+       true ->
+	    ok
+    end,
+    print(minor, "Config value:\n\n    ~tp\n", [Args2Print]),
+    print(minor, "Current directory is ~tp\n", [Cwd]),
+
     GrNameStr =	case GrName of
 		    undefined -> "";
 		    Name      -> cast_to_list(Name)
-- 
cgit v1.2.3