diff options
Diffstat (limited to 'lib/mnesia')
-rw-r--r-- | lib/mnesia/doc/src/company.ps | 213 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia.spec | 2 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia_config_test.erl | 4 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia_durability_test.erl | 16 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia_examples_test.erl | 77 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia_recovery_test.erl | 14 |
6 files changed, 60 insertions, 266 deletions
diff --git a/lib/mnesia/doc/src/company.ps b/lib/mnesia/doc/src/company.ps deleted file mode 100644 index 64a45d07f3..0000000000 --- a/lib/mnesia/doc/src/company.ps +++ /dev/null @@ -1,213 +0,0 @@ -%!PS-Adobe-2.0 -%%Title: company.fig -%%Creator: fig2dev Version 3.1 Patchlevel 2 -%%CreationDate: Thu Oct 31 18:09:46 1996 -%%For: klacke@gin (Claes Wikstrom,EUA/SU) -%Magnification: 0.70 -%%Orientation: Portrait -%%BoundingBox: 79 343 516 498 -%%Pages: 1 -%%BeginSetup -%%IncludeFeature: *PageSize A4 -%%EndSetup -%%EndComments -/$F2psDict 200 dict def -$F2psDict begin -$F2psDict /mtrx matrix put -/col-1 {0 setgray} bind def -/col0 {0.000 0.000 0.000 srgb} bind def -/col1 {0.000 0.000 1.000 srgb} bind def -/col2 {0.000 1.000 0.000 srgb} bind def -/col3 {0.000 1.000 1.000 srgb} bind def -/col4 {1.000 0.000 0.000 srgb} bind def -/col5 {1.000 0.000 1.000 srgb} bind def -/col6 {1.000 1.000 0.000 srgb} bind def -/col7 {1.000 1.000 1.000 srgb} bind def -/col8 {0.000 0.000 0.560 srgb} bind def -/col9 {0.000 0.000 0.690 srgb} bind def -/col10 {0.000 0.000 0.820 srgb} bind def -/col11 {0.530 0.810 1.000 srgb} bind def -/col12 {0.000 0.560 0.000 srgb} bind def -/col13 {0.000 0.690 0.000 srgb} bind def -/col14 {0.000 0.820 0.000 srgb} bind def -/col15 {0.000 0.560 0.560 srgb} bind def -/col16 {0.000 0.690 0.690 srgb} bind def -/col17 {0.000 0.820 0.820 srgb} bind def -/col18 {0.560 0.000 0.000 srgb} bind def -/col19 {0.690 0.000 0.000 srgb} bind def -/col20 {0.820 0.000 0.000 srgb} bind def -/col21 {0.560 0.000 0.560 srgb} bind def -/col22 {0.690 0.000 0.690 srgb} bind def -/col23 {0.820 0.000 0.820 srgb} bind def -/col24 {0.500 0.190 0.000 srgb} bind def -/col25 {0.630 0.250 0.000 srgb} bind def -/col26 {0.750 0.380 0.000 srgb} bind def -/col27 {1.000 0.500 0.500 srgb} bind def -/col28 {1.000 0.630 0.630 srgb} bind def -/col29 {1.000 0.750 0.750 srgb} bind def -/col30 {1.000 0.880 0.880 srgb} bind def -/col31 {1.000 0.840 0.000 srgb} bind def - -end -save -55.0 585.5 translate -1 -1 scale - -/cp {closepath} bind def -/ef {eofill} bind def -/gr {grestore} bind def -/gs {gsave} bind def -/sa {save} bind def -/rs {restore} bind def -/l {lineto} bind def -/m {moveto} bind def -/rm {rmoveto} bind def -/n {newpath} bind def -/s {stroke} bind def -/sh {show} bind def -/slc {setlinecap} bind def -/slj {setlinejoin} bind def -/slw {setlinewidth} bind def -/srgb {setrgbcolor} bind def -/rot {rotate} bind def -/sc {scale} bind def -/sd {setdash} bind def -/ff {findfont} bind def -/sf {setfont} bind def -/scf {scalefont} bind def -/sw {stringwidth} bind def -/tr {translate} bind def -/tnt {dup dup currentrgbcolor - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add - 4 -2 roll dup 1 exch sub 3 -1 roll mul add srgb} - bind def -/shd {dup dup currentrgbcolor 4 -2 roll mul 4 -2 roll mul - 4 -2 roll mul srgb} bind def - /DrawEllipse { - /endangle exch def - /startangle exch def - /yrad exch def - /xrad exch def - /y exch def - /x exch def - /savematrix mtrx currentmatrix def - x y tr xrad yrad sc 0 0 1 startangle endangle arc - closepath - savematrix setmatrix - } def - -/$F2psBegin {$F2psDict begin /$F2psEnteredState save def} def -/$F2psEnd {$F2psEnteredState restore end} def -%%EndProlog - -$F2psBegin -10 setmiterlimit -n 0 842 m 0 0 l 595 0 l 595 842 l cp clip - 0.04200 0.04200 sc -%%Page: 1 1 -7.500 slw -% Polyline -n 8550 2700 m 10950 2700 l 10950 3150 l 8550 3150 l cp gs col-1 s gr -/Times-Roman ff 180.00 scf sf -8850 3000 m -gs 1 -1 sc (Project) col-1 sh gr -% Polyline -n 4950 2700 m 7350 2700 l 7350 3150 l 4950 3150 l cp gs col-1 s gr -/Times-Roman ff 180.00 scf sf -5325 3000 m -gs 1 -1 sc (Employee) col-1 sh gr -% Polyline -n 1275 2775 m 3675 2775 l 3675 3225 l 1275 3225 l cp gs col-1 s gr -/Times-Roman ff 180.00 scf sf -1650 3075 m -gs 1 -1 sc (Dept) col-1 sh gr -% Polyline -n 600 5100 m 1425 5700 l 2325 5100 l 1425 4500 l 600 5100 l gs col-1 s gr -/Times-Roman ff 180.00 scf sf -1125 5175 m -gs 1 -1 sc (Manager) col-1 sh gr -/Times-Roman ff 180.00 scf sf -9600 5175 m -gs 1 -1 sc (In_proj) col-1 sh gr -% Polyline -n 9000 5100 m 9825 5700 l 10725 5100 l 9825 4500 l 9000 5100 l gs col-1 s gr -% Ellipse -n 5287 2325 262 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 5812 2325 262 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 6337 2325 262 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 6862 2325 262 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 4612 2325 413 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 7537 2325 413 225 0 360 DrawEllipse gs col-1 s gr - -% Polyline -n 4800 2550 m 5925 2700 l gs col-1 s gr -% Polyline -n 5475 2550 m 5850 2700 l gs col-1 s gr -% Polyline -n 5850 2550 m 5850 2700 l gs col-1 s gr -% Polyline -n 6300 2550 m 5850 2700 l gs col-1 s gr -% Polyline -n 6750 2550 m 5850 2700 l gs col-1 s gr -% Polyline -n 7275 2550 m 5925 2700 l gs col-1 s gr -/Times-Roman ff 180.00 scf sf -4350 2400 m -gs 1 -1 sc (emp_no name salary sex phone room_no) col-1 sh gr -/Times-Roman ff 180.00 scf sf -3900 5175 m -gs 1 -1 sc (At_dep) col-1 sh gr -% Polyline -n 3323 5135 m 4148 5735 l 5048 5135 l 4148 4535 l 3323 5135 l gs col-1 s gr -% Ellipse -n 1875 2287 600 187 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 3075 2287 600 187 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 8850 2325 450 225 0 360 DrawEllipse gs col-1 s gr - -% Ellipse -n 9750 2325 450 225 0 360 DrawEllipse gs col-1 s gr - -% Polyline -n 1575 3225 m 600 5100 l gs col-1 s gr -% Polyline -n 2325 5100 m 5250 3150 l gs col-1 s gr -% Polyline -n 5850 3150 m 5025 5175 l gs col-1 s gr -% Polyline -n 3300 5100 m 2550 3225 l gs col-1 s gr -% Polyline -n 7050 3150 m 9000 5100 l gs col-1 s gr -% Polyline -n 10725 5100 m 9825 3150 l gs col-1 s gr -% Polyline -n 1875 2475 m 2400 2775 l gs col-1 s gr -% Polyline -n 3075 2475 m 2400 2775 l gs col-1 s gr -% Polyline -n 9000 2550 m 9750 2700 l gs col-1 s gr -% Polyline -n 9750 2550 m 9675 2700 l gs col-1 s gr -/Times-Roman ff 180.00 scf sf -1575 2325 m -gs 1 -1 sc ( id name) col-1 sh gr -/Times-Roman ff 180.00 scf sf -8775 2400 m -gs 1 -1 sc (Name number ) col-1 sh gr -showpage -$F2psEnd -rs 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). |