aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2017-10-03 14:53:42 +0200
committerPeter Andersson <[email protected]>2017-10-25 17:28:55 +0200
commit70b6b32a9c7e3e3fca45fc3a0e11e2a5087a4660 (patch)
treeffce83db6a82e5aaa89f474732794c9a915d6157 /lib
parent7fb796ab3636af53a7ef659099c1fb9fe37c1957 (diff)
downloadotp-70b6b32a9c7e3e3fca45fc3a0e11e2a5087a4660.tar.gz
otp-70b6b32a9c7e3e3fca45fc3a0e11e2a5087a4660.tar.bz2
otp-70b6b32a9c7e3e3fca45fc3a0e11e2a5087a4660.zip
Add app name tag in process dictionary
Diffstat (limited to 'lib')
-rw-r--r--lib/common_test/src/ct_logs.erl4
-rw-r--r--lib/common_test/src/ct_master_logs.erl1
-rw-r--r--lib/common_test/src/ct_repeat.erl2
-rw-r--r--lib/common_test/src/ct_run.erl14
-rw-r--r--lib/common_test/src/ct_slave.erl1
-rw-r--r--lib/common_test/src/ct_util.erl1
-rw-r--r--lib/common_test/src/test_server_sup.erl1
-rw-r--r--lib/common_test/src/vts.erl2
8 files changed, 24 insertions, 2 deletions
diff --git a/lib/common_test/src/ct_logs.erl b/lib/common_test/src/ct_logs.erl
index ba7660fe6a..f7c118a4c7 100644
--- a/lib/common_test/src/ct_logs.erl
+++ b/lib/common_test/src/ct_logs.erl
@@ -665,6 +665,7 @@ log_timestamp({MS,S,US}) ->
tc_esc_chars}).
logger(Parent, Mode, Verbosity) ->
+ put(app, common_test),
register(?MODULE,self()),
%%! Below is a temporary workaround for the limitation of
%%! max one test run per second.
@@ -1004,6 +1005,7 @@ print_to_log(async, FromPid, Category, TCGL, Content, EscChars, State) ->
if FromPid /= TCGL ->
IoFun = create_io_fun(FromPid, CtLogFd, EscChars),
fun() ->
+ put(app, common_test),
test_server:permit_io(TCGL, self()),
%% Since asynchronous io gets can get buffered if
@@ -1035,6 +1037,7 @@ print_to_log(async, FromPid, Category, TCGL, Content, EscChars, State) ->
end;
true ->
fun() ->
+ put(app, common_test),
unexpected_io(FromPid, Category, ?MAX_IMPORTANCE,
Content, CtLogFd, EscChars)
end
@@ -3016,6 +3019,7 @@ simulate() ->
cast(stop),
S = self(),
Pid = spawn(fun() ->
+ put(app, common_test),
register(?MODULE,self()),
S ! {self(),started},
simulate_logger_loop()
diff --git a/lib/common_test/src/ct_master_logs.erl b/lib/common_test/src/ct_master_logs.erl
index d8ecd641ed..f5a19a46d7 100644
--- a/lib/common_test/src/ct_master_logs.erl
+++ b/lib/common_test/src/ct_master_logs.erl
@@ -87,6 +87,7 @@ stop() ->
%%%--------------------------------------------------------------------
init(Parent,LogDir,Nodes) ->
+ put(app, common_test),
register(?MODULE,self()),
Time = calendar:local_time(),
RunDir = make_dirname(Time),
diff --git a/lib/common_test/src/ct_repeat.erl b/lib/common_test/src/ct_repeat.erl
index c043c9846c..d878df9c66 100644
--- a/lib/common_test/src/ct_repeat.erl
+++ b/lib/common_test/src/ct_repeat.erl
@@ -70,6 +70,7 @@ loop_test(If,Args) when is_list(Args) ->
CtrlPid = self(),
spawn(
fun() ->
+ put(app, common_test),
stop_after(CtrlPid,Secs,ForceStop)
end)
end,
@@ -134,6 +135,7 @@ spawn_tester(script,Ctrl,Args) ->
spawn_tester(func,Ctrl,Opts) ->
Tester = fun() ->
+ put(app, common_test),
case catch ct_run:run_test2(Opts) of
{'EXIT',Reason} ->
exit(Reason);
diff --git a/lib/common_test/src/ct_run.erl b/lib/common_test/src/ct_run.erl
index 14f28f9ca3..7079e059f4 100644
--- a/lib/common_test/src/ct_run.erl
+++ b/lib/common_test/src/ct_run.erl
@@ -250,6 +250,8 @@ finish(Tracing, ExitStatus, Args) ->
end.
script_start1(Parent, Args) ->
+ %% tag this process
+ put(app, common_test),
%% read general start flags
Label = get_start_opt(label, fun([Lbl]) -> Lbl end, Args),
Profile = get_start_opt(profile, fun([Prof]) -> Prof end, Args),
@@ -956,7 +958,10 @@ run_test(StartOpts) when is_list(StartOpts) ->
-spec run_test1_fun(_) -> fun(() -> no_return()).
run_test1_fun(StartOpts) ->
- fun() -> run_test1(StartOpts) end.
+ fun() ->
+ put(app, common_test),
+ run_test1(StartOpts)
+ end.
run_test1(StartOpts) when is_list(StartOpts) ->
case proplists:get_value(refresh_logs, StartOpts) of
@@ -1447,7 +1452,10 @@ run_testspec(TestSpec) ->
-spec run_testspec1_fun(_) -> fun(() -> no_return()).
run_testspec1_fun(TestSpec) ->
- fun() -> run_testspec1(TestSpec) end.
+ fun() ->
+ put(app, common_test),
+ run_testspec1(TestSpec)
+ end.
run_testspec1(TestSpec) ->
{ok,Cwd} = file:get_cwd(),
@@ -1906,10 +1914,12 @@ possibly_spawn(true, Tests, Skip, Opts) ->
CTUtilSrv = whereis(ct_util_server),
Supervisor =
fun() ->
+ put(app, common_test),
process_flag(trap_exit, true),
link(CTUtilSrv),
TestRun =
fun() ->
+ put(app, common_test),
TestResult = (catch do_run_test(Tests, Skip, Opts)),
case TestResult of
{EType,_} = Error when EType == user_error;
diff --git a/lib/common_test/src/ct_slave.erl b/lib/common_test/src/ct_slave.erl
index 4188bd7c3b..e8459bc400 100644
--- a/lib/common_test/src/ct_slave.erl
+++ b/lib/common_test/src/ct_slave.erl
@@ -282,6 +282,7 @@ monitor_master(MasterNode) ->
% code of the masterdeath-waiter process
monitor_master_int(MasterNode) ->
+ put(app, common_test),
erlang:monitor_node(MasterNode, true),
receive
{nodedown, MasterNode}->
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index abf131f4df..0e0d6f84e1 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -124,6 +124,7 @@ start(Mode, LogDir, Verbosity) ->
end.
do_start(Parent, Mode, LogDir, Verbosity) ->
+ put(app, common_test),
process_flag(trap_exit,true),
register(ct_util_server,self()),
create_table(?conn_table,#conn.handle),
diff --git a/lib/common_test/src/test_server_sup.erl b/lib/common_test/src/test_server_sup.erl
index 21f4be22fe..756dd0b59b 100644
--- a/lib/common_test/src/test_server_sup.erl
+++ b/lib/common_test/src/test_server_sup.erl
@@ -849,6 +849,7 @@ util_start() ->
case whereis(?MODULE) of
undefined ->
spawn_link(fun() ->
+ put(app, common_test),
register(?MODULE, self()),
util_loop(#util_state{starter=Starter})
end),
diff --git a/lib/common_test/src/vts.erl b/lib/common_test/src/vts.erl
index 99a109cfe8..e1482d9014 100644
--- a/lib/common_test/src/vts.erl
+++ b/lib/common_test/src/vts.erl
@@ -155,6 +155,7 @@ test_info(_VtsPid,Type,Data) ->
call({test_info,Type,Data}).
init(Parent) ->
+ put(app, common_test),
register(?MODULE,self()),
process_flag(trap_exit,true),
Parent ! {self(),started},
@@ -284,6 +285,7 @@ run_test1(State=#state{tests=Tests,current_log_dir=LogDir,
logopts=LogOpts}) ->
Self=self(),
RunTest = fun() ->
+ put(app, common_test),
case ct_run:do_run(Tests,[],LogDir,LogOpts) of
{error,_Reason} ->
aborted();