aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2013-03-26 11:30:02 +0100
committerDan Gudmundsson <[email protected]>2013-03-26 11:30:02 +0100
commit61613acb659553004538ad13ded3d6bf343bf6a7 (patch)
tree7f612de6f889f19b483e8be4d18455826476977f /lib
parentb2ad2c6e0261a410b53e5be8f1ae38a12408aa8f (diff)
parent7e884c7d51bc8b0e03673998b242dc6edee3a28e (diff)
downloadotp-61613acb659553004538ad13ded3d6bf343bf6a7.tar.gz
otp-61613acb659553004538ad13ded3d6bf343bf6a7.tar.bz2
otp-61613acb659553004538ad13ded3d6bf343bf6a7.zip
Merge branch 'dgud/testcase_fixes' into maint
* dgud/testcase_fixes: Fix timers mnesia: Decrease test times Add debug printouts wx: Fix failing testcases stdlib: Ignore symlink tests on windows
Diffstat (limited to 'lib')
-rw-r--r--lib/mnesia/test/mnesia.spec2
-rw-r--r--lib/mnesia/test/mnesia_config_test.erl4
-rw-r--r--lib/mnesia/test/mnesia_durability_test.erl16
-rw-r--r--lib/mnesia/test/mnesia_examples_test.erl77
-rw-r--r--lib/mnesia/test/mnesia_recovery_test.erl14
-rw-r--r--lib/stdlib/test/escript_SUITE.erl2
-rw-r--r--lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl4
-rw-r--r--lib/wx/test/wx_basic_SUITE.erl4
-rw-r--r--lib/wx/test/wx_class_SUITE.erl2
9 files changed, 67 insertions, 58 deletions
diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec
index 653e515317..e4746fe14c 100644
--- a/lib/mnesia/test/mnesia.spec
+++ b/lib/mnesia/test/mnesia.spec
@@ -1,4 +1,4 @@
-{suites,"../mnesia_test",all}.
+{suites,"../mnesia_test",[mnesia_SUITE]}.
{skip_cases,"../mnesia_test",mnesia_measure_test,
[ram_meter],
"Takes to long time"}.
diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl
index f0f3053ebf..6baf86a4a5 100644
--- a/lib/mnesia/test/mnesia_config_test.erl
+++ b/lib/mnesia/test/mnesia_config_test.erl
@@ -596,8 +596,8 @@ dump_log_load_regulation(Config) when is_list(Config) ->
{n_branches, length(Nodes) * 10},
{n_accounts_per_branch, 5},
{replica_type, disc_copies},
- {stop_after, timer:seconds(30)},
- {report_interval, timer:seconds(10)},
+ {stop_after, timer:seconds(15)},
+ {report_interval, timer:seconds(3)},
{use_running_mnesia, true},
{reuse_history_id, true}],
diff --git a/lib/mnesia/test/mnesia_durability_test.erl b/lib/mnesia/test/mnesia_durability_test.erl
index 2fee72f066..1de62a7d25 100644
--- a/lib/mnesia/test/mnesia_durability_test.erl
+++ b/lib/mnesia/test/mnesia_durability_test.erl
@@ -100,14 +100,14 @@ load_latest_data(Config) when is_list(Config) ->
?match([], mnesia_test_lib:start_mnesia([N1], [])),
%% Should wait for N2
- ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])),
+ ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])),
?match([], mnesia_test_lib:start_mnesia([N3], [])),
- ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])),
+ ?match({timeout, [t1]}, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])),
?match([], mnesia_test_lib:start_mnesia([N2], [])),
- ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 3000])),
- ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 3000])),
+ ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 10000])),
+ ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 10000])),
%% We should find the record
?match([Rec2], rpc:call(N1, mnesia, dirty_read, [t1, test])),
?match([Rec2], rpc:call(N2, mnesia, dirty_read, [t1, test])),
@@ -124,12 +124,12 @@ load_latest_data(Config) when is_list(Config) ->
?match([], mnesia_test_lib:start_mnesia([N2], [])),
%% Should wait for N1
- ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 2000])),
+ ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])),
?match([], mnesia_test_lib:start_mnesia([N3], [])),
- ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 2000])),
+ ?match({timeout, [t1]}, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])),
?match([], mnesia_test_lib:start_mnesia([N1], [])),
- ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 1000])),
- ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 1000])),
+ ?match(ok, rpc:call(N2, mnesia, wait_for_tables, [[t1], 10000])),
+ ?match(ok, rpc:call(N1, mnesia, wait_for_tables, [[t1], 10000])),
%% We should find the record
?match([Rec1], rpc:call(N1, mnesia, dirty_read, [t1, test])),
?match([Rec1], rpc:call(N2, mnesia, dirty_read, [t1, test])),
diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl
index 373d47a05a..219f358fdb 100644
--- a/lib/mnesia/test/mnesia_examples_test.erl
+++ b/lib/mnesia/test/mnesia_examples_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-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
@@ -34,32 +34,6 @@ end_per_testcase(Func, Conf) ->
delete_schema],
N, Config, ?FILE, ?LINE)).
-opt_net_load(ExampleMod) ->
- opt_net_load([node() | nodes()], ExampleMod, ok).
-
-opt_net_load([Node | Nodes], ExampleMod, Res) ->
- case rpc:call(Node, ?MODULE, opt_load, [ExampleMod]) of
- {module, ExampleMod} ->
- opt_net_load(Nodes, ExampleMod, Res);
- {error, Reason} ->
- Error = {opt_net_load, ExampleMod, Node, Reason},
- opt_net_load(Nodes, ExampleMod, {error, Error});
- {badrpc, Reason} ->
- Error = {opt_net_load, ExampleMod, Node, Reason},
- opt_net_load(Nodes, ExampleMod, {error, Error})
- end;
-opt_net_load([], _ExampleMod, Res) ->
- Res.
-
-opt_load(Mod) ->
- case code:is_loaded(Mod) of
- {file, _} ->
- {module, Mod};
- false ->
- Abs = filename:join([code:lib_dir(mnesia), examples, Mod]),
- code:load_abs(Abs)
- end.
-
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
all() ->
[bup, company, meter, {group, tpcb}].
@@ -95,49 +69,49 @@ replica_test(suite) -> [];
replica_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(replica_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(replica_test, ram_copies))).
sticky_replica_test(suite) -> [];
sticky_replica_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(sticky_replica_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(sticky_replica_test, ram_copies))).
dist_test(suite) -> [];
dist_test(Config) when is_list(Config) ->
?init(3, [{tc_timeout, timer:minutes(10)} | Config]),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(dist_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(dist_test, ram_copies))).
conflict_test(suite) -> [];
conflict_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(conflict_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(conflict_test, ram_copies))).
frag_test(suite) -> [];
frag_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(frag_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(frag_test, ram_copies))).
frag2_test(suite) -> [];
frag2_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(frag2_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(frag2_test, ram_copies))).
remote_test(suite) -> [];
remote_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(remote_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(remote_test, ram_copies))).
remote_frag2_test(suite) -> [];
remote_frag2_test(Config) when is_list(Config) ->
?init(3, Config),
opt_net_load(mnesia_tpcb),
- ?match({ok, _}, mnesia_tpcb:start(mnesia_tpcb:config(remote_frag2_test, ram_copies))).
+ ?match({ok, _}, mnesia_tpcb:start(config(remote_frag2_test, ram_copies))).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
meter(doc) ->
@@ -149,4 +123,37 @@ meter(Config) when is_list(Config) ->
opt_net_load(mnesia_meter),
?match(ok, mnesia_meter:go(ram_copies, [N])).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+config(Test, Type) ->
+ Config0 = mnesia_tpcb:config(Test, Type),
+ %% Cut the times, the idea is to test the example and configuration
+ %% not running the test a long time
+ Config1 = lists:keyreplace(stop_after, 1, Config0, {stop_after, 6000}),
+ lists:keyreplace(report_interval, 1, Config1, {report_interval, 1000}).
+
+opt_net_load(ExampleMod) ->
+ opt_net_load([node() | nodes()], ExampleMod, ok).
+
+opt_net_load([Node | Nodes], ExampleMod, Res) ->
+ case rpc:call(Node, ?MODULE, opt_load, [ExampleMod]) of
+ {module, ExampleMod} ->
+ opt_net_load(Nodes, ExampleMod, Res);
+ {error, Reason} ->
+ Error = {opt_net_load, ExampleMod, Node, Reason},
+ opt_net_load(Nodes, ExampleMod, {error, Error});
+ {badrpc, Reason} ->
+ Error = {opt_net_load, ExampleMod, Node, Reason},
+ opt_net_load(Nodes, ExampleMod, {error, Error})
+ end;
+opt_net_load([], _ExampleMod, Res) ->
+ Res.
+opt_load(Mod) ->
+ case code:is_loaded(Mod) of
+ {file, _} ->
+ {module, Mod};
+ false ->
+ Abs = filename:join([code:lib_dir(mnesia), examples, Mod]),
+ code:load_abs(Abs)
+ end.
diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl
index c4910a4b11..0d0ad32fb0 100644
--- a/lib/mnesia/test/mnesia_recovery_test.erl
+++ b/lib/mnesia/test/mnesia_recovery_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2012. 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
@@ -607,7 +607,7 @@ explicit_stop_during_snmp(Config) when is_list(Config) ->
Do_trans_Pid1 = spawn_link(Node2, ?MODULE, do_trans_loop, [Tab, self()]),
Do_trans_Pid2 = spawn_link(?MODULE, do_trans_loop, [Tab, self()]),
- Start_stop_Pid = spawn_link(?MODULE, start_stop, [Node1, 10, self()]),
+ Start_stop_Pid = spawn_link(?MODULE, start_stop, [Node1, 5, self()]),
receive
test_done ->
ok
@@ -631,13 +631,13 @@ do_trans_loop2(Tab, Father) ->
end,
case mnesia:transaction(Trans) of
{atomic, ok} ->
- timer:sleep(200),
+ timer:sleep(100),
do_trans_loop2(Tab, Father);
{aborted, {node_not_running, N}} when N == node() ->
- timer:sleep(200),
+ timer:sleep(100),
do_trans_loop2(Tab, Father);
{aborted, {no_exists, Tab}} ->
- timer:sleep(200),
+ timer:sleep(100),
do_trans_loop2(Tab, Father);
Else ->
?error("Transaction failed: ~p ~n", [Else]),
@@ -649,9 +649,9 @@ start_stop(_Node1, 0, Father) ->
Father ! test_done,
exit(shutdown);
start_stop(Node1, N, Father) when N > 0->
- timer:sleep(timer:seconds(5)),
- ?match(stopped, rpc:call(Node1, mnesia, stop, [])),
timer:sleep(timer:seconds(2)),
+ ?match(stopped, rpc:call(Node1, mnesia, stop, [])),
+ timer:sleep(timer:seconds(1)),
?match([], mnesia_test_lib:start_mnesia([Node1])),
start_stop(Node1, N-1, Father).
diff --git a/lib/stdlib/test/escript_SUITE.erl b/lib/stdlib/test/escript_SUITE.erl
index b6cdd0a9c7..eebfec3336 100644
--- a/lib/stdlib/test/escript_SUITE.erl
+++ b/lib/stdlib/test/escript_SUITE.erl
@@ -615,7 +615,7 @@ archive_script_file_access(Config) when is_list(Config) ->
%% 3. If symlinks are supported, run one of the scripts via a symlink.
%%
%% This is in order to test error b) described above this test case.
- case file:read_link(Symlink2) of
+ case element(1,os:type()) =:= win32 orelse file:read_link(Symlink2) of
{ok,_} ->
run(PrivDir, "./" ++ SymlinkName2 ++ " " ++ ScriptName2,
[<<"ExitCode:0">>]);
diff --git a/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl b/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl
index b03c8ba70d..523621e4f3 100644
--- a/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl
+++ b/lib/stdlib/test/escript_SUITE_data/archive_script_file_access/archive_script_file_access.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2012. All Rights Reserved.
+%% Copyright Ericsson AB 2012-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
@@ -56,7 +56,7 @@ main([RelArchiveFile]) ->
%% If symlinks are supported on this platform...
RelSymlinkArchiveFile = "symlink_to_" ++ RelArchiveFile,
- case file:read_link(RelSymlinkArchiveFile) of
+ case element(1,os:type()) =:= win32 orelse file:read_link(RelSymlinkArchiveFile) of
{ok,_} ->
DotSlashSymlinkArchiveFile = "./" ++ RelSymlinkArchiveFile,
AbsSymlinkArchiveFile=filename:join(filename:dirname(AbsArchiveFile),
diff --git a/lib/wx/test/wx_basic_SUITE.erl b/lib/wx/test/wx_basic_SUITE.erl
index cf17818a9d..d55a037599 100644
--- a/lib/wx/test/wx_basic_SUITE.erl
+++ b/lib/wx/test/wx_basic_SUITE.erl
@@ -2,7 +2,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-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
@@ -100,6 +100,7 @@ several_apps(Config) ->
|| N <- lists:seq(1,4)],
process_flag(trap_exit,true),
?m_multi_receive([{complete,Pid} || Pid <- Pids]),
+ [Pid ! quit || Pid <- Pids],
case wx_test_lib:user_available(Config) of
true ->
receive {'EXIT',_,foo} -> ok end;
@@ -118,6 +119,7 @@ several_apps(Parent, N, Config) ->
#wx{obj=Frame, event=#wxSize{}} ->
Parent ! {complete, self()}
end,
+ receive quit -> ok end,
wx_test_lib:wx_destroy(Frame, Config),
exit(foo).
diff --git a/lib/wx/test/wx_class_SUITE.erl b/lib/wx/test/wx_class_SUITE.erl
index 4186d73c88..7c3eda0be1 100644
--- a/lib/wx/test/wx_class_SUITE.erl
+++ b/lib/wx/test/wx_class_SUITE.erl
@@ -140,7 +140,7 @@ treeCtrl(Config) ->
?m({true, {_,Y1,_,_}} when Y1 > Y0, wxTreeCtrl:getBoundingRect(Tree, Item2)),
?m({Item1, _}, wxTreeCtrl:hitTest(Tree, {X0+W0 div 2, Y0+H0 div 2})),
?m(true, wxTreeCtrl:isTreeItemIdOk(Item1)),
- ?m({0, _}, wxTreeCtrl:hitTest(Tree, {X0+W0 div 2, Y0+H0+H0})),
+ ?m({0, _}, wxTreeCtrl:hitTest(Tree, {X0+W0+W0, Y0+H0+4*H0})),
?m(false, wxTreeCtrl:isTreeItemIdOk(0)),
wxFrame:connect(Tree, command_tree_item_expanded),