File 0774-test-handle-more-than-one-.config-with-one-config-pa.patch of Package erlang

From c8538adb57a332978c68521fe717cf9cc3407e6b Mon Sep 17 00:00:00 2001
From: Pouriya Jahanbakhsh <pouriya.jahanbakhsh@gmail.com>
Date: Wed, 4 Sep 2019 18:08:16 +0430
Subject: [PATCH 2/4] test: handle more than one *.config with one -config
 parameter

---
 lib/kernel/test/application_SUITE.erl | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/lib/kernel/test/application_SUITE.erl b/lib/kernel/test/application_SUITE.erl
index 1ab554db7c..373305c486 100644
--- a/lib/kernel/test/application_SUITE.erl
+++ b/lib/kernel/test/application_SUITE.erl
@@ -37,7 +37,8 @@
 -export([config_change/1, persistent_env/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, shutdown_deadlock/1]).
+	 shutdown_func/1, do_shutdown/1, shutdown_timeout/1, shutdown_deadlock/1,
+         handle_many_config_files/1]).
 
 -define(TESTCASE, testcase_name).
 -define(testcase, proplists:get_value(?TESTCASE, Config)).
@@ -56,7 +57,7 @@ all() ->
      permit_false_start_dist, get_key, get_env, ensure_all_started,
      {group, distr_changed}, config_change, shutdown_func, shutdown_timeout,
      shutdown_deadlock,
-     persistent_env].
+     persistent_env, handle_many_config_files].
 
 groups() -> 
     [{reported_bugs, [],
@@ -1984,6 +1985,28 @@ persistent_env(Conf) when is_list(Conf) ->
     %% Clean up
     ok = application:unload(appinc).
 
+
+%% Test more than one config file defined by one -config parameter:
+handle_many_config_files(Conf) when is_list(Conf) ->
+
+    %% Write a config file
+    Dir = proplists:get_value(priv_dir, Conf),
+    {ok, Fd} = file:open(filename:join(Dir, "sys.config"), [write]),
+    io:format(Fd, "[].~n", []),
+    file:close(Fd),
+    NodeName = node_name(n1, Conf),
+    Config = filename:join(Dir, "sys"),
+
+    %% Node will be started with two -config
+    %% First one has one argument and second one has two arguments.
+    {ok, Node} = start_node(
+        NodeName,
+        Config,
+        " -config " ++ Config ++ " " ++ Config
+    ),
+    {ok, [[Config], [Config, Config]]} = rpc:call(Node, init, get_argument, [config]),
+    stop_node_nice(Node).
+
 %%%-----------------------------------------------------------------
 %%% Tests the 'shutdown_func' kernel config parameter
 %%%-----------------------------------------------------------------
-- 
2.16.4

openSUSE Build Service is sponsored by