@@ -5532,6 +5532,49 @@ spawn_monitor_alias(Config) when is_list(Config) ->
55325532 spawn_monitor_alias_test (Peer3 , Node3 , spawn_request , normal ),
55335533 {ok , Peer4 , Node4 } = ? CT_PEER (),
55345534 spawn_monitor_alias_test (Peer4 , Node4 , spawn_request , make_ref ()),
5535+
5536+ % % Make sure we don't get a monitor alias if a spawn_request fails on noconnect...
5537+
5538+ {ok , Peer5 , Node5 } = ? CT_PEER (#{args => [" -kernel" , " connect_all" , " false" ]}),
5539+ {ok , Peer6 , Node6 } = ? CT_PEER (#{args => [" -kernel" , " connect_all" , " false" ]}),
5540+
5541+ ThisNode = node (),
5542+ ok = erpc :call (Node5 , net_kernel , allow , [[ThisNode ]]),
5543+ {ok , [ThisNode ]} = erpc :call (Node5 , net_kernel , allowed , []),
5544+ ok = erpc :call (Node6 , net_kernel , allow , [[ThisNode ]]),
5545+ {ok , [ThisNode ]} = erpc :call (Node6 , net_kernel , allowed , []),
5546+
5547+ wait_until (fun () ->
5548+ _ = erpc :call (Node5 , erlang , disconnect_node , [Node6 ]),
5549+ _ = erpc :call (Node6 , erlang , disconnect_node , [Node5 ]),
5550+ Res5 = erpc :call (Node5 , erlang , nodes , []),
5551+ Res6 = erpc :call (Node6 , erlang , nodes , []),
5552+ Res5 == [ThisNode ] andalso Res6 == [ThisNode ]
5553+ end ),
5554+
5555+ MonAliasFun =
5556+ fun (UnaliasOpt ) ->
5557+ fun () ->
5558+ erlang :yield (),
5559+ MAF = spawn_request (Node6 , fun () -> ok end ,
5560+ [{monitor , [{alias , UnaliasOpt }]}]),
5561+ MAF ! should_not_be_delivered_1 ,
5562+ [{spawn_reply , MAF , ResType , Result }] = recv_msgs (1 ),
5563+ error = ResType ,
5564+ noconnection = Result ,
5565+ MAF ! should_not_be_delivered_2 ,
5566+ self () ! should_be_delivered ,
5567+ [should_be_delivered ] = recv_msgs (1 ),
5568+ ok
5569+ end
5570+ end ,
5571+
5572+ ok = erpc :call (Node5 , MonAliasFun (explicit_unalias )),
5573+ ok = erpc :call (Node5 , MonAliasFun (reply_demonitor )),
5574+ ok = erpc :call (Node5 , MonAliasFun (demonitor )),
5575+
5576+ peer :stop (Peer5 ),
5577+ peer :stop (Peer6 ),
55355578 ok .
55365579
55375580spawn_monitor_alias_test (Peer , Node , SpawnType , ExitReason ) ->
@@ -5650,6 +5693,29 @@ spawn_monitor_alias_test(Peer, Node, SpawnType, ExitReason) ->
56505693 P5 ! {alias , MA5 },
56515694 [{MA5 ,1 },{'DOWN' , M_5 , _ , _ , ExitReason }] = recv_msgs (2 ),
56525695
5696+ if SpawnType == spawn_request ->
5697+ % % Make sure we don't get a monitor alias if a spawn_request fails on badopt...
5698+ MonAliasFun =
5699+ fun (UnaliasOpt ) ->
5700+ erlang :yield (),
5701+ MAF = spawn_request (Node , fun () -> ok end ,
5702+ [{monitor , [{alias , UnaliasOpt }]}, invalid_opt ]),
5703+ MAF ! should_not_be_delivered_1 ,
5704+ [{spawn_reply , MAF , ResType , Result }] = recv_msgs (1 ),
5705+ error = ResType ,
5706+ badopt = Result ,
5707+ MAF ! should_not_be_delivered_2 ,
5708+ self () ! should_be_delivered ,
5709+ [should_be_delivered ] = recv_msgs (1 ),
5710+ ok
5711+ end ,
5712+ MonAliasFun (explicit_unalias ),
5713+ MonAliasFun (reply_demonitor ),
5714+ MonAliasFun (demonitor );
5715+ true ->
5716+ ok
5717+ end ,
5718+
56535719 case Node == node () of
56545720 true ->
56555721 ok ;
0 commit comments