Skip to content

Commit da4248c

Browse files
committed
test: cover sys:multi_suspend
1 parent bf4d8c2 commit da4248c

1 file changed

Lines changed: 28 additions & 3 deletions

File tree

lib/stdlib/test/sys_SUITE.erl

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
%% %CopyrightEnd%
2121
%%
2222
-module(sys_SUITE).
23-
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
23+
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
2424
init_per_group/2,end_per_group/2,log/1,log_to_file/1,
25-
stats/1,trace/1,suspend/1,install/1,special_process/1]).
25+
stats/1,trace/1,suspend/1,multi_suspend/1,
26+
install/1,special_process/1]).
2627
-export([handle_call/3,terminate/2,init/1]).
2728
-include_lib("common_test/include/ct.hrl").
2829

@@ -35,7 +36,8 @@
3536
suite() -> [{ct_hooks,[ts_install_cth]}].
3637

3738
all() ->
38-
[log, log_to_file, stats, trace, suspend, install, special_process].
39+
[log, log_to_file, stats, trace, suspend, multi_suspend,
40+
install, special_process].
3941

4042
groups() ->
4143
[].
@@ -124,6 +126,29 @@ suspend(Config) when is_list(Config) ->
124126
stop(),
125127
ok.
126128

129+
multi_suspend(Config) when is_list(Config) ->
130+
S1 = sys_SUITE_server1,
131+
S2 = sys_SUITE_server2,
132+
{ok,_} = gen_server:start_link({local,S1},?MODULE,[],[]),
133+
{ok,_} = gen_server:start_link({local,S2},?MODULE,[],[]),
134+
[{S1,ok},{S2,ok}] = sys:multi_suspend([S1,S2],1000),
135+
{'EXIT',_} = (catch gen_server:call(S1,{req,48},1000)),
136+
{'EXIT',_} = (catch gen_server:call(S2,{req,48},1000)),
137+
{status,_,_,[_,suspended,_,_,_]} = sys:get_status(S1),
138+
{status,_,_,[_,suspended,_,_,_]} = sys:get_status(S2),
139+
sys:resume(S1),
140+
sys:resume(S2),
141+
{status,_,_,[_,running,_,_,_]} = sys:get_status(S1),
142+
{status,_,_,[_,running,_,_,_]} = sys:get_status(S2),
143+
[] = sys:multi_suspend([],1000),
144+
[{S1,ok},{no_such_process,{error,noproc}}] =
145+
sys:multi_suspend([S1,no_such_process],1000),
146+
{status,_,_,[_,suspended,_,_,_]} = sys:get_status(S1),
147+
sys:resume(S1),
148+
gen_server:call(S1,stop,1000),
149+
gen_server:call(S2,stop,1000),
150+
ok.
151+
127152
install(Config) when is_list(Config) ->
128153
{ok,_Server} = start(),
129154
Master = self(),

0 commit comments

Comments
 (0)