diff options
Diffstat (limited to 'lib/test_server/src/test_server.erl')
-rw-r--r-- | lib/test_server/src/test_server.erl | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/lib/test_server/src/test_server.erl b/lib/test_server/src/test_server.erl index 37cd8fac99..43330d2c91 100644 --- a/lib/test_server/src/test_server.erl +++ b/lib/test_server/src/test_server.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2012. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -123,7 +123,7 @@ cover_compile({App,all,Include,Cross}) -> io:format("\nWARNING: All modules in \'~w\' are excluded\n" "Only cover compiling modules in include list " "and the modules\nin the cross cover file:\n" - "~p\n", [App,CompileMods]), + "~tp\n", [App,CompileMods]), do_cover_compile(CompileMods), io:fwrite("done\n\n",[]), {ok,Include} @@ -143,7 +143,7 @@ cover_compile({App,Exclude,Include,Cross}) -> [App,length(CompileMods)]), io:format("\nWARNING: Can't find lib_dir for \'~w\'\n" "Only cover compiling modules in include list: " - "~p\n", [App,Include]), + "~tp\n", [App,Include]), do_cover_compile(CompileMods), io:fwrite("done\n\n",[]), {ok,Include} @@ -186,7 +186,7 @@ do_cover_compile1([M|Rest]) -> {ok,_} -> ok; Error -> - io:fwrite("\nWARNING: Could not cover compile ~w: ~p\n", + io:fwrite("\nWARNING: Could not cover compile ~w: ~tp\n", [M,Error]) end, code:stick_mod(M), @@ -196,7 +196,7 @@ do_cover_compile1([M|Rest]) -> {module,_} -> do_cover_compile1([M|Rest]); Error -> - io:fwrite("\nWARNING: Could not load ~w: ~p\n",[M,Error]), + io:fwrite("\nWARNING: Could not load ~w: ~tp\n",[M,Error]), do_cover_compile1(Rest) end; {false,_} -> @@ -204,7 +204,7 @@ do_cover_compile1([M|Rest]) -> {ok,_} -> ok; Error -> - io:fwrite("\nWARNING: Could not cover compile ~w: ~p\n", + io:fwrite("\nWARNING: Could not cover compile ~w: ~tp\n", [M,Error]) end, do_cover_compile1(Rest) @@ -286,7 +286,7 @@ cover_analyse(Analyse,Modules,Stop) -> {ok,{M,{Cov,NotCov}}} -> {M,{Cov,NotCov,DetailsFun(M)}}; Err -> - io:fwrite("WARNING: Analysis failed for ~w. Reason: ~p\n", + io:fwrite("WARNING: Analysis failed for ~w. Reason: ~tp\n", [M,Err]), {M,Err} end @@ -436,8 +436,8 @@ run_test_case_apply(Mod, Func, Args, Name, RunInit, TimetrapData) -> _ -> Args end, - print(minor, "Test case started with:\n~s:~s(~p)\n", [Mod,Func,Args2Print]), - print(minor, "Current directory is ~p\n", [Cwd]), + 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), @@ -498,7 +498,7 @@ run_test_case_msgloop(#st{ref=Ref,pid=Pid,end_conf_pid=EndConfPid0}=St0) -> exit(Pid, kill), %% here's the only place we know Reason, so we save %% it as a comment, potentially replacing user data - Error = lists:flatten(io_lib:format("Aborted: ~p", + Error = lists:flatten(io_lib:format("Aborted: ~tp", [Reason])), Error1 = lists:flatten([string:strip(S,left) || S <- string:tokens(Error, @@ -742,8 +742,8 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) -> timer:sleep(1), group_leader() ! {printout,12, "WARNING! " - "~p:end_per_testcase(~p, ~p)" - " crashed!\n\tReason: ~p\n", + "~w:end_per_testcase(~w, ~tp)" + " crashed!\n\tReason: ~tp\n", [Mod,Func,Conf,Why]}; _ -> ok @@ -756,8 +756,8 @@ call_end_conf(Mod,Func,TCPid,TCExitReason,Loc,Conf,TVal) -> Starter ! {self(),{call_end_conf,Data,ok}}; {'EXIT',Pid,Reason} -> group_leader() ! {printout,12, - "WARNING! ~p:end_per_testcase(~p, ~p)" - " failed!\n\tReason: ~p\n", + "WARNING! ~w:end_per_testcase(~w, ~tp)" + " failed!\n\tReason: ~tp\n", [Mod,Func,Conf,Reason]}, Starter ! {self(),{call_end_conf,Data,{error,Reason}}}; {'EXIT',_OtherPid,Reason} -> @@ -802,7 +802,7 @@ spawn_fw_call(Mod,{end_per_testcase,Func},EndConf,Pid, {Result,E} end, group_leader() ! {printout,12, - "WARNING! ~p:end_per_testcase(~p, ~p)" + "WARNING! ~w:end_per_testcase(~w, ~tp)" " failed!\n\tReason: timetrap timeout" " after ~w ms!\n", [Mod,Func,EndConf,TVal]}, FailLoc = proplists:get_value(tc_fail_loc, EndConf), @@ -1180,7 +1180,7 @@ do_init_per_testcase(Mod, Args) -> Bad -> group_leader() ! {printout,12, "ERROR! init_per_testcase has returned " - "bad elements in Config: ~p\n",[Bad]}, + "bad elements in Config: ~tp\n",[Bad]}, {skip,{failed,{Mod,init_per_testcase,bad_return}}} end; {fail,_Reason}=Res -> @@ -1197,7 +1197,7 @@ do_init_per_testcase(Mod, Args) -> FormattedLoc = test_server_sup:format_loc(Line), group_leader() ! {printout,12, "ERROR! init_per_testcase thrown!\n" - "\tLocation: ~s\n\tReason: ~p\n", + "\tLocation: ~ts\n\tReason: ~tp\n", [FormattedLoc, Other]}, {skip,{failed,{Mod,init_per_testcase,Other}}}; _:Reason0 -> @@ -1208,7 +1208,7 @@ do_init_per_testcase(Mod, Args) -> FormattedLoc = test_server_sup:format_loc(Line), group_leader() ! {printout,12, "ERROR! init_per_testcase crashed!\n" - "\tLocation: ~s\n\tReason: ~p\n", + "\tLocation: ~ts\n\tReason: ~tp\n", [FormattedLoc,Reason]}, {skip,{failed,{Mod,init_per_testcase,Reason}}} end. @@ -1244,13 +1244,13 @@ do_end_per_testcase(Mod,EndFunc,Func,Conf) -> "<br />") end, set_loc(erlang:get_stacktrace()), - comment(io_lib:format("~s<font color=\"red\">" + comment(io_lib:format("~ts<font color=\"red\">" "WARNING: ~w thrown!" "</font>\n",[Comment0,EndFunc])), group_leader() ! {printout,12, "WARNING: ~w thrown!\n" - "Reason: ~p\n" - "Line: ~s\n", + "Reason: ~tp\n" + "Line: ~ts\n", [EndFunc, Other, test_server_sup:format_loc(get_loc())]}, {failed,{Mod,end_per_testcase,Other}}; @@ -1266,13 +1266,13 @@ do_end_per_testcase(Mod,EndFunc,Func,Conf) -> Cmt -> Cmt ++ test_server_ctrl:xhtml("<br>", "<br />") end, - comment(io_lib:format("~s<font color=\"red\">" + comment(io_lib:format("~ts<font color=\"red\">" "WARNING: ~w crashed!" "</font>\n",[Comment0,EndFunc])), group_leader() ! {printout,12, "WARNING: ~w crashed!\n" - "Reason: ~p\n" - "Line: ~s\n", + "Reason: ~tp\n" + "Line: ~ts\n", [EndFunc, Reason, test_server_sup:format_loc(get_loc())]}, {failed,{Mod,end_per_testcase,Why}} @@ -1351,7 +1351,7 @@ lookup_config(Key,Config) -> {value,{Key,Val}} -> Val; _ -> - io:format("Could not find element ~p in Config.~n",[Key]), + io:format("Could not find element ~tp in Config.~n",[Key]), undefined end. @@ -1433,7 +1433,7 @@ format(Detail, Format, Args) -> Str = case catch io_lib:format(Format,Args) of {'EXIT',_} -> - io_lib:format("illegal format; ~p with args ~p.\n", + io_lib:format("illegal format; ~tp with args ~tp.\n", [Format,Args]); Valid -> Valid end, @@ -1564,7 +1564,7 @@ fail(Reason) -> cast_to_list(X) when is_list(X) -> X; cast_to_list(X) when is_atom(X) -> atom_to_list(X); -cast_to_list(X) -> lists:flatten(io_lib:format("~p", [X])). +cast_to_list(X) -> lists:flatten(io_lib:format("~tp", [X])). @@ -1608,10 +1608,10 @@ break(CBM, TestCase, Comment) -> end, io:format(user, "\n\n\n--- SEMIAUTOMATIC TESTING ---" - "\nThe test case~s executes on process ~w" - "\n\n\n~s" + "\nThe test case~ts executes on process ~w" + "\n\n\n~ts" "\n\n\n-----------------------------\n\n" - "Continue with --> ~w:continue(~s).\n", + "Continue with --> ~w:continue(~ts).\n", [TCName,self(),Comment,CBM,CntArg]), case whereis(PName) of undefined -> @@ -1735,7 +1735,7 @@ ensure_timetrap(Config) -> Garbage -> erase(test_server_default_timetrap), format("=== WARNING: garbage in " - "test_server_default_timetrap: ~p~n", + "test_server_default_timetrap: ~tp~n", [Garbage]) end, DTmo = case lists:keysearch(default_timeout,1,Config) of @@ -1743,7 +1743,7 @@ ensure_timetrap(Config) -> _ -> ?DEFAULT_TIMETRAP_SECS end, format("=== test_server setting default " - "timetrap of ~p seconds~n", + "timetrap of ~tp seconds~n", [DTmo]), put(test_server_default_timetrap, timetrap(seconds(DTmo))) end. @@ -1764,7 +1764,7 @@ cancel_default_timetrap(true) -> Garbage -> erase(test_server_default_timetrap), format("=== WARNING: garbage in " - "test_server_default_timetrap: ~p~n", + "test_server_default_timetrap: ~tp~n", [Garbage]), error end. @@ -1773,7 +1773,7 @@ time_ms({hours,N}, _, _) -> hours(N); time_ms({minutes,N}, _, _) -> minutes(N); time_ms({seconds,N}, _, _) -> seconds(N); time_ms({Other,_N}, _, _) -> - format("=== ERROR: Invalid time specification: ~p. " + format("=== ERROR: Invalid time specification: ~tp. " "Should be seconds, minutes, or hours.~n", [Other]), exit({invalid_time_format,Other}); time_ms(Ms, _, _) when is_integer(Ms) -> Ms; @@ -2266,14 +2266,14 @@ stop_node(Slave) -> slave:stop(Slave), receive {nodedown, Slave} -> - format(minor, "Stopped slave node: ~p", [Slave]), - format(major, "=node_stop ~p", [Slave]), + format(minor, "Stopped slave node: ~w", [Slave]), + format(major, "=node_stop ~w", [Slave]), if Cover -> do_cover_for_node(Slave,stop,false); true -> ok end, true after 30000 -> - format("=== WARNING: Node ~p does not seem to terminate.", + format("=== WARNING: Node ~w does not seem to terminate.", [Slave]), erlang:monitor_node(Slave, false), receive {nodedown, Slave} -> ok after 0 -> ok end, @@ -2283,7 +2283,7 @@ stop_node(Slave) -> %% Either, the node is already dead or it was started %% with the {cleanup,false} option, or it was started %% in some other way than test_server:start_node/3 - format("=== WARNING: Attempt to stop a nonexisting slavenode (~p)~n" + format("=== WARNING: Attempt to stop a nonexisting slavenode (~w)~n" "=== Trying to kill it anyway!!!", [Slave]), case net_adm:ping(Slave)of @@ -2292,14 +2292,14 @@ stop_node(Slave) -> slave:stop(Slave), receive {nodedown, Slave} -> - format(minor, "Stopped slave node: ~p", [Slave]), - format(major, "=node_stop ~p", [Slave]), + format(minor, "Stopped slave node: ~w", [Slave]), + format(major, "=node_stop ~w", [Slave]), if Cover -> do_cover_for_node(Slave,stop,false); true -> ok end, true after 30000 -> - format("=== WARNING: Node ~p does not seem to terminate.", + format("=== WARNING: Node ~w does not seem to terminate.", [Slave]), erlang:monitor_node(Slave, false), receive {nodedown, Slave} -> ok after 0 -> ok end, |