1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 1997-2016. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20-module(cleanup).
21
22-export([all/0,groups/0,init_per_group/2,end_per_group/2, cleanup/1]).
23
24-include_lib("common_test/include/ct.hrl").
25
26all() ->
27    [cleanup].
28
29groups() ->
30    [].
31
32init_per_group(_GroupName, Config) ->
33    Config.
34
35end_per_group(_GroupName, Config) ->
36    Config.
37
38
39cleanup(_) ->
40    Localhost = list_to_atom(net_adm:localhost()),
41    net_adm:world_list([Localhost]),
42    case nodes() of
43	[] ->
44	    ok;
45	Nodes when is_list(Nodes) ->
46	    Kill = fun(Node) -> spawn(Node, erlang, halt, []) end,
47	    lists:foreach(Kill, Nodes),
48	    ct:fail({nodes_left, Nodes})
49    end.
50