diff options
Diffstat (limited to 'lib/kernel/test/application_SUITE.erl')
-rw-r--r-- | lib/kernel/test/application_SUITE.erl | 1661 |
1 files changed, 899 insertions, 762 deletions
diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl index f469a0af98..9ec8a15861 100644 --- a/lib/kernel/test/application_SUITE.erl +++ b/lib/kernel/test/application_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1996-2011. All Rights Reserved. +%% Copyright Ericsson AB 1996-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -21,18 +21,21 @@ -include_lib("test_server/include/test_server.hrl"). -export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1, - init_per_group/2,end_per_group/2, - failover/1, failover_comp/1, permissions/1, load/1, + init_per_group/2,end_per_group/2 + ]). + +-export([failover/1, failover_comp/1, permissions/1, load/1, load_use_cache/1, otp_1586/1, otp_2078/1, otp_2012/1, otp_2718/1, otp_2973/1, otp_3002/1, otp_3184/1, otp_4066/1, otp_4227/1, otp_5363/1, otp_5606/1, - start_phases/1, get_key/1, + start_phases/1, get_key/1, get_env/1, permit_false_start_local/1, permit_false_start_dist/1, script_start/1, nodedown_start/1, init2973/0, loop2973/0, loop5606/1]). -export([config_change/1, distr_changed_tc1/1, distr_changed_tc2/1, + ensure_started/1, ensure_all_started/1, shutdown_func/1, do_shutdown/1, shutdown_timeout/1]). -define(TESTCASE, testcase_name). @@ -47,9 +50,9 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [failover, failover_comp, permissions, load, - load_use_cache, {group, reported_bugs}, start_phases, + load_use_cache, ensure_started, {group, reported_bugs}, start_phases, script_start, nodedown_start, permit_false_start_local, - permit_false_start_dist, get_key, + permit_false_start_dist, get_key, get_env, ensure_all_started, {group, distr_changed}, config_change, shutdown_func, shutdown_timeout]. groups() -> @@ -76,10 +79,10 @@ end_per_group(_GroupName, Config) -> init_per_testcase(otp_2973=Case, Config) -> code:add_path(?config(data_dir,Config)), - ?line Dog = test_server:timetrap(?default_timeout), + Dog = test_server:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog}|Config]; init_per_testcase(Case, Config) -> - ?line Dog = test_server:timetrap(?default_timeout), + Dog = test_server:timetrap(?default_timeout), [{?TESTCASE, Case}, {watchdog, Dog}|Config]. end_per_testcase(otp_2973, Config) -> @@ -121,92 +124,92 @@ failover(doc) -> failover(Conf) when is_list(Conf) -> %% start a help process to check the start type StPid = spawn_link(?MODULE, start_type, []), - ?line yes = global:register_name(st_type, StPid), + yes = global:register_name(st_type, StPid), NodeNames = [Ncp1, Ncp2, Ncp3] = node_names([cp1, cp2, cp3], Conf), NoSyncTime = config_fun_fast(config_fo(NodeNames)), WithSyncTime = config_fun(config_fo(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), % Start app1 and make sure cp1 starts it - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + ok = get_start_type(#st{normal = 3}), % Stop cp1 and make sure cp2 starts app1 stop_node_nice(Cp1), - ?line ?UNTIL(is_started(app1, Cp2)), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app1, Cp2)), + ok = get_start_type(#st{normal = 3}), % Restart cp1 and make sure it restarts app1 - ?line {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp1_2, application, load, [app1()]), - ?line ok = rpc:call(Cp1_2, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line ?UNTIL(not is_started(app1, Cp2)), - ?line ok = get_start_type(#st{takeover = 3}), + {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp1_2, application, load, [app1()]), + ok = rpc:call(Cp1_2, application, start, [app1, permanent]), + ?UNTIL(is_started(app1, Cp1)), + ?UNTIL(not is_started(app1, Cp2)), + ok = get_start_type(#st{takeover = 3}), % Test [{cp1, cp2}, cp3] % Start app_sp and make sure cp2 starts it (cp1 has more apps started) - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1_2, Cp2, Cp3], application, load, [app_sp()]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1_2, Cp2, Cp3], application, start,[app_sp,permanent]), - ?line ?UNTIL(is_started(app_sp, Cp2)), - ?line false = is_started(app_sp, Cp1), - ?line false = is_started(app_sp, Cp3), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app_sp, Cp2)), + false = is_started(app_sp, Cp1), + false = is_started(app_sp, Cp3), + ok = get_start_type(#st{normal = 3}), % Stop cp2 and make sure cp1 starts app_sp stop_node_nice(Cp2), - ?line ?UNTIL(is_started(app_sp, Cp1_2)), - ?line ok = get_start_type(#st{failover = 3}), + ?UNTIL(is_started(app_sp, Cp1_2)), + ok = get_start_type(#st{failover = 3}), % Stop cp1 and make sure cp3 starts app_sp stop_node_nice(Cp1_2), - ?line ?UNTIL(is_started(app_sp, Cp3)), - ?line ok = get_start_type(#st{normal = 3, failover = 3}), + ?UNTIL(is_started(app_sp, Cp3)), + ok = get_start_type(#st{normal = 3, failover = 3}), % Restart cp2 and make sure it restarts app_sp - ?line {ok, Cp2_2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp2_2, application, load, [app_sp()]), - ?line ok = rpc:call(Cp2_2, application, start, [app_sp, permanent]), - ?line ?UNTIL(is_started(app_sp, Cp2_2)), - ?line ?UNTIL(not is_started(app_sp, Cp3)), - ?line ok = get_start_type(#st{takeover = 3}), + {ok, Cp2_2} = start_node_config(Ncp2, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp2_2, application, load, [app_sp()]), + ok = rpc:call(Cp2_2, application, start, [app_sp, permanent]), + ?UNTIL(is_started(app_sp, Cp2_2)), + ?UNTIL(not is_started(app_sp, Cp3)), + ok = get_start_type(#st{takeover = 3}), % Restart cp1 and make sure it doesn't restart app_sp - ?line {ok, Cp1_3} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp1_3, application, load, [app_sp()]), - ?line ok = rpc:call(Cp1_3, application, start, [app_sp, permanent]), + {ok, Cp1_3} = start_node_config(Ncp1, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp1_3, application, load, [app_sp()]), + ok = rpc:call(Cp1_3, application, start, [app_sp, permanent]), test_server:sleep(500), - ?line false = is_started(app_sp, Cp1_3), - ?line true = is_started(app_sp, Cp2_2), + false = is_started(app_sp, Cp1_3), + true = is_started(app_sp, Cp2_2), % Force takeover to cp1 - ?line ok = rpc:call(Cp1_3, application, takeover, [app_sp, permanent]), - ?line ?UNTIL(is_started(app_sp, Cp1_3)), - ?line ?UNTIL(not is_started(app_sp, Cp2_2)), - ?line ok = get_start_type(#st{takeover = 3}), + ok = rpc:call(Cp1_3, application, takeover, [app_sp, permanent]), + ?UNTIL(is_started(app_sp, Cp1_3)), + ?UNTIL(not is_started(app_sp, Cp2_2)), + ok = get_start_type(#st{takeover = 3}), %% Kill one child process and see that it is started with type local PP = global:whereis_name({ch,3}), exit(PP, kill), - ?line ok = get_start_type(#st{local = 1}), + ok = get_start_type(#st{local = 1}), global:send(st_type, kill), @@ -227,96 +230,96 @@ failover_comp(doc) -> failover_comp(Conf) when is_list(Conf) -> %% start a help process to check the start type StPid = spawn_link(?MODULE, start_type, []), - ?line yes = global:register_name(st_type, StPid), + yes = global:register_name(st_type, StPid), NodeNames = [Ncp1, Ncp2, Ncp3] = node_names([cp1, cp2, cp3], Conf), NoSyncTime = config_fun_fast(config(NodeNames)), WithSyncTime = config_fun(config(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), % Start app1 and make sure cp1 starts it - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + ok = get_start_type(#st{normal = 3}), % Stop cp1 and make sure cp2 starts app1 stop_node_nice(Cp1), - ?line ?UNTIL(is_started(app1, Cp2)), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app1, Cp2)), + ok = get_start_type(#st{normal = 3}), % Restart cp1 and make sure it restarts app1 - ?line {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp1_2, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cp1_2)), - ?line ok = rpc:call(Cp1_2, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1_2)), - ?line ?UNTIL(not is_started(app1, Cp2)), - ?line ok = get_start_type(#st{takeover = 3}), + {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp1_2, application, load, [app1()]), + ?UNTIL(is_loaded(app1, Cp1_2)), + ok = rpc:call(Cp1_2, application, start, [app1, permanent]), + ?UNTIL(is_started(app1, Cp1_2)), + ?UNTIL(not is_started(app1, Cp2)), + ok = get_start_type(#st{takeover = 3}), % Test [{cp1, cp2}, cp3] % Start app3 and make sure cp2 starts it (cp1 has more apps started) - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1_2, Cp2, Cp3], application, load, [app3()]), - ?line ?UNTIL(is_loaded(app3, [Cp1_2, Cp2, Cp3])), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app3, [Cp1_2, Cp2, Cp3])), + {[ok,ok,ok],[]} = rpc:multicall([Cp1_2, Cp2, Cp3], application, start,[app3,permanent]), - ?line ?UNTIL(is_started(app3, Cp2)), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp3), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app3, Cp2)), + false = is_started(app3, Cp1), + false = is_started(app3, Cp3), + ok = get_start_type(#st{normal = 3}), % Stop cp2 and make sure cp1 starts app3 stop_node_nice(Cp2), - ?line ?UNTIL(is_started(app3, Cp1_2)), - ?line ok = get_start_type(#st{normal = 3}), + ?UNTIL(is_started(app3, Cp1_2)), + ok = get_start_type(#st{normal = 3}), % Stop cp1 and make sure cp3 starts app3 stop_node_nice(Cp1_2), - ?line ?UNTIL(is_started(app3, Cp3)), - ?line ok = get_start_type(#st{normal = 6}), + ?UNTIL(is_started(app3, Cp3)), + ok = get_start_type(#st{normal = 6}), % Restart cp2 and make sure it restarts app3 - ?line {ok, Cp2_2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp2_2, application, load, [app3()]), - ?line ?UNTIL(is_loaded(app3, Cp2_2)), - ?line ok = rpc:call(Cp2_2, application, start, [app3, permanent]), - ?line ?UNTIL(is_started(app3, Cp2_2)), - ?line ?UNTIL(not is_started(app3, Cp3)), - ?line ok = get_start_type(#st{takeover = 3}), + {ok, Cp2_2} = start_node_config(Ncp2, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp2_2, application, load, [app3()]), + ?UNTIL(is_loaded(app3, Cp2_2)), + ok = rpc:call(Cp2_2, application, start, [app3, permanent]), + ?UNTIL(is_started(app3, Cp2_2)), + ?UNTIL(not is_started(app3, Cp3)), + ok = get_start_type(#st{takeover = 3}), % Restart cp1 and make sure it doesn't restart app3 - ?line {ok, Cp1_3} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp1_3, application, load, [app3()]), - ?line true = is_loaded(app3, Cp1_3), - ?line ok = rpc:call(Cp1_3, application, start, [app3, permanent]), + {ok, Cp1_3} = start_node_config(Ncp1, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp1_3, application, load, [app3()]), + true = is_loaded(app3, Cp1_3), + ok = rpc:call(Cp1_3, application, start, [app3, permanent]), test_server:sleep(5000), - ?line false = is_started(app3, Cp1_3), - ?line true = is_started(app3, Cp2_2), + false = is_started(app3, Cp1_3), + true = is_started(app3, Cp2_2), % Force takeover to cp1 - ?line ok = rpc:call(Cp1_3, application, takeover, [app3, permanent]), - ?line ?UNTIL(is_started(app3, Cp1_3)), - ?line ?UNTIL(not is_started(app3, Cp2_2)), - ?line ok = get_start_type(#st{takeover = 3}), + ok = rpc:call(Cp1_3, application, takeover, [app3, permanent]), + ?UNTIL(is_started(app3, Cp1_3)), + ?UNTIL(not is_started(app3, Cp2_2)), + ok = get_start_type(#st{takeover = 3}), %% Kill one child process and see that it is started with type local PP = global:whereis_name({ch,3}), exit(PP, kill), - ?line ok = get_start_type(#st{local = 1}), + ok = get_start_type(#st{local = 1}), global:send(st_type, kill), @@ -339,67 +342,67 @@ permissions(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config2(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), % Start app1 and make sure cp1 starts it - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), % Unpermit app1 on cp1, make sure cp2 starts it - ?line ok = rpc:call(Cp1, application, permit, [app1, false]), - ?line false = is_started(app1, Cp1), - ?line true = is_started(app1, Cp2), + ok = rpc:call(Cp1, application, permit, [app1, false]), + false = is_started(app1, Cp1), + true = is_started(app1, Cp2), % Unpermit app1 on cp2, make sure cp3 starts it - ?line ok = rpc:call(Cp2, application, permit, [app1, false]), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), - ?line true = is_started(app1, Cp3), + ok = rpc:call(Cp2, application, permit, [app1, false]), + false = is_started(app1, Cp1), + false = is_started(app1, Cp2), + true = is_started(app1, Cp3), % Permit cp2 again - ?line ok = rpc:call(Cp2, application, permit, [app1, true]), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp3), - ?line true = is_started(app1, Cp2), + ok = rpc:call(Cp2, application, permit, [app1, true]), + false = is_started(app1, Cp1), + false = is_started(app1, Cp3), + true = is_started(app1, Cp2), % Start app3, make sure noone starts it - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app3()]), - ?line ?UNTIL(is_loaded(app3, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app3, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app3, permanent]), test_server:sleep(1000), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + false = is_started(app3, Cp1), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), % Permit app3 on Cp3 - ?line ok = rpc:call(Cp3, application, permit, [app3, true]), - ?line true = is_started(app3, Cp3), + ok = rpc:call(Cp3, application, permit, [app3, true]), + true = is_started(app3, Cp3), % Permit app3 on Cp2, make sure it starts it - ?line ok = rpc:call(Cp2, application, permit, [app3, true]), - ?line true = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + ok = rpc:call(Cp2, application, permit, [app3, true]), + true = is_started(app3, Cp2), + false = is_started(app3, Cp3), % Permit app3 on Cp1, make sure it doesn't start it - ?line ok = rpc:call(Cp1, application, permit, [app3, true]), - ?line false = is_started(app3, Cp1), - ?line true = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + ok = rpc:call(Cp1, application, permit, [app3, true]), + false = is_started(app3, Cp1), + true = is_started(app3, Cp2), + false = is_started(app3, Cp3), % Stop Cp2, make sure Cp1 starts app3 stop_node_nice(Cp2), - ?line ?UNTIL(is_started(app3, Cp1)), + ?UNTIL(is_started(app3, Cp1)), stop_node_nice(Cp1), stop_node_nice(Cp3), @@ -418,25 +421,25 @@ load(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config3(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1(), d1(NodeNames)]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Load app1 with different specs and make sure we get an error - ?line {[{error,_},{error,_}],[]} = + {[{error,_},{error,_}],[]} = rpc:multicall([Cp1, Cp2], application, load, [app1(), d1(NodeNames)]), - ?line {error, _} = rpc:call(Cp3, application, load, [app1(), d2(NodeNames)]), + {error, _} = rpc:call(Cp3, application, load, [app1(), d2(NodeNames)]), stop_node_nice(Cp1), stop_node_nice(Cp2), @@ -455,24 +458,24 @@ load_use_cache(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config3(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_with_cache(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_with_cache(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_with_cache(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_with_cache(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_with_cache(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_with_cache(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1(), d1(NodeNames)]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), % Load app1 with different specs and make sure we get an error - ?line {[{error,_},{error,_}],[]} = + {[{error,_},{error,_}],[]} = rpc:multicall([Cp1, Cp2], application, load, [app1(), d1(NodeNames)]), - ?line {error, _} = rpc:call(Cp3, application, load, [app1(), d2(NodeNames)]), + {error, _} = rpc:call(Cp3, application, load, [app1(), d2(NodeNames)]), stop_node_nice(Cp1), stop_node_nice(Cp2), @@ -489,57 +492,57 @@ start_phases(doc) -> start_phases(Conf) when is_list(Conf) -> %% start a help process to check the start type SpPid = spawn_link(?MODULE, start_phase, []), - ?line yes = global:register_name(start_phase, SpPid), + yes = global:register_name(start_phase, SpPid), NodeNames = [Ncp1, _Ncp2, _Ncp3] = node_names([cp1, cp2, cp3], Conf), WithSyncTime = config_fun(config_sf(NodeNames)), - ?line {ok, Cp1} = start_node_config_sf(Ncp1, WithSyncTime, Conf), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_config_sf(Ncp1, WithSyncTime, Conf), + wait_for_ready_net(), %%============================= %%Example 1 in the user's guide %%============================= - ?line ok = rpc:call(Cp1, application, load, [myApp, + ok = rpc:call(Cp1, application, load, [myApp, d_any3(myApp, NodeNames)]), - ?line ?UNTIL(is_loaded(myApp, Cp1)), - ?line ok = rpc:call(Cp1, application, start, [myApp, permanent]), - ?line ?UNTIL(is_started(myApp, Cp1)), - ?line ok = get_start_phase({sp, 0, 1, 0, 0, 1}), - ?line ok = rpc:call(Cp1, application, stop, [myApp]), + ?UNTIL(is_loaded(myApp, Cp1)), + ok = rpc:call(Cp1, application, start, [myApp, permanent]), + ?UNTIL(is_started(myApp, Cp1)), + ok = get_start_phase({sp, 0, 1, 0, 0, 1}), + ok = rpc:call(Cp1, application, stop, [myApp]), %%============================= %%Example 2 in the user's guide %%============================= - ?line ok = rpc:call(Cp1, application, load, [topApp, + ok = rpc:call(Cp1, application, load, [topApp, d_any3(topApp, NodeNames)]), - ?line ?UNTIL(is_loaded(topApp, Cp1)), - ?line ok = rpc:call(Cp1, application, start, [topApp, permanent]), - ?line ?UNTIL(is_started(topApp, Cp1)), - ?line ok = get_start_phase({sp, 0, 1, 0, 0, 1}), - ?line ok = rpc:call(Cp1, application, stop, [topApp]), + ?UNTIL(is_loaded(topApp, Cp1)), + ok = rpc:call(Cp1, application, start, [topApp, permanent]), + ?UNTIL(is_started(topApp, Cp1)), + ok = get_start_phase({sp, 0, 1, 0, 0, 1}), + ok = rpc:call(Cp1, application, stop, [topApp]), %%============================= %%Example 3 in the user's guide %%============================= - ?line ok = rpc:call(Cp1, application, load, [topApp2, + ok = rpc:call(Cp1, application, load, [topApp2, d_any3(topApp2, NodeNames)]), - ?line ?UNTIL(is_loaded(topApp2, Cp1)), - ?line ok = rpc:call(Cp1, application, start, [topApp2, permanent]), - ?line ?UNTIL(is_started(topApp2, Cp1)), - ?line ok = get_start_phase({sp, 0, 2, 0, 0, 3}), - ?line ok = rpc:call(Cp1, application, stop, [topApp2]), + ?UNTIL(is_loaded(topApp2, Cp1)), + ok = rpc:call(Cp1, application, start, [topApp2, permanent]), + ?UNTIL(is_started(topApp2, Cp1)), + ok = get_start_phase({sp, 0, 2, 0, 0, 3}), + ok = rpc:call(Cp1, application, stop, [topApp2]), %%============================= %%Example 4 in the user's guide %%============================= - ?line ok = rpc:call(Cp1, application, load, [topApp3, + ok = rpc:call(Cp1, application, load, [topApp3, d_any3(topApp3, NodeNames)]), - ?line ?UNTIL(is_loaded(topApp3, Cp1)), - ?line ok = rpc:call(Cp1, application, start, [topApp3, permanent]), - ?line ?UNTIL(is_started(topApp3, Cp1)), - ?line ok = get_start_phase({sp, 1, 3, 3, 2, 4}), - ?line ok = rpc:call(Cp1, application, stop, [topApp3]), + ?UNTIL(is_loaded(topApp3, Cp1)), + ok = rpc:call(Cp1, application, start, [topApp3, permanent]), + ?UNTIL(is_started(topApp3, Cp1)), + ok = get_start_phase({sp, 1, 3, 3, 2, 4}), + ok = rpc:call(Cp1, application, stop, [topApp3]), global:send(start_phase, kill), @@ -554,101 +557,101 @@ script_start(suite) -> []; script_start(Conf) when is_list(Conf) -> %% start a help process to check the start type StPid = spawn_link(?MODULE, start_type, []), - ?line yes = global:register_name(st_type, StPid), + yes = global:register_name(st_type, StPid), % Create the .app files and the boot script - ?line ok = create_app(), - ?line {{KernelVer,StdlibVer}, _} = create_script("latest"), - ?line case is_real_system(KernelVer, StdlibVer) of + ok = create_app(), + {{KernelVer,StdlibVer}, _} = create_script("latest"), + case is_real_system(KernelVer, StdlibVer) of true -> Options = []; false -> Options = [local] end, - ?line ok = systools:make_script("latest", Options), + ok = systools:make_script("latest", Options), NodeNames = [Ncp1, Ncp2, Ncp3] = node_names([cp1, cp2, cp3], Conf), NoSyncTime = config_fun_fast(config_fo(NodeNames)), WithSyncTime = config_fun(config_fo(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), - ?line {ok, Cp2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, latest), - ?line {ok, Cp3} = start_node_boot_config(Ncp3, WithSyncTime, Conf, latest), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), + {ok, Cp2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, latest), + {ok, Cp3} = start_node_boot_config(Ncp3, WithSyncTime, Conf, latest), + wait_for_ready_net(), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line ?UNTIL(is_started(app2, Cp1)), - ?line ?UNTIL(is_started(app_sp, Cp1)), - ?line false = is_started(app1, Cp2), - ?line ok = get_start_type(#st{normal = 9}), + ?UNTIL(is_started(app1, Cp1)), + ?UNTIL(is_started(app2, Cp1)), + ?UNTIL(is_started(app_sp, Cp1)), + false = is_started(app1, Cp2), + ok = get_start_type(#st{normal = 9}), % Stop cp1 and make sure cp2 starts app1, app2 normally (no % start_phases defined) and app_sp as failover (start_phases % defined) stop_node_nice(Cp1), - ?line ?UNTIL(is_started(app1, Cp2)), - ?line ?UNTIL(is_started(app2, Cp2)), - ?line ?UNTIL(is_started(app_sp, Cp2)), - ?line ok = get_start_type(#st{normal = 6, failover = 3}), + ?UNTIL(is_started(app1, Cp2)), + ?UNTIL(is_started(app2, Cp2)), + ?UNTIL(is_started(app_sp, Cp2)), + ok = get_start_type(#st{normal = 6, failover = 3}), % Restart cp1, Cp1 takesover app1 and app2 - ?line {ok, Cp1_2} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), - ?line global:sync(), - ?line ?UNTIL(is_started(app1, Cp1_2)), - ?line false = is_started(app1, Cp2), - ?line ?UNTIL(is_started(app2, Cp1_2)), - ?line true = is_started(app_sp, Cp2), - ?line ?UNTIL(not is_started(app1, Cp2)), - ?line ?UNTIL(not is_started(app2, Cp2)), - ?line ok = get_start_type(#st{takeover = 6}), + {ok, Cp1_2} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), + global:sync(), + ?UNTIL(is_started(app1, Cp1_2)), + false = is_started(app1, Cp2), + ?UNTIL(is_started(app2, Cp1_2)), + true = is_started(app_sp, Cp2), + ?UNTIL(not is_started(app1, Cp2)), + ?UNTIL(not is_started(app2, Cp2)), + ok = get_start_type(#st{takeover = 6}), % Stop cp2 and make sure cp1 starts app_sp. - ?line false = is_started(app_sp, Cp1_2), + false = is_started(app_sp, Cp1_2), stop_node_nice(Cp2), - ?line ?UNTIL(is_started(app_sp, Cp1_2)), - ?line ok = get_start_type(#st{failover = 3}), + ?UNTIL(is_started(app_sp, Cp1_2)), + ok = get_start_type(#st{failover = 3}), % Stop cp1 and make sure cp3 starts app1, app2 and app_sp stop_node_nice(Cp1_2), - ?line ?UNTIL(is_started(app_sp, Cp3)), - ?line ?UNTIL(is_started(app1, Cp3)), - ?line ?UNTIL(is_started(app2, Cp3)), - ?line ok = get_start_type(#st{normal = 6, failover = 3}), + ?UNTIL(is_started(app_sp, Cp3)), + ?UNTIL(is_started(app1, Cp3)), + ?UNTIL(is_started(app2, Cp3)), + ok = get_start_type(#st{normal = 6, failover = 3}), % Restart cp2 and make sure it takesover app1, app2 and app_sp - ?line {ok, Cp2_2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, latest), - ?line global:sync(), - ?line ?UNTIL(is_started(app_sp, Cp2_2)), - ?line ?UNTIL(is_started(app1, Cp2_2)), - ?line ?UNTIL(is_started(app2, Cp2_2)), - ?line ?UNTIL(not is_started(app_sp, Cp3)), - ?line ?UNTIL(not is_started(app1, Cp3)), - ?line ?UNTIL(not is_started(app2, Cp3)), - ?line ok = get_start_type(#st{takeover = 9}), + {ok, Cp2_2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, latest), + global:sync(), + ?UNTIL(is_started(app_sp, Cp2_2)), + ?UNTIL(is_started(app1, Cp2_2)), + ?UNTIL(is_started(app2, Cp2_2)), + ?UNTIL(not is_started(app_sp, Cp3)), + ?UNTIL(not is_started(app1, Cp3)), + ?UNTIL(not is_started(app2, Cp3)), + ok = get_start_type(#st{takeover = 9}), % Restart cp1 and make sure it takesover app1, app2 - ?line {ok, Cp1_3} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), - ?line global:sync(), - ?line ?UNTIL(is_started(app1, Cp1_3)), - ?line ?UNTIL(is_started(app2, Cp1_3)), - ?line false = is_started(app_sp, Cp1_3), - ?line true = is_started(app_sp, Cp2_2), - ?line ?UNTIL(not is_started(app1, Cp2_2)), - ?line ?UNTIL(not is_started(app2, Cp2_2)), - ?line ok = get_start_type(#st{takeover = 6}), + {ok, Cp1_3} = start_node_boot_config(Ncp1, NoSyncTime, Conf, latest), + global:sync(), + ?UNTIL(is_started(app1, Cp1_3)), + ?UNTIL(is_started(app2, Cp1_3)), + false = is_started(app_sp, Cp1_3), + true = is_started(app_sp, Cp2_2), + ?UNTIL(not is_started(app1, Cp2_2)), + ?UNTIL(not is_started(app2, Cp2_2)), + ok = get_start_type(#st{takeover = 6}), % Force takeover to cp1 - ?line ok = rpc:call(Cp1_3, application, takeover, [app_sp, permanent]), - ?line ?UNTIL(is_started(app_sp, Cp1_3)), - ?line ?UNTIL(not is_started(app_sp, Cp2_2)), - ?line ok = get_start_type(#st{takeover = 3}), + ok = rpc:call(Cp1_3, application, takeover, [app_sp, permanent]), + ?UNTIL(is_started(app_sp, Cp1_3)), + ?UNTIL(not is_started(app_sp, Cp2_2)), + ok = get_start_type(#st{takeover = 3}), %% Kill one child process and see that it is started with type local PP = global:whereis_name({ch,3}), exit(PP, kill), - ?line ok = get_start_type(#st{local = 1}), + ok = get_start_type(#st{local = 1}), global:send(st_type, kill), @@ -656,9 +659,9 @@ script_start(Conf) when is_list(Conf) -> stop_node_nice(Cp2_2), stop_node_nice(Cp3), - ?line ok = file:delete("latest.boot"), - ?line ok = file:delete("latest.rel"), - ?line ok = file:delete("latest.script"), + ok = file:delete("latest.boot"), + ok = file:delete("latest.rel"), + ok = file:delete("latest.script"), ok. @@ -672,119 +675,119 @@ permit_false_start_local(Conf) when is_list(Conf) -> % Test [cp1, cp2, cp3] [Ncp1, Ncp2, Ncp3] = node_names([cp1, cp2, cp3], Conf), - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), - ?line {ok, Cp3} = start_node(Ncp3, Config), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp3} = start_node(Ncp3, Config), + wait_for_ready_net(), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, load, [app1()]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, start, [app1, permanent]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, load, [app2()]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, start, [app2, permanent]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, load, [app3()]), test_server:sleep(1000), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + false = is_started(app1, Cp1), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), %Permit a not started application - ?line ok = rpc:call(Cp1, application, permit, [app3, true]), + ok = rpc:call(Cp1, application, permit, [app3, true]), test_server:sleep(1000), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + false = is_started(app3, Cp1), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), %Permit a not loaded application - ?line {error,{not_loaded,app_notloaded}} = + {error,{not_loaded,app_notloaded}} = rpc:call(Cp1, application, permit, [app_notloaded, true]), test_server:sleep(1000), - ?line false = is_started(app_notloaded, Cp1), - ?line false = is_started(app_notloaded, Cp2), - ?line false = is_started(app_notloaded, Cp3), + false = is_started(app_notloaded, Cp1), + false = is_started(app_notloaded, Cp2), + false = is_started(app_notloaded, Cp3), %Unpermit a not started application - ?line ok = rpc:call(Cp1, application, permit, [app3, false]), + ok = rpc:call(Cp1, application, permit, [app3, false]), test_server:sleep(1000), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + false = is_started(app3, Cp1), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), %Unpermit a not loaded application - ?line {error,{not_loaded,app_notloaded}} = + {error,{not_loaded,app_notloaded}} = rpc:call(Cp1, application, permit, [app_notloaded, false]), test_server:sleep(1000), - ?line false = is_started(app_notloaded, Cp1), - ?line false = is_started(app_notloaded, Cp2), - ?line false = is_started(app_notloaded, Cp3), + false = is_started(app_notloaded, Cp1), + false = is_started(app_notloaded, Cp2), + false = is_started(app_notloaded, Cp3), % Permit app1 on CP1 and make sure it is started - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, true]), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Permit it again - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), + ok = rpc:call(Cp1, application, permit, [app1, true]), test_server:sleep(1000), - ?line true = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + true = is_started(app1, Cp1), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Permit app2 on CP1 and make sure it is started - ?line ok = rpc:call(Cp1, application, permit, [app2, true]), - ?line ?UNTIL(is_started(app2, Cp1)), - ?line false = is_started(app2, Cp2), - ?line false = is_started(app2, Cp3), + ok = rpc:call(Cp1, application, permit, [app2, true]), + ?UNTIL(is_started(app2, Cp1)), + false = is_started(app2, Cp2), + false = is_started(app2, Cp3), % Permit app1 on CP2 and make sure it is started - ?line ok = rpc:call(Cp2, application, permit, [app1, true]), - ?line ?UNTIL(is_started(app1, Cp2)), - ?line true = is_started(app1, Cp1), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp2, application, permit, [app1, true]), + ?UNTIL(is_started(app1, Cp2)), + true = is_started(app1, Cp1), + false = is_started(app1, Cp3), % Unpermit app1 on CP1 and make sure it is stopped - ?line ok = rpc:call(Cp1, application, permit, [app1, false]), - ?line ?UNTIL(false =:= is_started(app1, Cp1)), - ?line true = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, false]), + ?UNTIL(false =:= is_started(app1, Cp1)), + true = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Unpermit it agin - ?line ok = rpc:call(Cp1, application, permit, [app1, false]), + ok = rpc:call(Cp1, application, permit, [app1, false]), test_server:sleep(1000), - ?line false = is_started(app1, Cp1), - ?line true = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + false = is_started(app1, Cp1), + true = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Permit app1 on CP1 and make sure it is started - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line true = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, true]), + ?UNTIL(is_started(app1, Cp1)), + true = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Unpermit app1 on CP1 and make sure it is stopped - ?line ok = rpc:call(Cp1, application, permit, [app1, false]), - ?line ?UNTIL(false =:= is_started(app1, Cp1)), - ?line true = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, false]), + ?UNTIL(false =:= is_started(app1, Cp1)), + true = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Unpermit app1 on CP2 and make sure it is stopped - ?line ok = rpc:call(Cp2, application, permit, [app1, false]), + ok = rpc:call(Cp2, application, permit, [app1, false]), test_server:sleep(1000), - ?line ?UNTIL(false =:= is_started(app1, Cp2)), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp3), + ?UNTIL(false =:= is_started(app1, Cp2)), + false = is_started(app1, Cp1), + false = is_started(app1, Cp3), % Unpermit app2 on CP1 and make sure it is stopped - ?line ok = rpc:call(Cp1, application, permit, [app2, false]), - ?line ?UNTIL(false =:= is_started(app2, Cp2)), - ?line false = is_started(app2, Cp1), - ?line false = is_started(app2, Cp3), + ok = rpc:call(Cp1, application, permit, [app2, false]), + ?UNTIL(false =:= is_started(app2, Cp2)), + false = is_started(app2, Cp1), + false = is_started(app2, Cp3), stop_node_nice(Cp1), stop_node_nice(Cp2), @@ -802,125 +805,125 @@ permit_false_start_dist(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config_perm2(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), - ?line {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, NoSyncTime, Conf), + {ok, Cp3} = start_node_config(Ncp3, WithSyncTime, Conf), Cps = [Cp1, Cp2, Cp3], - ?line wait_for_ready_net(), + wait_for_ready_net(), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app1, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app1, permanent]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app2()]), test_server:sleep(1000), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + false = is_started(app1, Cp1), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), %Permit a not started application - ?line ok = rpc:call(Cp1, application, permit, [app2, true]), + ok = rpc:call(Cp1, application, permit, [app2, true]), test_server:sleep(1000), - ?line false = is_started(app2, Cp1), - ?line false = is_started(app2, Cp2), - ?line false = is_started(app2, Cp3), + false = is_started(app2, Cp1), + false = is_started(app2, Cp2), + false = is_started(app2, Cp3), %Permit a not loaded application - ?line {error,{not_loaded,app3}} = + {error,{not_loaded,app3}} = rpc:call(Cp1, application, permit, [app3, true]), test_server:sleep(1000), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + false = is_started(app3, Cp1), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), %Unpermit a not started application - ?line ok = rpc:call(Cp1, application, permit, [app2, false]), - ?line {[ok,ok,ok],[]} = + ok = rpc:call(Cp1, application, permit, [app2, false]), + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application, start, [app2, permanent]), test_server:sleep(1000), - ?line false = is_started(app2, Cp1), - ?line false = is_started(app2, Cp2), - ?line false = is_started(app2, Cp3), + false = is_started(app2, Cp1), + false = is_started(app2, Cp2), + false = is_started(app2, Cp3), %Unpermit a not loaded application - ?line {error,{not_loaded,app3}} = + {error,{not_loaded,app3}} = rpc:call(Cp1, application, permit, [app3, false]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, load, [app3()]), - ?line ?UNTIL(is_loaded(app3, Cps)), - ?line {[ok,ok,ok],[]} = + ?UNTIL(is_loaded(app3, Cps)), + {[ok,ok,ok],[]} = rpc:multicall(Cps, application, start, [app3, permanent]), test_server:sleep(1000), - ?line false = is_started(app3, Cp1), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + false = is_started(app3, Cp1), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), % Permit app1 on CP1 and make sure it is started - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, true]), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Permit it again - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + ok = rpc:call(Cp1, application, permit, [app1, true]), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Permit app2 on CP1 and make sure it is started - ?line ok = rpc:call(Cp1, application, permit, [app2, true]), - ?line ?UNTIL(is_started(app2, Cp1)), - ?line false = is_started(app2, Cp2), - ?line false = is_started(app2, Cp3), + ok = rpc:call(Cp1, application, permit, [app2, true]), + ?UNTIL(is_started(app2, Cp1)), + false = is_started(app2, Cp2), + false = is_started(app2, Cp3), % Permit app1 on CP2 and make sure it is not started - ?line ok = rpc:call(Cp2, application, permit, [app1, true]), + ok = rpc:call(Cp2, application, permit, [app1, true]), test_server:sleep(1000), - ?line true = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), - ?line false = is_started(app1, Cp3), + true = is_started(app1, Cp1), + false = is_started(app1, Cp2), + false = is_started(app1, Cp3), % Crash CP1 and make sure app1, but not app2, is started on CP2 stop_node_nice(Cp1), - ?line ?UNTIL(is_started(app1, Cp2)), - ?line false = is_started(app2, Cp2), + ?UNTIL(is_started(app1, Cp2)), + false = is_started(app2, Cp2), % Restart CP1 again, check nothing is running on it - ?line {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line global:sync(), - ?line ok = rpc:call(Cp1_2, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cp1_2)), - ?line ok = rpc:call(Cp1_2, application, start, [app1, permanent]), - ?line ok = rpc:call(Cp1_2, application, load, [app2()]), - ?line ?UNTIL(is_loaded(app2, Cp1_2)), - ?line ok = rpc:call(Cp1_2, application, start, [app2, permanent]), - ?line ok = rpc:call(Cp1_2, application, load, [app3()]), - ?line ?UNTIL(is_loaded(app3, Cp1_2)), - ?line ok = rpc:call(Cp1_2, application, start, [app3, permanent]), - ?line false = is_started(app1, Cp1_2), - ?line false = is_started(app2, Cp1_2), + {ok, Cp1_2} = start_node_config(Ncp1, NoSyncTime, Conf), + global:sync(), + ok = rpc:call(Cp1_2, application, load, [app1()]), + ?UNTIL(is_loaded(app1, Cp1_2)), + ok = rpc:call(Cp1_2, application, start, [app1, permanent]), + ok = rpc:call(Cp1_2, application, load, [app2()]), + ?UNTIL(is_loaded(app2, Cp1_2)), + ok = rpc:call(Cp1_2, application, start, [app2, permanent]), + ok = rpc:call(Cp1_2, application, load, [app3()]), + ?UNTIL(is_loaded(app3, Cp1_2)), + ok = rpc:call(Cp1_2, application, start, [app3, permanent]), + false = is_started(app1, Cp1_2), + false = is_started(app2, Cp1_2), % Permit app3 on CP3 and make sure it is started - ?line ok = rpc:call(Cp3, application, permit, [app3, true]), - ?line ?UNTIL(is_started(app3, Cp3)), - ?line false = is_started(app3, Cp1_2), - ?line false = is_started(app3, Cp2), + ok = rpc:call(Cp3, application, permit, [app3, true]), + ?UNTIL(is_started(app3, Cp3)), + false = is_started(app3, Cp1_2), + false = is_started(app3, Cp2), % Permit app3 on CP1 and make sure it is moved there from CP3 - ?line ok = rpc:call(Cp1_2, application, permit, [app3, true]), - ?line ?UNTIL(is_started(app3, Cp1_2)), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + ok = rpc:call(Cp1_2, application, permit, [app3, true]), + ?UNTIL(is_started(app3, Cp1_2)), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), % Unpermit app3 on CP3 and CP1 and make sure it is stopped - ?line ok = rpc:call(Cp3, application, permit, [app3, false]), - ?line ok = rpc:call(Cp1_2, application, permit, [app3, false]), - ?line ?UNTIL(false =:= is_started(app3, Cp1_2)), - ?line false = is_started(app3, Cp2), - ?line false = is_started(app3, Cp3), + ok = rpc:call(Cp3, application, permit, [app3, false]), + ok = rpc:call(Cp1_2, application, permit, [app3, false]), + ?UNTIL(false =:= is_started(app3, Cp1_2)), + false = is_started(app3, Cp2), + false = is_started(app3, Cp3), stop_node_nice(Cp1_2), stop_node_nice(Cp2), @@ -937,23 +940,124 @@ nodedown_start(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config4(NodeNames)), % Test [cp1, cp2] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), + wait_for_ready_net(), % Start app1 and make sure cp1 starts it - ?line {[ok,ok],[]} = + {[ok,ok],[]} = rpc:multicall([Cp1, Cp2], application, load, [app1()]), - ?line _ = rpc:cast(Cp2, application, start, [app1, permanent]), + _ = rpc:cast(Cp2, application, start, [app1, permanent]), test_server:sleep(1000), % Crash CP1 and make sure app1 is started on CP2 stop_node_nice(Cp1), - ?line ?UNTIL(is_started(app1, Cp2)), + ?UNTIL(is_started(app1, Cp2)), stop_node_nice(Cp2), ok. + +ensure_started(suite) -> []; +ensure_started(doc) -> ["Test application:ensure_started/1."]; +ensure_started(Conf) -> + + {ok, Fd} = file:open("app1.app", [write]), + w_app1(Fd), + file:close(Fd), + + ok = application:ensure_started(app1), + ok = application:ensure_started(app1), + {error, {already_started, app1}} = application:start(app1), + ok = application:stop(app1), + {error,{"no such file or directory", _ }} = application:ensure_started(hopefully_not_an_existing_app_file), + + ok = application:ensure_started(app1, permanent), + ok = application:ensure_started(app1, permanent), + ok = application:stop(app1), + ok = application:unload(app1), + ok. + +ensure_all_started(suite) -> []; +ensure_all_started(doc) -> ["Test application:ensure_all_started/1-2."]; +ensure_all_started(Conf) -> + + {ok, Fd1} = file:open("app1.app", [write]), + w_app1(Fd1), + file:close(Fd1), + {ok, Fd9} = file:open("app9.app", [write]), + w_app9(Fd9), + file:close(Fd9), + {ok, Fd10} = file:open("app10.app", [write]), + w_app10_dep9(Fd10), + file:close(Fd10), + {ok, FdErr} = file:open("app_chain_error.app", [write]), + w_app(FdErr, app_chain_error()), + file:close(FdErr), + {ok, FdErr2} = file:open("app_chain_error2.app", [write]), + w_app(FdErr2, app_chain_error2()), + file:close(FdErr2), + + %% Single app start/stop + false = lists:keyfind(app1, 1, application:which_applications()), + {ok, [app1]} = application:ensure_all_started(app1), % app1 started + {app1, _, _} = lists:keyfind(app1, 1, application:which_applications()), + {ok, []} = application:ensure_all_started(app1), % no start needed + ok = application:stop(app1), + false = lists:keyfind(app1, 1, application:which_applications()), + ok = application:unload(app1), + + %% App or dependency not found. + Name = hopefully_not_an_existing_app_file, + {error,{Name, {"no such file or directory", _ }}} = + application:ensure_all_started(Name), + + %% Start dependencies. + {error, {not_started, app9}} = application:start(app10), + {ok, [app9,app10]} = application:ensure_all_started(app10, temporary), + {app9, _, _} = lists:keyfind(app9, 1, application:which_applications()), + {app10, _, _} = lists:keyfind(app10, 1, application:which_applications()), + %% Only report apps/dependencies that actually needed to start + ok = application:stop(app10), + ok = application:unload(app10), + {ok, [app10]} = application:ensure_all_started(app10, temporary), + ok = application:stop(app9), + ok = application:unload(app9), + ok = application:stop(app10), + ok = application:unload(app10), + + %% Deeper failure chain. We have the following dependencies: + %% app_chain_error -> app_chain_error2 + %% app_chain_error2 -> app10 + %% app_chain_error2 -> hopefully_not_an_existing_app + %% app10 -> app 9 + %% First we have none running and we expect to have neither app9 + %% nor app10 running after failing to start + %% hopefully_not_an_existing_app + {error, {hopefully_not_an_existing_app, {"no such file or directory", _}}}= + application:ensure_all_started(app_chain_error), + false = lists:keyfind(app9, 1, application:which_applications()), + false = lists:keyfind(app10, 1, application:which_applications()), + false = lists:keyfind(app_chain_error2,1,application:which_applications()), + false = lists:keyfind(app_chain_error, 1, application:which_applications()), + %% Here we will have app9 already running, and app10 should be + %% able to boot fine. + %% In this dependency failing, we expect app9 to still be running, but + %% not app10 after failing to start hopefully_not_an_existing_app + {ok, [app9]} = application:ensure_all_started(app9, temporary), + {error, {hopefully_not_an_existing_app, {"no such file or directory", _}}}= + application:ensure_all_started(app_chain_error), + {app9, _, _} = lists:keyfind(app9, 1, application:which_applications()), + false = lists:keyfind(app10, 1, application:which_applications()), + false = lists:keyfind(app_chain_error2,1,application:which_applications()), + false = lists:keyfind(app_chain_error, 1, application:which_applications()), + ok = application:stop(app9), + ok = application:unload(app9), + ok = application:unload(app10), + ok = application:unload(app_chain_error2), + ok = application:unload(app_chain_error), + ok. + %%%----------------------------------------------------------------- %%% Testing of reported bugs and other tickets. %%%----------------------------------------------------------------- @@ -970,9 +1074,9 @@ otp_1586(Conf) when is_list(Conf) -> {ok, Fd} = file:open(filename:join(Dir, "app5.app"), [write]), w_app5(Fd), file:close(Fd), - ?line code:add_patha(Dir), - ?line ok = application:load(app4()), - ?line ok = application:unload(app4), + code:add_patha(Dir), + ok = application:load(app4()), + ok = application:unload(app4), ok. %%----------------------------------------------------------------- @@ -989,24 +1093,24 @@ otp_2078(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config4(NodeNames)), % Test [cp1, cp2] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), Cps = [Cp1, Cp2], - ?line wait_for_ready_net(), + wait_for_ready_net(), % Start app1 and make sure cp1 starts it - ?line {[ok,ok],[]} = + {[ok,ok],[]} = rpc:multicall(Cps, application, load, [app1()]), - ?line ?UNTIL(is_loaded(app1, Cps)), - ?line ok = rpc:call(Cp1, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), + ?UNTIL(is_loaded(app1, Cps)), + ok = rpc:call(Cp1, application, start, [app1, permanent]), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), % Start app1 on cp2; make sure it works (the bug was that this start % returned error) - ?line ok = rpc:call(Cp2, application, start, [app1, permanent]), - ?line true = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), + ok = rpc:call(Cp2, application, start, [app1, permanent]), + true = is_started(app1, Cp1), + false = is_started(app1, Cp2), stop_node_nice(Cp1), stop_node_nice(Cp2), @@ -1018,7 +1122,7 @@ otp_2012(doc) -> otp_2012(Conf) when is_list(Conf) -> %% start a help process to check the config change CcPid = spawn_link(?MODULE, conf_change, []), - ?line yes = global:register_name(conf_change, CcPid), + yes = global:register_name(conf_change, CcPid), % Write a .app file {ok, Fd} = file:open("app1.app", [write]), @@ -1029,19 +1133,19 @@ otp_2012(Conf) when is_list(Conf) -> file:close(Fd2), % Start app1 - ?line ok = application:load(app1()), - ?line ok = application:start(app1, permanent), + ok = application:load(app1()), + ok = application:start(app1, permanent), %% Read the current configuration parameters, and change them EnvBefore = application_controller:prep_config_change(), application_controller:test_change_apps([app1],[[{app1,[{new1, hi}, {new2, moi}]}]]), - ?line ok = application_controller:config_change(EnvBefore), - ?line ok = get_conf_change([{[], [{new1, hi}, {new2, moi}], []}]), + ok = application_controller:config_change(EnvBefore), + ok = get_conf_change([{[], [{new1, hi}, {new2, moi}], []}]), % Start app2 - ?line ok = application:load(app2()), - ?line ok = application:start(app2, permanent), + ok = application:load(app2()), + ok = application:start(app2, permanent), %% Read the current configuration parameters, and change them again EnvBefore2 = application_controller:prep_config_change(), @@ -1050,13 +1154,13 @@ otp_2012(Conf) when is_list(Conf) -> application_controller:test_change_apps([app2],[[{app2,[{new1, si}, {new2, no}]}]]), _EnvBefore22 = application_controller:prep_config_change(), - ?line ok = application_controller:config_change(EnvBefore2), + ok = application_controller:config_change(EnvBefore2), - ?line ok = get_conf_change([{[],[{new1,si},{new2,no}],[]}, + ok = get_conf_change([{[],[{new1,si},{new2,no}],[]}, {[{new1,hello}],[{new3,mors}],[new2]}]), - ?line ok = application:stop(app1), - ?line ok = application:stop(app2), + ok = application:stop(app1), + ok = application:stop(app2), ok. %%----------------------------------------------------------------- @@ -1067,24 +1171,24 @@ otp_2718(suite) -> []; otp_2718(doc) -> ["Test fail of transient app at start."]; otp_2718(Conf) when is_list(Conf) -> - ?line {ok, Cp1} = start_node_args(cp1, "-pa " ++ ?config(data_dir,Conf)), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_args(cp1, "-pa " ++ ?config(data_dir,Conf)), + wait_for_ready_net(), %% normal exit from the application - ?line ok = rpc:call(Cp1, application, load, [app_trans_normal()]), - ?line ?UNTIL(is_loaded(trans_normal, Cp1)), - ?line {error, {{'EXIT',normal},_}} = + ok = rpc:call(Cp1, application, load, [app_trans_normal()]), + ?UNTIL(is_loaded(trans_normal, Cp1)), + {error, {{'EXIT',normal},_}} = rpc:call(Cp1, application, start, [trans_normal, transient]), test_server:sleep(2000), - ?line false = is_started(trans_normal, Cp1), + false = is_started(trans_normal, Cp1), %% abnormal exit from the application - ?line ok = rpc:call(Cp1, application, load, [app_trans_abnormal()]), - ?line {error, {bad_return,{{trans_abnormal_sup,start,[normal,[]]}, + ok = rpc:call(Cp1, application, load, [app_trans_abnormal()]), + {error, {bad_return,{{trans_abnormal_sup,start,[normal,[]]}, {'EXIT',abnormal}}}} = rpc:call(Cp1, application, start, [trans_abnormal, transient]), test_server:sleep(3000), - ?line {badrpc,nodedown} = which_applications(Cp1), + {badrpc,nodedown} = which_applications(Cp1), ok. %%----------------------------------------------------------------- @@ -1100,65 +1204,65 @@ otp_2973(Conf) when is_list(Conf) -> w_app(Fd, app0()), file:close(Fd), - ?line Pid1 = spawn_link(?MODULE, init2973, []), - ?line Pid2 = spawn_link(?MODULE, init2973, []), + Pid1 = spawn_link(?MODULE, init2973, []), + Pid2 = spawn_link(?MODULE, init2973, []), - ?line Pid1 ! {start, self(), app0}, - ?line Pid2 ! {start, self(), app0}, + Pid1 ! {start, self(), app0}, + Pid2 ! {start, self(), app0}, - ?line {Res1, Res2} = receive + {Res1, Res2} = receive {Pid1, res, Res1x} -> receive {Pid2, res, Res2x} -> {Res1x, Res2x} after 2000 -> - ?line test_server:fail(timeout_pid2) + test_server:fail(timeout_pid2) end; {Pid2, res, Res2x} -> receive {Pid1, res, Res1x} -> {Res1x, Res2x} after 2000 -> - ?line test_server:fail(timeout_pid1) + test_server:fail(timeout_pid1) end end, %% Stop it. Inteferes with other global. - ?line ok = application:stop(app0), + ok = application:stop(app0), %% Test result. case {Res1, Res2} of {ok, ok} -> ok; _ -> - ?line Txt = io_lib:format("Illegal results from start: ~p ~p ", + Txt = io_lib:format("Illegal results from start: ~p ~p ", [Res1, Res2]), - ?line test_server:fail(lists:flatten(Txt)) + test_server:fail(lists:flatten(Txt)) end, % Write a .app file - ?line {ok, Fda} = file:open("app_start_error.app", [write]), - ?line w_app_start_error(Fda), - ?line file:close(Fda), + {ok, Fda} = file:open("app_start_error.app", [write]), + w_app_start_error(Fda), + file:close(Fda), - ?line Pid1 ! {start, self(), app_start_error}, - ?line Pid2 ! {start, self(), app_start_error}, + Pid1 ! {start, self(), app_start_error}, + Pid2 ! {start, self(), app_start_error}, - ?line {Res1a, Res2a} = receive + {Res1a, Res2a} = receive {Pid1, res, Res1y} -> receive {Pid2, res, Res2y} -> {Res1y, Res2y} after 2000 -> - ?line test_server:fail(timeout_pid2) + test_server:fail(timeout_pid2) end; {Pid2, res, Res2y} -> receive {Pid1, res, Res1y} -> {Res1y, Res2y} after 2000 -> - ?line test_server:fail(timeout_pid1) + test_server:fail(timeout_pid1) end end, @@ -1167,8 +1271,8 @@ otp_2973(Conf) when is_list(Conf) -> {error,{'start error',{app_start_error,start,[normal,[]]}}}} -> ok; _ -> - ?line Txta = io_lib:format("Illegal results from start ~p ~p ",[Res1a, Res2a]), - ?line test_server:fail(lists:flatten(Txta)) + Txta = io_lib:format("Illegal results from start ~p ~p ",[Res1a, Res2a]), + test_server:fail(lists:flatten(Txta)) end, ok. @@ -1190,34 +1294,34 @@ otp_3184(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config3184(NodeNames)), % Test [cp1, cp2] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), + wait_for_ready_net(), % Start app1 and make sure it is not started - ?line {[ok,ok],[]} = + {[ok,ok],[]} = rpc:multicall([Cp1, Cp2], application, load, [app1()]), test_server:sleep(3000), - ?line false = is_started(app1, Cp1), - ?line false = is_started(app1, Cp2), + false = is_started(app1, Cp1), + false = is_started(app1, Cp2), % Start app1 on cp1 - ?line ok = rpc:call(Cp1, application, permit, [app1, true]), - ?line ok = rpc:call(Cp1, application, start, [app1, permanent]), - ?line ok = rpc:call(Cp2, application, start, [app1, permanent]), - ?line ?UNTIL(is_started(app1, Cp1)), - ?line false = is_started(app1, Cp2), + ok = rpc:call(Cp1, application, permit, [app1, true]), + ok = rpc:call(Cp1, application, start, [app1, permanent]), + ok = rpc:call(Cp2, application, start, [app1, permanent]), + ?UNTIL(is_started(app1, Cp1)), + false = is_started(app1, Cp2), % Check that the application is marked as running in application_controller - ?line X = rpc:call(Cp1, application_controller, info, []), - ?line {value, {running, Xrunning}} = lists:keysearch(running, 1, X), - ?line {value, Xapp1} = lists:keysearch(app1, 1, Xrunning), - ?line {app1, _Xpid} = Xapp1, + X = rpc:call(Cp1, application_controller, info, []), + {value, {running, Xrunning}} = lists:keysearch(running, 1, X), + {value, Xapp1} = lists:keysearch(app1, 1, Xrunning), + {app1, _Xpid} = Xapp1, - ?line Y = rpc:call(Cp2, application_controller, info, []), - ?line {value, {running, Yrunning}} = lists:keysearch(running, 1, Y), - ?line {value, Yapp1} = lists:keysearch(app1, 1, Yrunning), - ?line {app1, {distributed, Cp1}} = Yapp1, + Y = rpc:call(Cp2, application_controller, info, []), + {value, {running, Yrunning}} = lists:keysearch(running, 1, Y), + {value, Yapp1} = lists:keysearch(app1, 1, Yrunning), + {app1, {distributed, Cp1}} = Yapp1, stop_node_nice(Cp1), stop_node_nice(Cp2), @@ -1232,26 +1336,26 @@ otp_3002(doc) -> ["crash the node if permanent appl has illegal env parameter values."]; otp_3002(Conf) when is_list(Conf) -> % Create the boot script - ?line {{KernelVer,StdlibVer}, {LatestDir, LatestName}} = + {{KernelVer,StdlibVer}, {LatestDir, LatestName}} = create_script_3002("script_3002"), ?t:format(0, "LatestDir = ~p~n", [LatestDir]), ?t:format(0, "LatestName = ~p~n", [LatestName]), - ?line case is_real_system(KernelVer, StdlibVer) of + case is_real_system(KernelVer, StdlibVer) of true -> Options = []; false -> Options = [local] end, - ?line ok = systools:make_script("script_3002", Options), - ?line ok = systools:script2boot("script_3002"), + ok = systools:make_script("script_3002", Options), + ok = systools:script2boot("script_3002"), - ?line {error, timeout} = start_node_boot_3002(cp1, "script_3002"), + {error, timeout} = start_node_boot_3002(cp1, "script_3002"), - ?line ok = file:delete("script_3002.boot"), - ?line ok = file:delete("script_3002.rel"), - ?line ok = file:delete("script_3002.script"), + ok = file:delete("script_3002.boot"), + ok = file:delete("script_3002.rel"), + ok = file:delete("script_3002.script"), ok. %%----------------------------------------------------------------- @@ -1273,51 +1377,51 @@ otp_4066(Conf) when is_list(Conf) -> App1Nodes = {app1, AllNodes}, Dir = ?config(priv_dir,Conf), - ?line {ok, FdC} = file:open(filename:join(Dir, "otp_4066.config"), [write]), - ?line write_config(FdC, config_4066(AllNodes, 5000, [App1Nodes])), - ?line file:close(FdC), + {ok, FdC} = file:open(filename:join(Dir, "otp_4066.config"), [write]), + write_config(FdC, config_4066(AllNodes, 5000, [App1Nodes])), + file:close(FdC), % Write the app1.app file - ?line {ok, FdA12} = file:open(filename:join(Dir, "app1.app"), [write]), - ?line w_app1(FdA12), - ?line file:close(FdA12), + {ok, FdA12} = file:open(filename:join(Dir, "app1.app"), [write]), + w_app1(FdA12), + file:close(FdA12), Args1 = "-pa " ++ Dir ++ " -config " ++ filename:join(Dir, "otp_4066"), Args2 = "-pa " ++ Dir ++ " -kernel start_dist_ac true", - ?line {ok, Cp2} = start_node_args(Ncp2, Args2), + {ok, Cp2} = start_node_args(Ncp2, Args2), %% Cp1 syncs with cp2 (which is known to be up). - ?line {ok, Cp1} = start_node_args(Ncp1, Args1), - ?line wait_for_ready_net(), + {ok, Cp1} = start_node_args(Ncp1, Args1), + wait_for_ready_net(), - ?line ok = rpc:call(Cp1, application, start, [app1]), - ?line wait_until_started(app1, [Cp1]), - ?line test_server:format("--- App1 started at Cp1 ---~n", []), - ?line print_dac_state(AllNodes), + ok = rpc:call(Cp1, application, start, [app1]), + wait_until_started(app1, [Cp1]), + test_server:format("--- App1 started at Cp1 ---~n", []), + print_dac_state(AllNodes), % Cp2 previously crashed on this stop - ?line ok = rpc:call(Cp1, application, stop, [app1]), - ?line wait_until_stopped(app1, [Cp1]), - ?line test_server:format("--- App1 stopped at Cp1 ---~n", []), - ?line print_dac_state(AllNodes), + ok = rpc:call(Cp1, application, stop, [app1]), + wait_until_stopped(app1, [Cp1]), + test_server:format("--- App1 stopped at Cp1 ---~n", []), + print_dac_state(AllNodes), - ?line ok = rpc:call(Cp1, application, start, [app1]), - ?line wait_until_started(app1, [Cp1]), - ?line test_server:format("--- App1 started at Cp1 ---~n", []), - ?line print_dac_state(AllNodes), + ok = rpc:call(Cp1, application, start, [app1]), + wait_until_started(app1, [Cp1]), + test_server:format("--- App1 started at Cp1 ---~n", []), + print_dac_state(AllNodes), - ?line ok = rpc:call(Cp2, application, load, [app1, App1Nodes]), - ?line ok = rpc:call(Cp2, application, start, [app1]), - ?line test_server:format("--- App1 started at Cp2 ---~n", []), - ?line print_dac_state(AllNodes), + ok = rpc:call(Cp2, application, load, [app1, App1Nodes]), + ok = rpc:call(Cp2, application, start, [app1]), + test_server:format("--- App1 started at Cp2 ---~n", []), + print_dac_state(AllNodes), - ?line stop_node_nice(Cp1), - ?line wait_until_started(app1, [Cp2]), - ?line test_server:format("--- Cp1 crashed; failover to Cp2 ---~n", []), - ?line print_dac_state(Cp2), + stop_node_nice(Cp1), + wait_until_started(app1, [Cp2]), + test_server:format("--- Cp1 crashed; failover to Cp2 ---~n", []), + print_dac_state(Cp2), - ?line stop_node_nice(Cp2), + stop_node_nice(Cp2), ok. config_4066(SyncNodesOptional, SyncNodesTimeout, Distributed) -> @@ -1349,34 +1453,34 @@ otp_4227(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config_4227(NodeNames)), %% Test [cp1, cp2] - ?line {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), - ?line {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, NoSyncTime, Conf), + {ok, Cp2} = start_node_config(Ncp2, WithSyncTime, Conf), Cps = [Cp1, Cp2], - ?line wait_for_ready_net(), + wait_for_ready_net(), %% Try to start app10 which should fail since app9 is not started - ?line {[ok,ok],[]} = + {[ok,ok],[]} = rpc:multicall(Cps, application, load, [app9()]), - ?line ?UNTIL(is_loaded(app9, Cps)), - ?line {[ok,ok],[]} = + ?UNTIL(is_loaded(app9, Cps)), + {[ok,ok],[]} = rpc:multicall(Cps, application, load, [app10_dep9()]), - ?line {error, {not_started, app9}} = + {error, {not_started, app9}} = rpc:call(Cp1, application, start, [app10]), %% Start app9 and brutally kill it, then try to start app10 - ?line ok = rpc:call(Cp1, application, start, [app9]), - ?line test_server:sleep(1000), - ?line Pid9 = rpc:call(Cp1, erlang, whereis, [ch_sup19]), - ?line true = erlang:is_pid(Pid9), - ?line true = erlang:exit(Pid9, kill), - ?line test_server:sleep(1000), + ok = rpc:call(Cp1, application, start, [app9]), + test_server:sleep(1000), + Pid9 = rpc:call(Cp1, erlang, whereis, [ch_sup19]), + true = erlang:is_pid(Pid9), + true = erlang:exit(Pid9, kill), + test_server:sleep(1000), %% This gave {error, no_report} before the patch - ?line {error, {not_running, app9}} = + {error, {not_running, app9}} = rpc:call(Cp1, application, start, [app10]), - ?line stop_node_nice(Cp1), - ?line stop_node_nice(Cp2), + stop_node_nice(Cp1), + stop_node_nice(Cp2), ok. config_4227([Ncp1, Ncp2]) -> @@ -1410,18 +1514,18 @@ otp_5363(Conf) when is_list(Conf) -> OldPath = code:get_path(), code:add_patha(?config(data_dir,Conf)), try - ?line ok = application:load(app_group_leader()), - ?line ok = application:start(group_leader), - ?line case whereis(nisse) of + ok = application:load(app_group_leader()), + ok = application:start(group_leader), + case whereis(nisse) of Pid when is_pid(Pid) -> - ?line Mref = erlang:monitor(process, Pid), - ?line ok = application:stop(group_leader), + Mref = erlang:monitor(process, Pid), + ok = application:stop(group_leader), receive {'DOWN',Mref,_,_,_} -> ok end, - ?line undefined = whereis(nisse); + undefined = whereis(nisse); Bad -> - ?line io:format("~p\n", [Bad]), + io:format("~p\n", [Bad]), ?t:fail() end after @@ -1448,25 +1552,25 @@ otp_5606(Conf) when is_list(Conf) -> Config = filename:join(Dir, "sys"), %% Test [cp1, cp2] - ?line {ok, Cp1} = start_node(Ncp1, Config), - ?line {ok, Cp2} = start_node(Ncp2, Config), + {ok, Cp1} = start_node(Ncp1, Config), + {ok, Cp2} = start_node(Ncp2, Config), Cps = [Cp1, Cp2], - ?line wait_for_ready_net(), + wait_for_ready_net(), %% Load app1 on both nodes - ?line {[ok, ok], []} = + {[ok, ok], []} = rpc:multicall(Cps, application, load, [app1()]), %% Attempt to start app1 from different processes simultaneously - ?line Pid11 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), - ?line Pid12 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), - ?line Pid13 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), - ?line Pid2 = spawn_link(Cp2, ?MODULE, loop5606, [self()]), + Pid11 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), + Pid12 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), + Pid13 = spawn_link(Cp1, ?MODULE, loop5606, [self()]), + Pid2 = spawn_link(Cp2, ?MODULE, loop5606, [self()]), - ?line Pid2 ! start, - ?line Pid11 ! start, - ?line Pid12 ! start, - ?line Pid13 ! start, + Pid2 ! start, + Pid11 ! start, + Pid12 ! start, + Pid13 ! start, ResL = otp_5606_loop([]), @@ -1476,10 +1580,10 @@ otp_5606(Conf) when is_list(Conf) -> [Res1, Res2, Res3, Res4] -> Txt = io_lib:format("Illegal results from start ~p ~p ~p ~p", [Res1, Res2, Res3, Res4]), - ?line test_server:fail(lists:flatten(Txt)) + test_server:fail(lists:flatten(Txt)) end, - ?line {error, {already_started, app1}} = + {error, {already_started, app1}} = rpc:call(Cp1, application, start, [app1]), stop_node_nice(Cp1), @@ -1491,7 +1595,7 @@ otp_5606_loop(ResL) when length(ResL)<4 -> {_Pid, Res} -> otp_5606_loop([Res|ResL]) after 5000 -> - ?line test_server:fail(timeout_waiting_for_res) + test_server:fail(timeout_waiting_for_res) end; otp_5606_loop(ResL) -> ResL. @@ -1503,6 +1607,15 @@ loop5606(Pid) -> Pid ! {self(), Res} end. +get_env(suite) -> []; +get_env(doc) -> + ["Tests get_env/* functions"]; +get_env(Conf) when is_list(Conf) -> + {ok, _} = application:get_env(kernel, error_logger), + undefined = application:get_env(undefined_app, a), + undefined = application:get_env(kernel, error_logger_xyz), + default = application:get_env(kernel, error_logger_xyz, default), + ok. %%----------------------------------------------------------------- %% Should be started in a CC view with: @@ -1516,34 +1629,34 @@ get_key(Conf) when is_list(Conf) -> WithSyncTime = config_fun(config_inc(NodeNames)), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_config(Ncp1, WithSyncTime, Conf), + {ok, Cp1} = start_node_config(Ncp1, WithSyncTime, Conf), - ?line ok = rpc:call(Cp1, application, load, [appinc(), d3(NodeNames)]), - ?line ?UNTIL(is_loaded(appinc, Cp1)), - ?line ok = rpc:call(Cp1, application, start, [appinc, permanent]), - ?line ?UNTIL(is_started(appinc, Cp1)), + ok = rpc:call(Cp1, application, load, [appinc(), d3(NodeNames)]), + ?UNTIL(is_loaded(appinc, Cp1)), + ok = rpc:call(Cp1, application, start, [appinc, permanent]), + ?UNTIL(is_started(appinc, Cp1)), - ?line {ok, "Test of new app file, including appnew"} = + {ok, "Test of new app file, including appnew"} = rpc:call(Cp1, application, get_key, [appinc, description]), - ?line {ok, "CXC 138 ai"} = rpc:call(Cp1, application, get_key, [appinc ,id]), - ?line {ok, "2.0"} = rpc:call(Cp1, application, get_key, [appinc, vsn]), - ?line {ok, [kernel]} = rpc:call(Cp1, application, get_key, [appinc, applications]), - ?line {ok, [appinc1, appinc2]} = + {ok, "CXC 138 ai"} = rpc:call(Cp1, application, get_key, [appinc ,id]), + {ok, "2.0"} = rpc:call(Cp1, application, get_key, [appinc, vsn]), + {ok, [kernel]} = rpc:call(Cp1, application, get_key, [appinc, applications]), + {ok, [appinc1, appinc2]} = rpc:call(Cp1, application, get_key, [appinc, included_applications]), - ?line {ok, []} = rpc:call(Cp1, application, get_key, [appinc, registered]), - ?line {ok, [{init, [kalle]}, {takeover, []}, {go, [sune]}]} = + {ok, []} = rpc:call(Cp1, application, get_key, [appinc, registered]), + {ok, [{init, [kalle]}, {takeover, []}, {go, [sune]}]} = rpc:call(Cp1, application, get_key, [appinc, start_phases]), - ?line {ok, Env} = rpc:call(Cp1, application, get_key, [appinc ,env]), - ?line [{included_applications,[appinc1,appinc2]}, + {ok, Env} = rpc:call(Cp1, application, get_key, [appinc ,env]), + [{included_applications,[appinc1,appinc2]}, {own2,val2},{own_env1,value1}] = lists:sort(Env), - ?line {ok, []} = rpc:call(Cp1, application, get_key, [appinc, modules]), - ?line {ok, {application_starter, [ch_sup, {appinc, 41, 43}] }} = + {ok, []} = rpc:call(Cp1, application, get_key, [appinc, modules]), + {ok, {application_starter, [ch_sup, {appinc, 41, 43}] }} = rpc:call(Cp1, application, get_key, [appinc, mod]), - ?line {ok, infinity} = rpc:call(Cp1, application, get_key, [appinc, maxP]), - ?line {ok, infinity} = rpc:call(Cp1, application, get_key, [appinc, maxT]), - ?line undefined = rpc:call(Cp1, application, get_key, [appinc, very_unknown]), + {ok, infinity} = rpc:call(Cp1, application, get_key, [appinc, maxP]), + {ok, infinity} = rpc:call(Cp1, application, get_key, [appinc, maxT]), + undefined = rpc:call(Cp1, application, get_key, [appinc, very_unknown]), - ?line {ok, [{description, "Test of new app file, including appnew"}, + {ok, [{description, "Test of new app file, including appnew"}, {id, "CXC 138 ai"}, {vsn, "2.0"}, {modules, []}, @@ -1556,40 +1669,40 @@ get_key(Conf) when is_list(Conf) -> {mod, {application_starter, [ch_sup, {appinc, 41, 43}] }}, {start_phases, [{init, [kalle]}, {takeover, []}, {go, [sune]}]}]} = rpc:call(Cp1, application, get_all_key, [appinc]), - ?line [{included_applications,[appinc1,appinc2]}, + [{included_applications,[appinc1,appinc2]}, {own2,val2},{own_env1,value1}] = lists:sort(Env), - ?line {ok, "Test of new app file, including appnew"} = + {ok, "Test of new app file, including appnew"} = gen_server:call({global, {ch,41}}, {get_pid_key, description}), - ?line {ok, "CXC 138 ai"} = + {ok, "CXC 138 ai"} = gen_server:call({global, {ch,41}}, {get_pid_key, id}), - ?line {ok, "2.0"} = + {ok, "2.0"} = gen_server:call({global, {ch,41}}, {get_pid_key, vsn}), - ?line {ok, [kernel]} = + {ok, [kernel]} = gen_server:call({global, {ch,41}}, {get_pid_key, applications}), - ?line {ok, [appinc1, appinc2]} = + {ok, [appinc1, appinc2]} = gen_server:call({global, {ch,41}}, {get_pid_key, included_applications}), - ?line {ok, []} = + {ok, []} = gen_server:call({global, {ch,41}}, {get_pid_key, registered}), - ?line {ok, [{init, [kalle]}, {takeover, []}, {go, [sune]}]} = + {ok, [{init, [kalle]}, {takeover, []}, {go, [sune]}]} = gen_server:call({global, {ch,41}}, {get_pid_key, start_phases}), - ?line {ok, Env} = gen_server:call({global, {ch,41}}, {get_pid_key, env}), - ?line [{included_applications,[appinc1,appinc2]}, + {ok, Env} = gen_server:call({global, {ch,41}}, {get_pid_key, env}), + [{included_applications,[appinc1,appinc2]}, {own2,val2},{own_env1,value1}] = lists:sort(Env), - ?line {ok, []} = + {ok, []} = gen_server:call({global, {ch,41}}, {get_pid_key, modules}), - ?line {ok, {application_starter, [ch_sup, {appinc, 41, 43}] }} = + {ok, {application_starter, [ch_sup, {appinc, 41, 43}] }} = gen_server:call({global, {ch,41}}, {get_pid_key, mod}), - ?line {ok, infinity} = + {ok, infinity} = gen_server:call({global, {ch,41}}, {get_pid_key, maxP}), - ?line {ok, infinity} = + {ok, infinity} = gen_server:call({global, {ch,41}}, {get_pid_key, maxT}), - ?line undefined = + undefined = gen_server:call({global, {ch,41}}, {get_pid_key, very_unknown}), - ?line {ok, [{description, "Test of new app file, including appnew"}, + {ok, [{description, "Test of new app file, including appnew"}, {id, "CXC 138 ai"}, {vsn, "2.0"}, {modules, []}, @@ -1602,7 +1715,7 @@ get_key(Conf) when is_list(Conf) -> {mod, {application_starter, [ch_sup, {appinc, 41, 43}] }}, {start_phases, [{init, [kalle]}, {takeover, []}, {go, [sune]}]}]} = gen_server:call({global, {ch,41}}, get_pid_all_key), - ?line [{included_applications,[appinc1,appinc2]}, + [{included_applications,[appinc1,appinc2]}, {own2,val2},{own_env1,value1}] = lists:sort(Env), stop_node_nice(Cp1), @@ -1619,81 +1732,81 @@ distr_changed_tc1(Conf) when is_list(Conf) -> {OldKernel, OldEnv, {Cp1, Cp2, Cp3}, {_Ncp1, _Ncp2, _Ncp3}, _Config2} = distr_changed_prep(Conf), - ?line NewDist = {distributed, [{app1, [Cp3]}, + NewDist = {distributed, [{app1, [Cp3]}, {app2, 5000, [Cp2]}, {app3, [Cp3, {Cp1, Cp2}]}, {app6, [Cp1, {Cp3, Cp2}]}, {app7, 1000, [Cp3]}, {app8, [Cp1, {Cp2, Cp3}]}]}, - ?line NewKernel = [{kernel, lists:keyreplace(distributed, 1, OldKernel, NewDist)}], - ?line ok = rpc:call(Cp1, application_controller, test_change_apps, + NewKernel = [{kernel, lists:keyreplace(distributed, 1, OldKernel, NewDist)}], + ok = rpc:call(Cp1, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line ok = rpc:call(Cp2, application_controller, test_change_apps, + ok = rpc:call(Cp2, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line ok = rpc:call(Cp3, application_controller, test_change_apps, + ok = rpc:call(Cp3, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application_controller, config_change, [OldEnv]), - ?line test_server:sleep(7000), + test_server:sleep(7000), - ?line DcInfo1 = rpc:call(Cp1, dist_ac, info, []), - ?line DcInfo2 = rpc:call(Cp2, dist_ac, info, []), - ?line DcInfo3 = rpc:call(Cp3, dist_ac, info, []), + DcInfo1 = rpc:call(Cp1, dist_ac, info, []), + DcInfo2 = rpc:call(Cp2, dist_ac, info, []), + DcInfo3 = rpc:call(Cp3, dist_ac, info, []), - ?line DcWa1 = which_applications(Cp1), - ?line DcWa2 = which_applications(Cp2), - ?line DcWa3 = which_applications(Cp3), + DcWa1 = which_applications(Cp1), + DcWa2 = which_applications(Cp2), + DcWa3 = which_applications(Cp3), - ?line Wa1 = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, + Wa1 = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, [], DcWa1), - ?line Wa2 = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, + Wa2 = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, [], DcWa2), - ?line Wa3 = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, + Wa3 = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, [], DcWa3), - ?line case lists:sort(Wa1) of + case lists:sort(Wa1) of [app1, app2, app3, kernel, stdlib] -> ok; EWa1 -> X1 = io_lib:format("distribution error: Cp1 ~p ",[EWa1]), - ?line test_server:fail(lists:flatten(X1)) + test_server:fail(lists:flatten(X1)) end, - ?line case lists:sort(Wa2) of + case lists:sort(Wa2) of [app6, app8, kernel, stdlib] -> ok; EWa2 -> X2 = io_lib:format("distribution error: Cp2 ~p ",[EWa2]), - ?line test_server:fail(lists:flatten(X2)) + test_server:fail(lists:flatten(X2)) end, - ?line case lists:sort(Wa3) of + case lists:sort(Wa3) of [app7, kernel, stdlib] -> ok; EWa3 -> X3 = io_lib:format("distribution error: Cp3 ~p ",[EWa3]), - ?line test_server:fail(lists:flatten(X3)) + test_server:fail(lists:flatten(X3)) end, - ?line DcInfo1n = rpc:call(Cp1, dist_ac, info, []), - ?line DcInfo2n = rpc:call(Cp2, dist_ac, info, []), - ?line DcInfo3n = rpc:call(Cp3, dist_ac, info, []), + DcInfo1n = rpc:call(Cp1, dist_ac, info, []), + DcInfo2n = rpc:call(Cp2, dist_ac, info, []), + DcInfo3n = rpc:call(Cp3, dist_ac, info, []), %% Added afterwards. Got rid of some warnings for unused variables. - ?line true = DcInfo1 =:= DcInfo1n, - ?line true = DcInfo2 =:= DcInfo2n, - ?line true = DcInfo3 =:= DcInfo3n, + true = DcInfo1 =:= DcInfo1n, + true = DcInfo2 =:= DcInfo2n, + true = DcInfo3 =:= DcInfo3n, stop_node_nice(Cp1), stop_node_nice(Cp2), stop_node_nice(Cp3), - ?line ok = file:delete("dc.boot"), - ?line ok = file:delete("dc.rel"), - ?line ok = file:delete("dc.script"), + ok = file:delete("dc.boot"), + ok = file:delete("dc.rel"), + ok = file:delete("dc.script"), ok. @@ -1705,103 +1818,103 @@ distr_changed_tc2(Conf) when is_list(Conf) -> {OldKernel, OldEnv, {Cp1, Cp2, Cp3}, {Ncp1, _Ncp2, _Ncp3}, Config2} = distr_changed_prep(Conf), - ?line NewDist = {distributed, [{app1, [Cp3]}, + NewDist = {distributed, [{app1, [Cp3]}, {app2, 5000, [Cp2]}, {app3, [Cp3, {Cp1, Cp2}]}, {app6, [Cp1, {Cp3, Cp2}]}, {app7, 1000, [Cp3]}, {app8, [Cp1, {Cp2, Cp3}]}]}, - ?line NewKernel = [{kernel, lists:keyreplace(distributed, 1, OldKernel, NewDist)}], - ?line ok = rpc:call(Cp1, application_controller, test_change_apps, + NewKernel = [{kernel, lists:keyreplace(distributed, 1, OldKernel, NewDist)}], + ok = rpc:call(Cp1, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line ok = rpc:call(Cp2, application_controller, test_change_apps, + ok = rpc:call(Cp2, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line ok = rpc:call(Cp3, application_controller, test_change_apps, + ok = rpc:call(Cp3, application_controller, test_change_apps, [[kernel], [NewKernel]]), - ?line {[ok,ok,ok],[]} = + {[ok,ok,ok],[]} = rpc:multicall([Cp1, Cp2, Cp3], application_controller, config_change, [OldEnv]), - ?line test_server:sleep(4000), - ?line stop_node_nice(Cp1), - ?line test_server:sleep(10000), + test_server:sleep(4000), + stop_node_nice(Cp1), + test_server:sleep(10000), -% ?line _DcInfo1 = rpc:call(Cp1, dist_ac, info, []), - ?line _DcInfo2 = rpc:call(Cp2, dist_ac, info, []), - ?line _DcInfo3 = rpc:call(Cp3, dist_ac, info, []), +% _DcInfo1 = rpc:call(Cp1, dist_ac, info, []), + _DcInfo2 = rpc:call(Cp2, dist_ac, info, []), + _DcInfo3 = rpc:call(Cp3, dist_ac, info, []), % ?t:format(0,"#### DcInfo1 ~n~p~n",[_DcInfo1]), -% ?line DcWa1 = which_applications(Cp1), - ?line DcWa2 = which_applications(Cp2), - ?line DcWa3 = which_applications(Cp3), +% DcWa1 = which_applications(Cp1), + DcWa2 = which_applications(Cp2), + DcWa3 = which_applications(Cp3), -% ?line Wa1 = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, +% Wa1 = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, % [], DcWa1), - ?line Wa2 = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, + Wa2 = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, [], DcWa2), - ?line Wa3 = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, + Wa3 = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, [], DcWa3), - ?line case lists:sort(Wa2) of + case lists:sort(Wa2) of [app2, app6, app8, kernel, stdlib] -> ok; EWa2 -> X2 = io_lib:format("distribution error: Cp2 ~p ",[EWa2]), - ?line test_server:fail(lists:flatten(X2)) + test_server:fail(lists:flatten(X2)) end, - ?line case lists:sort(Wa3) of + case lists:sort(Wa3) of [app1, app3, app7, kernel, stdlib] -> ok; EWa3 -> X3 = io_lib:format("distribution error: Cp3 ~p ",[EWa3]), - ?line test_server:fail(lists:flatten(X3)) + test_server:fail(lists:flatten(X3)) end, - ?line {ok, Cp1} = start_node_boot(Ncp1, Config2, dc), - ?line test_server:sleep(10000), + {ok, Cp1} = start_node_boot(Ncp1, Config2, dc), + test_server:sleep(10000), - ?line _DcInfo1rs = rpc:call(Cp1, dist_ac, info, []), - ?line _DcInfo2rs = rpc:call(Cp2, dist_ac, info, []), - ?line _DcInfo3rs = rpc:call(Cp3, dist_ac, info, []), + _DcInfo1rs = rpc:call(Cp1, dist_ac, info, []), + _DcInfo2rs = rpc:call(Cp2, dist_ac, info, []), + _DcInfo3rs = rpc:call(Cp3, dist_ac, info, []), - ?line DcWa1rs = which_applications(Cp1), - ?line DcWa2rs = which_applications(Cp2), - ?line DcWa3rs = which_applications(Cp3), + DcWa1rs = which_applications(Cp1), + DcWa2rs = which_applications(Cp2), + DcWa3rs = which_applications(Cp3), - ?line Wa1rs = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, + Wa1rs = lists:foldl(fun({A1, _N1, _V1}, AccIn) -> [A1 | AccIn] end, [], DcWa1rs), - ?line Wa2rs = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, + Wa2rs = lists:foldl(fun({A2, _N2, _V2}, AccIn) -> [A2 | AccIn] end, [], DcWa2rs), - ?line Wa3rs = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, + Wa3rs = lists:foldl(fun({A3, _N3, _V3}, AccIn) -> [A3 | AccIn] end, [], DcWa3rs), - ?line case lists:sort(Wa1rs) of + case lists:sort(Wa1rs) of [app6, app8, kernel, stdlib] -> ok; EWa1rs -> X1rs = io_lib:format("distribution error: Cp1 ~p ",[EWa1rs]), - ?line test_server:fail(lists:flatten(X1rs)) + test_server:fail(lists:flatten(X1rs)) end, - ?line case lists:sort(Wa2rs) of + case lists:sort(Wa2rs) of [app2, kernel, stdlib] -> ok; EWa2rs -> X2rs = io_lib:format("distribution error: Cp2 ~p ",[EWa2rs]), - ?line test_server:fail(lists:flatten(X2rs)) + test_server:fail(lists:flatten(X2rs)) end, - ?line case lists:sort(Wa3rs) of + case lists:sort(Wa3rs) of [app1, app3, app7, kernel, stdlib] -> ok; EWa3rs -> X3rs = io_lib:format("distribution error: Cp3 ~p ",[EWa3rs]), - ?line test_server:fail(lists:flatten(X3rs)) + test_server:fail(lists:flatten(X3rs)) end, @@ -1809,9 +1922,9 @@ distr_changed_tc2(Conf) when is_list(Conf) -> stop_node_nice(Cp2), stop_node_nice(Cp3), - ?line ok = file:delete("dc.boot"), - ?line ok = file:delete("dc.rel"), - ?line ok = file:delete("dc.script"), + ok = file:delete("dc.boot"), + ok = file:delete("dc.rel"), + ok = file:delete("dc.script"), ok. @@ -1827,36 +1940,36 @@ config_change(doc) -> config_change(Conf) when is_list(Conf) -> %% Change to data_dir - ?line {ok, CWD} = file:get_cwd(), - ?line DataDir = ?config(data_dir, Conf), - ?line ok = file:set_cwd(DataDir), + {ok, CWD} = file:get_cwd(), + DataDir = ?config(data_dir, Conf), + ok = file:set_cwd(DataDir), %% Find out application data from boot script - ?line Boot = filename:join([code:root_dir(), "bin", "start.boot"]), - ?line {ok, Bin} = file:read_file(Boot), - ?line Appls = get_appls(binary_to_term(Bin)), + Boot = filename:join([code:root_dir(), "bin", "start.boot"]), + {ok, Bin} = file:read_file(Boot), + Appls = get_appls(binary_to_term(Bin)), %% Simulate contents of "sys.config" - ?line Config = [{stdlib, [{par1,sys},{par2,sys}]}, + Config = [{stdlib, [{par1,sys},{par2,sys}]}, "t1", "t2.config", filename:join([DataDir, "subdir", "t3"]), {stdlib, [{par6,sys}]}], %% Order application_controller to update configuration - ?line ok = application_controller:change_application_data(Appls, + ok = application_controller:change_application_data(Appls, Config), %% Check that stdlib parameters are correctly set - ?line Env = application:get_all_env(stdlib), - ?line {value, {par1,sys}} = lists:keysearch(par1, 1, Env), - ?line {value, {par2,t1}} = lists:keysearch(par2, 1, Env), - ?line {value, {par3,t1}} = lists:keysearch(par3, 1, Env), - ?line {value, {par4,t2}} = lists:keysearch(par4, 1, Env), - ?line {value, {par5,t3}} = lists:keysearch(par5, 1, Env), - ?line {value, {par6,sys}} = lists:keysearch(par6, 1, Env), + Env = application:get_all_env(stdlib), + {value, {par1,sys}} = lists:keysearch(par1, 1, Env), + {value, {par2,t1}} = lists:keysearch(par2, 1, Env), + {value, {par3,t1}} = lists:keysearch(par3, 1, Env), + {value, {par4,t2}} = lists:keysearch(par4, 1, Env), + {value, {par5,t3}} = lists:keysearch(par5, 1, Env), + {value, {par6,sys}} = lists:keysearch(par6, 1, Env), - ?line ok = file:set_cwd(CWD). + ok = file:set_cwd(CWD). %% This function is stolen from SASL module release_handler, OTP R10B get_appls({script, _, Script}) -> @@ -1882,18 +1995,18 @@ shutdown_func(suite) -> shutdown_func(doc) -> ["Tests the 'shutdown_func' kernel config parameter"]; shutdown_func(Config) when is_list(Config) -> - ?line {ok,Cp1} = start_node(?MODULE_STRING++"_shutdown_func"), - ?line wait_for_ready_net(), - ?line Tag = make_ref(), - ?line ok = rpc:call(Cp1, application, set_env, + {ok,Cp1} = start_node(?MODULE_STRING++"_shutdown_func"), + wait_for_ready_net(), + Tag = make_ref(), + ok = rpc:call(Cp1, application, set_env, [kernel, shutdown_func, {?MODULE, do_shutdown}]), - ?line ok = rpc:call(Cp1, application, set_env, + ok = rpc:call(Cp1, application, set_env, [kernel, shutdown_func_test, {self(), Tag}]), - ?line _ = rpc:call(Cp1, init, stop, []), - ?line receive + _ = rpc:call(Cp1, init, stop, []), + receive {Pid, Tag, shutting_down, shutdown} -> - ?line Mref = erlang:monitor(process, Pid), - ?line Pid ! {self(), Tag, ok}, + Mref = erlang:monitor(process, Pid), + Pid ! {self(), Tag, ok}, receive {'DOWN', Mref, _, Pid, noconnection} -> ok @@ -2091,6 +2204,24 @@ app_start_error() -> {applications, [kernel]}, {mod, {app_start_error, []}}]}. +app_chain_error() -> + {application, app_chain_error, + [{description, "ERTS CXC 138 ce"}, + {vsn, "2.0"}, + {modules, []}, + {registered, []}, + {applications, [kernel, app_chain_error2]}, + {mod, {ch_sup, {app_chain_error, 20,20}}}]}. + +app_chain_error2() -> + {application, app_chain_error2, + [{description, "ERTS CXC 138 ce2"}, + {vsn, "2.0"}, + {modules, []}, + {registered, []}, + {applications, [kernel, app10, hopefully_not_an_existing_app]}, + {mod, {ch_sup, {app_chain_error2, 21,21}}}]}. + app_group_leader() -> {application, group_leader, [{description, "GROUP_LEADER CXC 138 11"}, @@ -2340,6 +2471,12 @@ w_app7(Fd) -> w_app8(Fd) -> io:format(Fd, "~p.\n", [app8()]). +w_app9(Fd) -> + io:format(Fd, "~p.\n", [app9()]). + +w_app10_dep9(Fd) -> + io:format(Fd, "~p.\n", [app10_dep9()]). + w_app_start_error(Fd) -> io:format(Fd, "~p.\n", [app_start_error()]). @@ -2479,9 +2616,9 @@ node_name(Name, Config) -> lists:concat([Name,U,?testcase,U,U,L]). stop_node_nice(Node) when is_atom(Node) -> - ?line test_server:stop_node(Node); + test_server:stop_node(Node); stop_node_nice(Nodes) when is_list(Nodes) -> - ?line lists:foreach(fun (N) -> stop_node_nice(N) end, Nodes). + lists:foreach(fun (N) -> stop_node_nice(N) end, Nodes). get_start_type(Expected) -> @@ -2572,10 +2709,10 @@ get_conf_change(Expected) -> {cc, Expected} -> ok; {cc, List} -> - ?line test_server:format("====== ~p ======~n",[{cc, List}]), - ?line test_server:fail(not_valid_conf_change) + test_server:format("====== ~p ======~n",[{cc, List}]), + test_server:fail(not_valid_conf_change) after 5000 -> - ?line test_server:fail(not_valid_conf_change_to) + test_server:fail(not_valid_conf_change_to) end. conf_change() -> @@ -2595,75 +2732,75 @@ cc(List) -> create_app() -> - ?line Dir = "./", - ?line App1 = Dir ++ "app1", - ?line {ok, Fd1} = file:open(App1++".app",[write]), - ?line io:format(Fd1, "~p. \n", [app1()]), - ?line file:close(Fd1), - ?line App2 = Dir ++ "app2", - ?line {ok, Fd2} = file:open(App2++".app",[write]), - ?line io:format(Fd2, "~p. \n", [app2()]), - ?line file:close(Fd2), - ?line App3 = Dir ++ "app_sp", - ?line {ok, Fd3} = file:open(App3++".app",[write]), - ?line io:format(Fd3, "~p. \n", [app_sp()]), - ?line file:close(Fd3), + Dir = "./", + App1 = Dir ++ "app1", + {ok, Fd1} = file:open(App1++".app",[write]), + io:format(Fd1, "~p. \n", [app1()]), + file:close(Fd1), + App2 = Dir ++ "app2", + {ok, Fd2} = file:open(App2++".app",[write]), + io:format(Fd2, "~p. \n", [app2()]), + file:close(Fd2), + App3 = Dir ++ "app_sp", + {ok, Fd3} = file:open(App3++".app",[write]), + io:format(Fd3, "~p. \n", [app_sp()]), + file:close(Fd3), ok. create_script(ScriptName) -> - ?line Dir = "./", - ?line Name = Dir ++ ScriptName, - ?line Apps = which_applications(), - ?line {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), - ?line {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), - ?line {ok,Fd} = file:open(Name++".rel",[write]), - ?line io:format(Fd, + Dir = "./", + Name = Dir ++ ScriptName, + Apps = which_applications(), + {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), + {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), + {ok,Fd} = file:open(Name++".rel",[write]), + io:format(Fd, "{release, {\"Test release 3\", \"LATEST\"}, \n" " {erts, \"4.4\"}, \n" " [{kernel, \"~s\"}, {stdlib, \"~s\"}, \n" " {app1, \"2.0\"}, {app2, \"2.0\"}, {app_sp, \"2.0\"}]}.\n", [KernelVer,StdlibVer]), - ?line file:close(Fd), + file:close(Fd), {{KernelVer,StdlibVer}, {filename:dirname(Name), filename:basename(Name)}}. create_script_dc(ScriptName) -> - ?line Dir = "./", - ?line Name = Dir ++ ScriptName, - ?line Apps = which_applications(), - ?line {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), - ?line {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), - ?line {ok,Fd} = file:open(Name++".rel",[write]), - ?line io:format(Fd, + Dir = "./", + Name = Dir ++ ScriptName, + Apps = which_applications(), + {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), + {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), + {ok,Fd} = file:open(Name++".rel",[write]), + io:format(Fd, "{release, {\"Test release 3\", \"LATEST\"}, \n" " {erts, \"4.4\"}, \n" " [{kernel, \"~s\"}, {stdlib, \"~s\"}, \n" " {app1, \"2.0\"}, {app2, \"2.0\"}, {app3, \"2.0\"}, \n" " {app6, \"2.0\"}, {app7, \"2.0\"}, {app8, \"2.0\"}]}.\n", [KernelVer,StdlibVer]), - ?line file:close(Fd), + file:close(Fd), {{KernelVer,StdlibVer}, {filename:dirname(Name), filename:basename(Name)}}. create_script_3002(ScriptName) -> - ?line Dir = "./", - ?line Name = Dir ++ ScriptName, - ?line Apps = which_applications(), - ?line {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), - ?line {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), - ?line {value,{_,_,SaslVer}} = lists:keysearch(sasl,1,Apps), - ?line {ok,Fd} = file:open(Name++".rel",[write]), - ?line io:format(Fd, + Dir = "./", + Name = Dir ++ ScriptName, + Apps = which_applications(), + {value,{_,_,KernelVer}} = lists:keysearch(kernel,1,Apps), + {value,{_,_,StdlibVer}} = lists:keysearch(stdlib,1,Apps), + {value,{_,_,SaslVer}} = lists:keysearch(sasl,1,Apps), + {ok,Fd} = file:open(Name++".rel",[write]), + io:format(Fd, "{release, {\"Test release 3\", \"LATEST\"}, \n" " {erts, \"4.4\"}, \n" " [{kernel, \"~s\"}, {stdlib, \"~s\"}, \n" " {sasl, \"~s\"}]}.\n", [KernelVer, StdlibVer, SaslVer]), - ?line file:close(Fd), + file:close(Fd), {{KernelVer,StdlibVer}, {filename:dirname(Name), filename:basename(Name)}}. @@ -2672,57 +2809,57 @@ create_script_3002(ScriptName) -> distr_changed_prep(Conf) when is_list(Conf) -> % Write .app files - ?line {ok, Fd1} = file:open("app1.app", [write]), - ?line w_app1(Fd1), - ?line file:close(Fd1), - ?line {ok, Fd2} = file:open("app2.app", [write]), - ?line w_app2(Fd2), - ?line file:close(Fd2), - ?line {ok, Fd3} = file:open("app3.app", [write]), - ?line w_app3(Fd3), - ?line file:close(Fd3), - ?line {ok, Fd4} = file:open("app6.app", [write]), - ?line w_app6(Fd4), - ?line file:close(Fd4), - ?line {ok, Fd5} = file:open("app7.app", [write]), - ?line w_app7(Fd5), - ?line file:close(Fd5), - ?line {ok, Fd6} = file:open("app8.app", [write]), - ?line w_app8(Fd6), - ?line file:close(Fd6), + {ok, Fd1} = file:open("app1.app", [write]), + w_app1(Fd1), + file:close(Fd1), + {ok, Fd2} = file:open("app2.app", [write]), + w_app2(Fd2), + file:close(Fd2), + {ok, Fd3} = file:open("app3.app", [write]), + w_app3(Fd3), + file:close(Fd3), + {ok, Fd4} = file:open("app6.app", [write]), + w_app6(Fd4), + file:close(Fd4), + {ok, Fd5} = file:open("app7.app", [write]), + w_app7(Fd5), + file:close(Fd5), + {ok, Fd6} = file:open("app8.app", [write]), + w_app8(Fd6), + file:close(Fd6), % Create the .app files and the boot script - ?line {{KernelVer,StdlibVer}, _} = create_script_dc("dc"), + {{KernelVer,StdlibVer}, _} = create_script_dc("dc"), - ?line case is_real_system(KernelVer, StdlibVer) of + case is_real_system(KernelVer, StdlibVer) of true -> Options = []; false -> Options = [local] end, - ?line ok = systools:make_script("dc", Options), + ok = systools:make_script("dc", Options), NodeNames = [Ncp1, Ncp2, Ncp3] = node_names([cp1, cp2, cp3], Conf), NoSyncTime = config_fun_fast(config_dc(NodeNames)), WithSyncTime = config_fun(config_dc(NodeNames)), - ?line Dir = ?config(priv_dir,Conf), - ?line {ok, Fd_dc2} = file:open(filename:join(Dir, "sys2.config"), [write]), - ?line (config_dc2(NodeNames))(Fd_dc2), - ?line file:close(Fd_dc2), - ?line Config2 = filename:join(Dir, "sys2"), + Dir = ?config(priv_dir,Conf), + {ok, Fd_dc2} = file:open(filename:join(Dir, "sys2.config"), [write]), + (config_dc2(NodeNames))(Fd_dc2), + file:close(Fd_dc2), + Config2 = filename:join(Dir, "sys2"), % Test [cp1, cp2, cp3] - ?line {ok, Cp1} = start_node_boot_config(Ncp1, NoSyncTime, Conf, dc), - ?line {ok, Cp2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, dc), - ?line {ok, Cp3} = start_node_boot_config(Ncp3, WithSyncTime, Conf, dc), - ?line global:sync(), + {ok, Cp1} = start_node_boot_config(Ncp1, NoSyncTime, Conf, dc), + {ok, Cp2} = start_node_boot_config(Ncp2, NoSyncTime, Conf, dc), + {ok, Cp3} = start_node_boot_config(Ncp3, WithSyncTime, Conf, dc), + global:sync(), %% Read the current configuration parameters, and change them - ?line OldEnv = rpc:call(Cp1, application_controller, prep_config_change, []), - ?line {value, {kernel, OldKernel}} = lists:keysearch(kernel, 1, OldEnv), + OldEnv = rpc:call(Cp1, application_controller, prep_config_change, []), + {value, {kernel, OldKernel}} = lists:keysearch(kernel, 1, OldEnv), {OldKernel, OldEnv, {Cp1, Cp2, Cp3}, {Ncp1, Ncp2, Ncp3}, Config2}. |