aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common_test')
-rw-r--r--lib/common_test/test/ct_config_SUITE.erl3
-rw-r--r--lib/common_test/test/ct_error_SUITE.erl24
-rw-r--r--lib/common_test/test/ct_event_handler_SUITE.erl10
-rw-r--r--lib/common_test/test/ct_groups_test_1_SUITE.erl25
-rw-r--r--lib/common_test/test/ct_groups_test_2_SUITE.erl8
-rw-r--r--lib/common_test/test/ct_hooks_SUITE.erl5
-rw-r--r--lib/common_test/test/ct_master_SUITE.erl7
-rw-r--r--lib/common_test/test/ct_misc_1_SUITE.erl3
-rw-r--r--lib/common_test/test/ct_repeat_1_SUITE.erl3
-rw-r--r--lib/common_test/test/ct_sequence_1_SUITE.erl3
-rw-r--r--lib/common_test/test/ct_skip_SUITE.erl10
-rw-r--r--lib/common_test/test/ct_smoke_test_SUITE.erl39
-rw-r--r--lib/common_test/test/ct_test_server_if_1_SUITE.erl5
-rw-r--r--lib/common_test/test/ct_test_support.erl87
-rw-r--r--lib/common_test/test/ct_testspec_1_SUITE.erl11
15 files changed, 154 insertions, 89 deletions
diff --git a/lib/common_test/test/ct_config_SUITE.erl b/lib/common_test/test/ct_config_SUITE.erl
index b6b50f33e0..8ce75f582a 100644
--- a/lib/common_test/test/ct_config_SUITE.erl
+++ b/lib/common_test/test/ct_config_SUITE.erl
@@ -174,7 +174,8 @@ run_test(Name, Config, CTConfig, SuiteNames)->
TestEvents = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(Name,
reformat_events(TestEvents, ?eh),
- ?config(config_dir, Config)),
+ ?config(config_dir, Config),
+ Opts),
ExpEvents = events_to_check(Name),
ok = ct_test_support:verify_events(ExpEvents, TestEvents, Config).
diff --git a/lib/common_test/test/ct_error_SUITE.erl b/lib/common_test/test/ct_error_SUITE.erl
index 6d0e2efab7..e9cf0eead9 100644
--- a/lib/common_test/test/ct_error_SUITE.erl
+++ b/lib/common_test/test/ct_error_SUITE.erl
@@ -102,8 +102,9 @@ cfg_error(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(cfg_error,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(cfg_error),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -120,8 +121,9 @@ lib_error(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(lib_error,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(lib_error),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -138,8 +140,9 @@ no_compile(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(no_compile,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(no_compile),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -156,7 +159,8 @@ timetrap_end_conf(Config) when is_list(Config) ->
ct_test_support:log_events(timetrap_end_conf,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(timetrap_end_conf),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -176,7 +180,8 @@ timetrap_normal(Config) when is_list(Config) ->
ct_test_support:log_events(timetrap_normal,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(timetrap_normal),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -198,7 +203,8 @@ timetrap_extended(Config) when is_list(Config) ->
ct_test_support:log_events(timetrap_extended,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(timetrap_extended),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_event_handler_SUITE.erl b/lib/common_test/test/ct_event_handler_SUITE.erl
index 5ef04c0e75..b534a7141d 100644
--- a/lib/common_test/test/ct_event_handler_SUITE.erl
+++ b/lib/common_test/test/ct_event_handler_SUITE.erl
@@ -102,8 +102,9 @@ start_stop(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(start_stop,
- ct_test_support:reformat(Events, eh_A),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, eh_A),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents =
[{eh_A,start_logging,{'DEF','RUNDIR'}},
@@ -148,8 +149,9 @@ results(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(results,
- ct_test_support:reformat(Events, eh_A),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, eh_A),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents =
[{eh_A,start_logging,{'DEF','RUNDIR'}},
diff --git a/lib/common_test/test/ct_groups_test_1_SUITE.erl b/lib/common_test/test/ct_groups_test_1_SUITE.erl
index 7775d8a55d..e520a72227 100644
--- a/lib/common_test/test/ct_groups_test_1_SUITE.erl
+++ b/lib/common_test/test/ct_groups_test_1_SUITE.erl
@@ -89,8 +89,9 @@ groups_suite_1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_suite_1,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(groups_suite_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -109,8 +110,9 @@ groups_suite_2(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_suite_2,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(groups_suite_2),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -130,8 +132,9 @@ groups_suites_1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_suites_1,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(groups_suites_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -150,8 +153,9 @@ groups_dir_1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_dir_1,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(groups_dir_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -170,8 +174,9 @@ groups_dirs_1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_dirs_1,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(groups_dirs_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_groups_test_2_SUITE.erl b/lib/common_test/test/ct_groups_test_2_SUITE.erl
index 2ae63f4f99..65c7e75080 100644
--- a/lib/common_test/test/ct_groups_test_2_SUITE.erl
+++ b/lib/common_test/test/ct_groups_test_2_SUITE.erl
@@ -88,8 +88,9 @@ missing_conf(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(missing_conf_SUITE,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(missing_conf),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -108,7 +109,8 @@ repeat_1(Config) when is_list(Config) ->
ct_test_support:log_events(repeat_1,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(repeat_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_hooks_SUITE.erl b/lib/common_test/test/ct_hooks_SUITE.erl
index 64f4e277ff..32b8d9249f 100644
--- a/lib/common_test/test/ct_hooks_SUITE.erl
+++ b/lib/common_test/test/ct_hooks_SUITE.erl
@@ -225,8 +225,9 @@ do_test(Tag, SuiteWildCard, CTHs, Config, Res, EC) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(Tag,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(Tag, EC),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_master_SUITE.erl b/lib/common_test/test/ct_master_SUITE.erl
index e89b6f7de6..1471cc1e0c 100644
--- a/lib/common_test/test/ct_master_SUITE.erl
+++ b/lib/common_test/test/ct_master_SUITE.erl
@@ -119,8 +119,9 @@ ct_master_test(Config) when is_list(Config)->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(groups_suite_1,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ PrivDir, []),
+
find_events(NodeNames, [{tc_start,{master_SUITE,init_per_suite}},
{tc_start,{master_SUITE,first_testcase}},
{tc_start,{master_SUITE,second_testcase}},
@@ -174,7 +175,7 @@ make_spec(DataDir, FileName, NodeNames, Suites, Config)->
ct_test_support:write_testspec(N++Include++EH++C++S++LD++NS, FileName).
-get_log_dir({win32,_},PrivDir, NodeName)->
+get_log_dir({win32,_}, _PrivDir, NodeName)->
case filelib:is_dir(?TEMP_DIR) of
false ->
file:make_dir(?TEMP_DIR);
diff --git a/lib/common_test/test/ct_misc_1_SUITE.erl b/lib/common_test/test/ct_misc_1_SUITE.erl
index a8bd2c2189..cb17af9ab5 100644
--- a/lib/common_test/test/ct_misc_1_SUITE.erl
+++ b/lib/common_test/test/ct_misc_1_SUITE.erl
@@ -111,7 +111,8 @@ beam_me_up(Config) when is_list(Config) ->
ct_test_support:log_events(beam_me_up,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(beam_me_up, 1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_repeat_1_SUITE.erl b/lib/common_test/test/ct_repeat_1_SUITE.erl
index c665e7b250..4e842bd6d6 100644
--- a/lib/common_test/test/ct_repeat_1_SUITE.erl
+++ b/lib/common_test/test/ct_repeat_1_SUITE.erl
@@ -159,7 +159,8 @@ execute(TestCase, SuiteName, Group, Config) ->
ct_test_support:log_events(TestCase,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(TestCase),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_sequence_1_SUITE.erl b/lib/common_test/test/ct_sequence_1_SUITE.erl
index c7650b169c..5facf90656 100644
--- a/lib/common_test/test/ct_sequence_1_SUITE.erl
+++ b/lib/common_test/test/ct_sequence_1_SUITE.erl
@@ -132,7 +132,8 @@ execute(TestCase, SuiteName, Group, Config) ->
ct_test_support:log_events(TestCase,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(TestCase),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_skip_SUITE.erl b/lib/common_test/test/ct_skip_SUITE.erl
index 62c5f10b7c..4ba4479208 100644
--- a/lib/common_test/test/ct_skip_SUITE.erl
+++ b/lib/common_test/test/ct_skip_SUITE.erl
@@ -99,8 +99,9 @@ auto_skip(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(auto_skip,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(auto_skip),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -122,8 +123,9 @@ user_skip(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(user_skip,
- reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(user_skip),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_smoke_test_SUITE.erl b/lib/common_test/test/ct_smoke_test_SUITE.erl
index c3d49a5afa..49b38361e2 100644
--- a/lib/common_test/test/ct_smoke_test_SUITE.erl
+++ b/lib/common_test/test/ct_smoke_test_SUITE.erl
@@ -175,8 +175,9 @@ dir1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(dir1,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(dir1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -204,8 +205,9 @@ dir2(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(dir2,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(dir2),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -234,8 +236,9 @@ dir1_2(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(dir1_2,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(dir1_2),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -264,8 +267,8 @@ suite11(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(suite11,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(suite11),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -293,8 +296,8 @@ suite21(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(suite21,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(suite21),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -324,8 +327,8 @@ suite11_21(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(suite11_21,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(suite11_21),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -355,8 +358,8 @@ tc111(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(tc111,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(tc111),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -385,8 +388,8 @@ tc211(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(tc211,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(tc211),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -416,8 +419,8 @@ tc111_112(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(tc111_112,
- ct_test_support:reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ct_test_support:reformat(Events, ?eh),
+ ?config(priv_dir, Config), Opts),
TestEvents = events_to_check(tc111_112),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_test_server_if_1_SUITE.erl b/lib/common_test/test/ct_test_server_if_1_SUITE.erl
index 9d3e6a9e59..4471915e69 100644
--- a/lib/common_test/test/ct_test_server_if_1_SUITE.erl
+++ b/lib/common_test/test/ct_test_server_if_1_SUITE.erl
@@ -98,8 +98,9 @@ ts_if_1(Config) when is_list(Config) ->
Events = ct_test_support:get_events(ERPid, Config),
ct_test_support:log_events(ts_if_1,
- reformat(Events, ?eh),
- PrivDir),
+ reformat(Events, ?eh),
+ PrivDir,
+ Opts),
TestEvents = events_to_check(ts_if_1),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl
index b4f1a0e71f..de95f05004 100644
--- a/lib/common_test/test/ct_test_support.erl
+++ b/lib/common_test/test/ct_test_support.erl
@@ -32,7 +32,8 @@
run/2, run/4, get_opts/1, wait_for_ct_stop/1]).
-export([handle_event/2, start_event_receiver/1, get_events/2,
- verify_events/3, reformat/2, log_events/3]).
+ verify_events/3, reformat/2, log_events/4,
+ join_abs_dirs/2]).
-include_lib("kernel/include/file.hrl").
@@ -63,7 +64,6 @@ init_per_suite(Config, Level) ->
start_slave(Config,Level) ->
[_,Host] = string:tokens(atom_to_list(node()), "@"),
-
test_server:format(0, "Trying to start ~s~n", ["ct@"++Host]),
case slave:start(Host, ct, []) of
{error,Reason} ->
@@ -72,18 +72,19 @@ start_slave(Config,Level) ->
test_server:format(0, "Node ~p started~n", [CTNode]),
IsCover = test_server:is_cover(),
if IsCover ->
- cover:start(CTNode);
- true->
- ok
+ cover:start(CTNode);
+ true->
+ ok
end,
- DataDir = ?config(data_dir, Config),
- PrivDir = ?config(priv_dir, Config),
+
+ DataDir = proplists:get_value(data_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
%% PrivDir as well as directory of Test Server suites
%% have to be in code path on Common Test node.
[_ | Parts] = lists:reverse(filename:split(DataDir)),
TSDir = filename:join(lists:reverse(Parts)),
- AddPathDirs = case ?config(path_dirs, Config) of
+ AddPathDirs = case proplists:get_value(path_dirs, Config) of
undefined -> [];
Ds -> Ds
end,
@@ -110,8 +111,8 @@ start_slave(Config,Level) ->
%%% end_per_suite/1
end_per_suite(Config) ->
- CTNode = ?config(ct_node, Config),
- PrivDir = ?config(priv_dir, Config),
+ CTNode = proplists:get_value(ct_node, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
true = rpc:call(CTNode, code, del_path, [filename:join(PrivDir,"")]),
cover:stop(CTNode),
slave:stop(CTNode),
@@ -121,7 +122,9 @@ end_per_suite(Config) ->
%%% init_per_testcase/2
init_per_testcase(_TestCase, Config) ->
- {_,{_,LogDir}} = lists:keysearch(logdir, 1, get_opts(Config)),
+ Opts = get_opts(Config),
+ NetDir = proplists:get_value(net_dir, Opts),
+ LogDir = join_abs_dirs(NetDir, proplists:get_value(logdir, Opts)),
case lists:keysearch(master, 1, Config) of
false->
test_server:format("See Common Test logs here:\n\n"
@@ -139,7 +142,7 @@ init_per_testcase(_TestCase, Config) ->
%%% end_per_testcase/2
end_per_testcase(_TestCase, Config) ->
- CTNode = ?config(ct_node, Config),
+ CTNode = proplists:get_value(ct_node, Config),
case wait_for_ct_stop(CTNode) of
%% Common test was not stopped to we restart node.
false ->
@@ -169,7 +172,7 @@ write_testspec(TestSpec, TSFile) ->
%%%
get_opts(Config) ->
- PrivDir = ?config(priv_dir, Config),
+ PrivDir = proplists:get_value(priv_dir, Config),
TempDir = case os:getenv("TMP") of
false ->
case os:getenv("TEMP") of
@@ -195,15 +198,29 @@ get_opts(Config) ->
_ ->
TempDir
end,
- InitOpts = ?config(ct_opts, Config),
- [{logdir,LogDir} | InitOpts].
+
+ %% Copy test variables to app environment on new node
+ CtTestVars =
+ case init:get_argument(ct_test_vars) of
+ {ok,[Vars]} ->
+ [begin {ok,Ts,_} = erl_scan:string(Str++"."),
+ {ok,Expr} = erl_parse:parse_term(Ts),
+ Expr
+ end || Str <- Vars];
+ _ ->
+ []
+ end,
+ %% test_server:format("Test variables added to Config: ~p\n\n",
+ %% [CtTestVars]),
+ InitOpts = proplists:get_value(ct_opts, Config),
+ [{logdir,LogDir} | InitOpts ++ CtTestVars].
%%%-----------------------------------------------------------------
%%%
run(Opts, Config) ->
- CTNode = ?config(ct_node, Config),
- Level = ?config(trace_level, Config),
+ CTNode = proplists:get_value(ct_node, Config),
+ Level = proplists:get_value(trace_level, Config),
%% use ct interface
test_server:format(Level, "~n[RUN #1] Calling ct:run_test(~p) on ~p~n",
[Opts, CTNode]),
@@ -224,8 +241,8 @@ run(Opts, Config) ->
end.
run(M, F, A, Config) ->
- CTNode = ?config(ct_node, Config),
- Level = ?config(trace_level, Config),
+ CTNode = proplists:get_value(ct_node, Config),
+ Level = proplists:get_value(trace_level, Config),
test_server:format(Level, "~nCalling ~w:~w(~p) on ~p~n",
[M, F, A, CTNode]),
rpc:call(CTNode, M, F, A).
@@ -261,11 +278,11 @@ handle_event(EH, Event) ->
ok.
start_event_receiver(Config) ->
- CTNode = ?config(ct_node, Config),
+ CTNode = proplists:get_value(ct_node, Config),
spawn_link(CTNode, fun() -> er() end).
get_events(_, Config) ->
- CTNode = ?config(ct_node, Config),
+ CTNode = proplists:get_value(ct_node, Config),
{event_receiver,CTNode} ! {self(),get_events},
Events = receive {event_receiver,Evs} -> Evs end,
{event_receiver,CTNode} ! stop,
@@ -288,7 +305,7 @@ er_loop(Evs) ->
end.
verify_events(TEvs, Evs, Config) ->
- Node = ?config(ct_node, Config),
+ Node = proplists:get_value(ct_node, Config),
case catch verify_events1(TEvs, Evs, Node, Config) of
{'EXIT',Reason} ->
Reason;
@@ -931,14 +948,17 @@ match_data(Tuple1,Tuple2) when is_tuple(Tuple1),is_tuple(Tuple2) ->
match_data([],[]) ->
match.
-log_events(TC, Events, PrivDir) ->
- LogFile = filename:join(PrivDir, atom_to_list(TC)++".events"),
+
+log_events(TC, Events, EvLogDir, Opts) ->
+ LogFile = filename:join(EvLogDir, atom_to_list(TC)++".events"),
{ok,Dev} = file:open(LogFile, [write]),
io:format(Dev, "[~n", []),
log_events1(Events, Dev, " "),
file:close(Dev),
+ FullLogFile = join_abs_dirs(proplists:get_value(net_dir, Opts),
+ LogFile),
io:format("Events written to logfile: <a href=\"file://~s\">~s</a>~n",
- [LogFile,LogFile]),
+ [FullLogFile,FullLogFile]),
io:format(user, "Events written to logfile: ~p~n", [LogFile]).
log_events1(Evs, Dev, "") ->
@@ -1024,13 +1044,25 @@ reformat([], _EH) ->
%%%-----------------------------------------------------------------
%%% MISC HELP FUNCTIONS
+join_abs_dirs(undefined, Dir2) ->
+ Dir2;
+join_abs_dirs(Dir1, Dir2) ->
+ case filename:pathtype(Dir2) of
+ relative ->
+ filename:join(Dir1, Dir2);
+ _ ->
+ [_Abs|Parts] = filename:split(Dir2),
+ filename:join(Dir1, filename:join(Parts))
+ end.
+
create_tmp_logdir(Tmp) ->
LogDir = filename:join(Tmp,"ct"),
file:make_dir(LogDir),
LogDir.
delete_old_logs({win32,_}, Config) ->
- case {?config(priv_dir, Config),?config(logdir, get_opts(Config))} of
+ case {proplists:get_value(priv_dir, Config),
+ proplists:get_value(logdir, get_opts(Config))} of
{LogDir,LogDir} ->
ignore;
{_,LogDir} -> % using tmp for logs
@@ -1042,7 +1074,8 @@ delete_old_logs(_, Config) ->
false ->
ignore;
_ ->
- catch delete_dirs(?config(logdir, get_opts(Config)))
+ catch delete_dirs(proplists:get_value(logdir,
+ get_opts(Config)))
end.
delete_dirs(LogDir) ->
diff --git a/lib/common_test/test/ct_testspec_1_SUITE.erl b/lib/common_test/test/ct_testspec_1_SUITE.erl
index 9644143090..b6dcf63fdf 100644
--- a/lib/common_test/test/ct_testspec_1_SUITE.erl
+++ b/lib/common_test/test/ct_testspec_1_SUITE.erl
@@ -612,6 +612,12 @@ setup_and_execute(TCName, TestSpec, Config) ->
false -> [{spec,SpecFile},{label,TCName}]
end,
{Opts,ERPid} = setup(TestTerms, Config),
+
+ FullSpecFile = ct_test_support:join_abs_dirs(?config(net_dir, Opts),
+ SpecFile),
+ io:format("~nTest spec created here~n~n<a href=\"file://~s\">~s</a>~n",
+ [FullSpecFile,FullSpecFile]),
+
ok = ct_test_support:run(Opts, Config),
TestSpec1 = [{logdir,proplists:get_value(logdir,Opts)},
{label,proplists:get_value(label,TestTerms)} | TestSpec],
@@ -620,7 +626,8 @@ setup_and_execute(TCName, TestSpec, Config) ->
ct_test_support:log_events(TCName,
reformat(Events, ?eh),
- ?config(priv_dir, Config)),
+ ?config(priv_dir, Config),
+ Opts),
TestEvents = events_to_check(TCName),
ok = ct_test_support:verify_events(TestEvents, Events, Config).
@@ -631,8 +638,6 @@ create_spec_file(SpecDir, TCName, TestSpec) ->
{ok,Dev} = file:open(FileName, [write]),
[io:format(Dev, "~p.~n", [Term]) || Term <- TestSpec],
file:close(Dev),
- io:format("~nTest spec created here~n~n<a href=\"file://~s\">~s</a>~n",
- [FileName,FileName]),
FileName.
setup(Test, Config) when is_tuple(Test) ->