aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/test
diff options
context:
space:
mode:
authorPouriya <[email protected]>2018-04-26 13:49:59 +0000
committerSiri Hansen <[email protected]>2018-04-26 15:49:59 +0200
commiteefcc985530acbd5cc4c97b6e4f537492fd61622 (patch)
treecf16fd914ab7f2ef6de00c2b8e6f0a7d5d4593ce /lib/stdlib/test
parentf24a15640beef8acd832e4a3eaf20bbd3c16e38d (diff)
downloadotp-eefcc985530acbd5cc4c97b6e4f537492fd61622.tar.gz
otp-eefcc985530acbd5cc4c97b6e4f537492fd61622.tar.bz2
otp-eefcc985530acbd5cc4c97b6e4f537492fd61622.zip
[stdlib/sys]: install one debug function more times (#1781)
Allow installing multiple instances of sys debug function This commit solves a bug which allowed installing {Fun,State} as sys debug function even if Fun was already installed. This happened in the case when the current State of the debug fun was undefined. Also, the new format {Id,Fun,State} of debug functions can be installed, allowing multiple instances of the same fun.
Diffstat (limited to 'lib/stdlib/test')
-rw-r--r--lib/stdlib/test/sys_SUITE.erl24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/stdlib/test/sys_SUITE.erl b/lib/stdlib/test/sys_SUITE.erl
index a28eca513f..439a23d82d 100644
--- a/lib/stdlib/test/sys_SUITE.erl
+++ b/lib/stdlib/test/sys_SUITE.erl
@@ -133,7 +133,8 @@ install(Config) when is_list(Config) ->
Master ! {spy_got,{request,Arg},ProcState};
Other ->
io:format("Trigged other=~p\n",[Other])
- end
+ end,
+ func_state
end,
sys:install(?server,{SpyFun,func_state}),
{ok,-1} = (catch public_call(1)),
@@ -142,10 +143,27 @@ install(Config) when is_list(Config) ->
sys:install(?server,{SpyFun,func_state}),
sys:install(?server,{SpyFun,func_state}),
{ok,-3} = (catch public_call(3)),
- sys:remove(?server,SpyFun),
{ok,-4} = (catch public_call(4)),
+ sys:remove(?server,SpyFun),
+ {ok,-5} = (catch public_call(5)),
+ [{spy_got,{request,1},sys_SUITE_server},
+ {spy_got,{request,3},sys_SUITE_server},
+ {spy_got,{request,4},sys_SUITE_server}] = get_messages(),
+
+ sys:install(?server,{id1, SpyFun, func_state}),
+ sys:install(?server,{id1, SpyFun, func_state}), %% should not be installed
+ sys:install(?server,{id2, SpyFun, func_state}),
+ {ok,-1} = (catch public_call(1)),
+ %% We have two SpyFun installed:
[{spy_got,{request,1},sys_SUITE_server},
- {spy_got,{request,3},sys_SUITE_server}] = get_messages(),
+ {spy_got,{request,1},sys_SUITE_server}] = get_messages(),
+ sys:remove(?server, id1),
+ {ok,-1} = (catch public_call(1)),
+ %% We have one SpyFun installed:
+ [{spy_got,{request,1},sys_SUITE_server}] = get_messages(),
+ sys:no_debug(?server),
+ {ok,-1} = (catch public_call(1)),
+ [] = get_messages(),
stop(),
ok.