aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/test
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mnesia/test')
-rw-r--r--lib/mnesia/test/.gitignore9
-rw-r--r--lib/mnesia/test/Makefile9
-rw-r--r--lib/mnesia/test/mnesia.cover2
-rw-r--r--lib/mnesia/test/mnesia.spec99
-rw-r--r--lib/mnesia/test/mnesia_SUITE.erl263
-rw-r--r--lib/mnesia/test/mnesia_atomicity_test.erl131
-rw-r--r--lib/mnesia/test/mnesia_config_backup.erl2
-rw-r--r--lib/mnesia/test/mnesia_config_event.erl2
-rw-r--r--lib/mnesia/test/mnesia_config_test.erl116
-rw-r--r--lib/mnesia/test/mnesia_consistency_test.erl322
-rw-r--r--lib/mnesia/test/mnesia_cost.erl2
-rw-r--r--lib/mnesia/test/mnesia_dirty_access_test.erl167
-rw-r--r--lib/mnesia/test/mnesia_durability_test.erl107
-rw-r--r--lib/mnesia/test/mnesia_evil_backup.erl60
-rw-r--r--lib/mnesia/test/mnesia_evil_coverage_test.erl368
-rw-r--r--lib/mnesia/test/mnesia_examples_test.erl42
-rw-r--r--lib/mnesia/test/mnesia_frag_test.erl60
-rw-r--r--lib/mnesia/test/mnesia_inconsistent_database_test.erl2
-rw-r--r--lib/mnesia/test/mnesia_install_test.erl72
-rw-r--r--lib/mnesia/test/mnesia_isolation_test.erl152
-rw-r--r--lib/mnesia/test/mnesia_majority_test.erl186
-rw-r--r--lib/mnesia/test/mnesia_measure_test.erl149
-rw-r--r--lib/mnesia/test/mnesia_nice_coverage_test.erl22
-rw-r--r--lib/mnesia/test/mnesia_qlc_test.erl51
-rw-r--r--lib/mnesia/test/mnesia_recovery_test.erl245
-rw-r--r--lib/mnesia/test/mnesia_registry_test.erl23
-rw-r--r--lib/mnesia/test/mnesia_schema_recovery_test.erl166
-rw-r--r--lib/mnesia/test/mnesia_test_lib.erl98
-rw-r--r--lib/mnesia/test/mnesia_test_lib.hrl2
-rw-r--r--lib/mnesia/test/mnesia_tpcb.erl2
-rw-r--r--lib/mnesia/test/mnesia_trans_access_test.erl131
-rw-r--r--lib/mnesia/test/mt.erl16
32 files changed, 1514 insertions, 1564 deletions
diff --git a/lib/mnesia/test/.gitignore b/lib/mnesia/test/.gitignore
new file mode 100644
index 0000000000..1e9a9933ed
--- /dev/null
+++ b/lib/mnesia/test/.gitignore
@@ -0,0 +1,9 @@
+
+
+# Test generates
+MnesiaCore*
+Mnesia.*
+
+tempfile*
+mnesia_test_case_info
+test_log* \ No newline at end of file
diff --git a/lib/mnesia/test/Makefile b/lib/mnesia/test/Makefile
index a4f32e3f78..ae4c9626c7 100644
--- a/lib/mnesia/test/Makefile
+++ b/lib/mnesia/test/Makefile
@@ -1,7 +1,7 @@
#
# %CopyrightBegin%
#
-# Copyright Ericsson AB 1996-2009. All Rights Reserved.
+# Copyright Ericsson AB 1996-2011. 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
@@ -42,6 +42,7 @@ MODULES= \
mnesia_dirty_access_test \
mnesia_atomicity_test \
mnesia_consistency_test \
+ mnesia_majority_test \
mnesia_isolation_test \
mnesia_durability_test \
mnesia_recovery_test \
@@ -108,9 +109,9 @@ release_spec: opt
release_tests_spec: opt
$(INSTALL_DIR) $(RELSYSDIR)
- $(INSTALL_DATA) mnesia.spec mnesia.spec.vxworks $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR)
- $(INSTALL_PROGRAM) mt $(INSTALL_PROGS) $(RELSYSDIR)
-# chmod -f -R u+w $(RELSYSDIR)
+ $(INSTALL_DATA) mnesia.spec mnesia.cover $(ERL_FILES) $(HRL_FILES) $(RELSYSDIR)
+ $(INSTALL_SCRIPT) mt $(INSTALL_PROGS) $(RELSYSDIR)
+# chmod -R u+w $(RELSYSDIR)
# @tar cf - *_SUITE_data | (cd $(RELSYSDIR); tar xf -)
release_docs_spec:
diff --git a/lib/mnesia/test/mnesia.cover b/lib/mnesia/test/mnesia.cover
new file mode 100644
index 0000000000..66ffc06e89
--- /dev/null
+++ b/lib/mnesia/test/mnesia.cover
@@ -0,0 +1,2 @@
+{incl_app,mnesia,details}.
+
diff --git a/lib/mnesia/test/mnesia.spec b/lib/mnesia/test/mnesia.spec
index 596f8b917d..204d1519cb 100644
--- a/lib/mnesia/test/mnesia.spec
+++ b/lib/mnesia/test/mnesia.spec
@@ -1,23 +1,76 @@
-{topcase, {dir, "../mnesia_test"}}.
-{require_nodenames, 2}.
-{skip, {mnesia_measure_test, ram_meter, "Takes to long time"}}.
-{skip, {mnesia_measure_test, disc_meter, "Takes to long time"}}.
-{skip, {mnesia_measure_test, disc_only_meter, "Takes to long time"}}.
-{skip, {mnesia_measure_test, cost, "Takes to long time"}}.
-{skip, {mnesia_measure_test, dbn_meters, "Takes to long time"}}.
-{skip, {mnesia_measure_test, tpcb, "Takes to long time"}}.
-{skip, {mnesia_measure_test, prediction, "Not yet implemented"}}.
-{skip, {mnesia_measure_test, consumption, "Not yet implemented"}}.
-{skip, {mnesia_measure_test, scalability, "Not yet implemented"}}.
-{skip, {mnesia_measure_test, tpcb, "Takes too much time and memory"}}.
-{skip, {mnesia_measure_test, measure_all_api_functions, "Not yet implemented"}}.
-{skip, {mnesia_measure_test, mnemosyne_vs_mnesia_kernel, "Not yet implemented"}}.
-{skip, {mnesia_examples_test, company, "Not yet implemented"}}.
-{skip, {mnesia_config_test, ignore_fallback_at_startup, "Not yet implemented"}}.
-{skip, {mnesia_evil_backup, local_backup_checkpoint, "Not yet implemented"}}.
-{skip, {mnesia_config_test, max_wait_for_decision, "Not yet implemented"}}.
-{skip, {mnesia_recovery_test, after_full_disc_partition, "Not yet implemented"}}.
-{skip, {mnesia_recovery_test, system_upgrade, "Not yet implemented"}}.
-{skip, {mnesia_consistency_test, consistency_after_change_table_copy_type, "Not yet implemented"}}.
-{skip, {mnesia_consistency_test, consistency_after_transform_table, "Not yet implemented"}}.
-{skip, {mnesia_consistency_test, consistency_after_rename_of_node, "Not yet implemented"}}.
+{suites,"../mnesia_test",all}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [ram_meter],
+ "Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [disc_meter],
+ "Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [disc_only_meter],
+ "Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,[cost],"Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [dbn_meters],
+ "Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [ram_tpcb,disc_tpcb,disc_only_tpcb],
+ "Takes to long time"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [reader_disturbed_by_node_down,writer_disturbed_by_node_down,
+ reader_disturbed_by_node_up,writer_disturbed_by_node_up,
+ reader_disturbed_by_schema_ops,writer_disturbed_by_schema_ops,
+ reader_disturbed_by_checkpoint,writer_disturbed_by_checkpoint,
+ reader_disturbed_by_dump_log,writer_disturbed_by_dump_log,
+ reader_disturbed_by_backup,writer_disturbed_by_backup,
+ reader_disturbed_by_restore,writer_disturbed_by_restore,
+ reader_competing_with_reader,reader_competing_with_writer,
+ writer_competing_with_reader,writer_competing_with_writer],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [measure_resource_consumption,determine_resource_leakage],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [determine_system_limits,performance_at_min_config,
+ performance_at_max_config,performance_at_full_load,
+ resource_consumption_at_min_config,
+ resource_consumption_at_max_config,
+ resource_consumption_at_full_load],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [ram_tpcb,disc_tpcb,disc_only_tpcb],
+ "Takes too much time and memory"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [measure_all_api_functions],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_measure_test,
+ [mnemosyne_vs_mnesia_kernel],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_examples_test,
+ [company],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_config_test,
+ [ignore_fallback_at_startup],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_evil_backup,
+ [local_backup_checkpoint],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_config_test,
+ [max_wait_for_decision],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_recovery_test,
+ [after_full_disc_partition],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_recovery_test,
+ [system_upgrade],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_consistency_test,
+ [consistency_after_change_table_copy_type],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_consistency_test,
+ [consistency_after_transform_table_ram,
+ consistency_after_transform_table_disc,
+ consistency_after_transform_table_disc_only],
+ "Not yet implemented"}.
+{skip_cases,"../mnesia_test",mnesia_consistency_test,
+ [consistency_after_rename_of_node],
+ "Not yet implemented"}.
diff --git a/lib/mnesia/test/mnesia_SUITE.erl b/lib/mnesia/test/mnesia_SUITE.erl
index b28deaf330..2267a94164 100644
--- a/lib/mnesia/test/mnesia_SUITE.erl
+++ b/lib/mnesia/test/mnesia_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. 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
@@ -26,135 +26,124 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify that Mnesia really is a distributed real-time DBMS",
- "This is the test suite of the Mnesia DBMS. The test suite",
- "covers many aspects of usage and is indended to be developed",
- "incrementally. The test suite is divided into a hierarchy of test",
- "suites where the leafs actually implements the test cases.",
- "The intention of each test case and sub test suite can be",
- "read in comments where they are implemented or in worst cases",
- "from their long mnemonic names. ",
- "",
- "The most simple test case of them all is called 'silly'",
- "and is useful to run now and then, e.g. when some new fatal",
- "bug has been introduced. It may be run even if Mnesia is in",
- "such a bad shape that the test machinery cannot be used.",
- "NB! Invoke the function directly with mnesia_SUITE:silly()",
- "and do not involve the normal test machinery."];
-all(suite) ->
- [
- light,
- medium,
- heavy,
- clean_up_suite
- ].
+suite() -> [{ct_hooks,[{ts_install_cth,[{nodenames,2}]}]}].
+
+
+%% Verify that Mnesia really is a distributed real-time DBMS.
+%% This is the test suite of the Mnesia DBMS. The test suite
+%% covers many aspects of usage and is indended to be developed
+%% incrementally. The test suite is divided into a hierarchy of test
+%% suites where the leafs actually implements the test cases.
+%% The intention of each test case and sub test suite can be
+%% read in comments where they are implemented or in worst cases
+%% from their long mnemonic names.
+%%
+%% The most simple test case of them all is called 'silly'
+%% and is useful to run now and then, e.g. when some new fatal
+%% bug has been introduced. It may be run even if Mnesia is in
+%% such a bad shape that the test machinery cannot be used.
+%% NB! Invoke the function directly with mnesia_SUITE:silly()
+%% and do not involve the normal test machinery.
+
+all() ->
+ [{group, light}, {group, medium}, {group, heavy},
+ clean_up_suite].
+
+groups() ->
+ %% The 'light' test suite runs a selected set of test suites and is
+ %% intended to be the smallest test suite that is meaningful
+ %% to run. It starts with an installation test (which in essence is the
+ %% 'silly' test case) and then it covers all functions in the API in
+ %% various depths. All configuration parameters and examples are also
+ %% covered.
+ [{light, [],
+ [{group, install}, {group, nice}, {group, evil},
+ {group, mnesia_frag_test, light}, {group, qlc},
+ {group, registry}, {group, config}, {group, examples}]},
+ {install, [], [{mnesia_install_test, all}]},
+ {nice, [], [{mnesia_nice_coverage_test, all}]},
+ {evil, [], [{mnesia_evil_coverage_test, all}]},
+ {qlc, [], [{mnesia_qlc_test, all}]},
+ {registry, [], [{mnesia_registry_test, all}]},
+ {config, [], [{mnesia_config_test, all}]},
+ {examples, [], [{mnesia_examples_test, all}]},
+ %% The 'medium' test suite verfies the ACID (atomicity, consistency
+ %% isolation and durability) properties and various recovery scenarios
+ %% These tests may take quite while to run.
+ {medium, [],
+ [{group, install}, {group, atomicity},
+ {group, isolation}, {group, durability},
+ {group, recovery}, {group, consistency},
+ {group, majority},
+ {group, mnesia_frag_test, medium}]},
+ {atomicity, [], [{mnesia_atomicity_test, all}]},
+ {isolation, [], [{mnesia_isolation_test, all}]},
+ {durability, [], [{mnesia_durability_test, all}]},
+ {recovery, [], [{mnesia_recovery_test, all}]},
+ {consistency, [], [{mnesia_consistency_test, all}]},
+ {majority, [], [{mnesia_majority_test, all}]},
+ %% The 'heavy' test suite runs some resource consuming tests and
+ %% benchmarks
+ {heavy, [], [{group, measure}]},
+ {measure, [], [{mnesia_measure_test, all}]},
+ {prediction, [],
+ [{group, mnesia_measure_test, prediction}]},
+ {fairness, [],
+ [{group, mnesia_measure_test, fairness}]},
+ {benchmarks, [],
+ [{group, mnesia_measure_test, benchmarks}]},
+ {consumption, [],
+ [{group, mnesia_measure_test, consumption}]},
+ {scalability, [],
+ [{group, mnesia_measure_test, scalability}]},
+ %% This test suite is an extract of the grand Mnesia suite
+ %% it contains OTP R4B specific test cases
+ {otp_r4b, [],
+ [{mnesia_config_test, access_module},
+ {mnesia_config_test, dump_log_load_regulation},
+ {mnesia_config_test, embedded_mnemosyne},
+ {mnesia_config_test, ignore_fallback_at_startup},
+ {mnesia_config_test, max_wait_for_decision},
+ {mnesia_consistency_test, consistency_after_restore},
+ {mnesia_evil_backup, restore},
+ {mnesia_evil_coverage_test, offline_set_master_nodes},
+ {mnesia_evil_coverage_test, record_name},
+ {mnesia_evil_coverage_test, user_properties},
+ {mnesia_registry_test, all}, {group, otp_2363}]},
+ %% Index on disc only tables
+ {otp_2363, [],
+ [{mnesia_dirty_access_test,
+ dirty_index_match_object_disc_only},
+ {mnesia_dirty_access_test, dirty_index_read_disc_only},
+ {mnesia_dirty_access_test,
+ dirty_index_update_bag_disc_only},
+ {mnesia_dirty_access_test,
+ dirty_index_update_set_disc_only},
+ {mnesia_evil_coverage_test,
+ create_live_table_index_disc_only}]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+init_per_suite(Config) ->
+ Config.
+
+end_per_suite(Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
silly() ->
mnesia_install_test:silly().
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-light(doc) ->
- ["The 'light' test suite runs a selected set of test suites and is",
- "intended to be the smallest test suite that is meaningful",
- "to run. It starts with an installation test (which in essence is the",
- "'silly' test case) and then it covers all functions in the API in",
- "various depths. All configuration parameters and examples are also",
- "covered."];
-light(suite) ->
- [
- install,
- nice,
- evil,
- {mnesia_frag_test, light},
- qlc,
- registry,
- config,
- examples
- ].
-
-install(suite) ->
- [{mnesia_install_test, all}].
-
-nice(suite) ->
- [{mnesia_nice_coverage_test, all}].
-
-evil(suite) ->
- [{mnesia_evil_coverage_test, all}].
-
-qlc(suite) ->
- [{mnesia_qlc_test, all}].
-
-registry(suite) ->
- [{mnesia_registry_test, all}].
-
-config(suite) ->
- [{mnesia_config_test, all}].
-
-examples(suite) ->
- [{mnesia_examples_test, all}].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-medium(doc) ->
- ["The 'medium' test suite verfies the ACID (atomicity, consistency",
- "isolation and durability) properties and various recovery scenarios",
- "These tests may take quite while to run."];
-medium(suite) ->
- [
- install,
- atomicity,
- isolation,
- durability,
- recovery,
- consistency,
- {mnesia_frag_test, medium}
- ].
-
-atomicity(suite) ->
- [{mnesia_atomicity_test, all}].
-
-isolation(suite) ->
- [{mnesia_isolation_test, all}].
-
-durability(suite) ->
- [{mnesia_durability_test, all}].
-
-recovery(suite) ->
- [{mnesia_recovery_test, all}].
-
-consistency(suite) ->
- [{mnesia_consistency_test, all}].
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-heavy(doc) ->
- ["The 'heavy' test suite runs some resource consuming tests and",
- "benchmarks"];
-heavy(suite) ->
- [measure].
-
-measure(suite) ->
- [{mnesia_measure_test, all}].
-
-prediction(suite) ->
- [{mnesia_measure_test, prediction}].
-
-fairness(suite) ->
- [{mnesia_measure_test, fairness}].
-
-benchmarks(suite) ->
- [{mnesia_measure_test, benchmarks}].
-
-consumption(suite) ->
- [{mnesia_measure_test, consumption}].
-
-scalability(suite) ->
- [{mnesia_measure_test, scalability}].
-
clean_up_suite(doc) -> ["Not a test case only kills mnesia and nodes, that where"
"started during the tests"];
@@ -169,35 +158,7 @@ clean_up_suite(Config) when is_list(Config)->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-otp_r4b(doc) ->
- ["This test suite is an extract of the grand Mnesia suite",
- "it contains OTP R4B specific test cases"];
-otp_r4b(suite) ->
- [
- {mnesia_config_test, access_module},
- {mnesia_config_test, dump_log_load_regulation},
- {mnesia_config_test, embedded_mnemosyne},
- {mnesia_config_test, ignore_fallback_at_startup},
- {mnesia_config_test, max_wait_for_decision},
- {mnesia_consistency_test, consistency_after_restore},
- {mnesia_evil_backup, restore},
- {mnesia_evil_coverage_test, offline_set_master_nodes},
- {mnesia_evil_coverage_test, record_name},
- {mnesia_evil_coverage_test, user_properties},
- {mnesia_registry_test, all},
- otp_2363
- ].
-
-otp_2363(doc) ->
- ["Index on disc only tables"];
-otp_2363(suite) ->
- [
- {mnesia_dirty_access_test, dirty_index_match_object_disc_only},
- {mnesia_dirty_access_test,dirty_index_read_disc_only},
- {mnesia_dirty_access_test,dirty_index_update_bag_disc_only},
- {mnesia_dirty_access_test,dirty_index_update_set_disc_only},
- {mnesia_evil_coverage_test, create_live_table_index_disc_only}
- ].
+
diff --git a/lib/mnesia/test/mnesia_atomicity_test.erl b/lib/mnesia/test/mnesia_atomicity_test.erl
index 645c203a91..cf878fc820 100644
--- a/lib/mnesia/test/mnesia_atomicity_test.erl
+++ b/lib/mnesia/test/mnesia_atomicity_test.erl
@@ -27,24 +27,46 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify atomicity of transactions",
- "Verify that transactions are atomic, i.e. either all operations",
- "in a transaction will be performed or none of them. It must be",
- "assured that no partitially completed operations leaves any",
- "effects in the database."];
-all(suite) ->
- [
- explicit_abort_in_middle_of_trans,
+all() ->
+ [explicit_abort_in_middle_of_trans,
runtime_error_in_middle_of_trans,
- kill_self_in_middle_of_trans,
- throw_in_middle_of_trans,
- mnesia_down_in_middle_of_trans
- ].
+ kill_self_in_middle_of_trans, throw_in_middle_of_trans,
+ {group, mnesia_down_in_middle_of_trans}].
+
+groups() ->
+ [{mnesia_down_in_middle_of_trans, [],
+ [mnesia_down_during_infinite_trans,
+ {group, lock_waiter}, {group, restart_check}]},
+ {lock_waiter, [],
+ [lock_waiter_sw_r, lock_waiter_sw_rt, lock_waiter_sw_wt,
+ lock_waiter_wr_r, lock_waiter_srw_r, lock_waiter_sw_sw,
+ lock_waiter_sw_w, lock_waiter_sw_wr, lock_waiter_sw_srw,
+ lock_waiter_wr_wt, lock_waiter_srw_wt,
+ lock_waiter_wr_sw, lock_waiter_srw_sw, lock_waiter_wr_w,
+ lock_waiter_srw_w, lock_waiter_r_sw, lock_waiter_r_w,
+ lock_waiter_r_wt, lock_waiter_rt_sw, lock_waiter_rt_w,
+ lock_waiter_rt_wt, lock_waiter_wr_wr,
+ lock_waiter_srw_srw, lock_waiter_wt_r, lock_waiter_wt_w,
+ lock_waiter_wt_rt, lock_waiter_wt_wt, lock_waiter_wt_wr,
+ lock_waiter_wt_srw, lock_waiter_wt_sw, lock_waiter_w_wr,
+ lock_waiter_w_srw, lock_waiter_w_sw, lock_waiter_w_r,
+ lock_waiter_w_w, lock_waiter_w_rt, lock_waiter_w_wt]},
+ {restart_check, [],
+ [restart_r_one, restart_w_one, restart_rt_one,
+ restart_wt_one, restart_wr_one, restart_sw_one,
+ restart_r_two, restart_w_two, restart_rt_two,
+ restart_wt_two, restart_wr_two, restart_sw_two]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
explicit_abort_in_middle_of_trans(suite) -> [];
@@ -259,12 +281,6 @@ throw_in_middle_of_trans(Config) when is_list(Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-mnesia_down_in_middle_of_trans(suite) ->
- [
- mnesia_down_during_infinite_trans,
- lock_waiter,
- restart_check
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
mnesia_down_during_infinite_trans(suite) -> [];
@@ -304,56 +320,6 @@ mnesia_down_during_infinite_trans(Config) when is_list(Config) ->
?verify_mnesia([Node2], [Node1]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-lock_waiter(doc) ->
- ["The purpose of this test case is to test the following situation:",
- "process B locks an object, process A accesses that object as",
- "well, but A has to wait for the lock to be released. Then",
- "mnesia of B goes down. Question: will A get the lock ?",
- "important: the transaction of A is the oldest one !!! (= a little tricky)",
- "",
- "several different access operations shall be tested",
- "rt = read_lock_table, wt = write_lock_table, r = read,",
- "sw = s_write, w = write, wr = wread"];
-lock_waiter(suite) ->
- [
- lock_waiter_sw_r,
- lock_waiter_sw_rt,
- lock_waiter_sw_wt,
- lock_waiter_wr_r,
- lock_waiter_srw_r,
- lock_waiter_sw_sw,
- lock_waiter_sw_w,
- lock_waiter_sw_wr,
- lock_waiter_sw_srw,
- lock_waiter_wr_wt,
- lock_waiter_srw_wt,
- lock_waiter_wr_sw,
- lock_waiter_srw_sw,
- lock_waiter_wr_w,
- lock_waiter_srw_w,
- lock_waiter_r_sw,
- lock_waiter_r_w,
- lock_waiter_r_wt,
- lock_waiter_rt_sw,
- lock_waiter_rt_w,
- lock_waiter_rt_wt,
- lock_waiter_wr_wr,
- lock_waiter_srw_srw,
- lock_waiter_wt_r,
- lock_waiter_wt_w,
- lock_waiter_wt_rt,
- lock_waiter_wt_wt,
- lock_waiter_wt_wr,
- lock_waiter_wt_srw,
- lock_waiter_wt_sw,
- lock_waiter_w_wr,
- lock_waiter_w_srw,
- lock_waiter_w_sw,
- lock_waiter_w_r,
- lock_waiter_w_w,
- lock_waiter_w_rt,
- lock_waiter_w_wt
- ].
lock_waiter_sw_r(suite) -> [];
lock_waiter_sw_r(Config) when is_list(Config) ->
@@ -649,29 +615,6 @@ wait(Mseconds) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-restart_check (doc) ->
- [
- "test case:'A' performs a transaction on a table which",
- "is only replicated on node B. During that transaction",
- "mnesia on node B is killed. The transaction of A should",
- "be stopped, since there is no further replica",
- "rt = read_lock_table, wt = write_lock_table, r = read,",
- "sw = s_write, w = write, wr = wread,"];
-restart_check(suite) ->
- [
- restart_r_one,
- restart_w_one,
- restart_rt_one,
- restart_wt_one,
- restart_wr_one,
- restart_sw_one,
- restart_r_two,
- restart_w_two,
- restart_rt_two,
- restart_wt_two,
- restart_wr_two,
- restart_sw_two
- ].
restart_r_one(suite) -> [];
restart_r_one(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_config_backup.erl b/lib/mnesia/test/mnesia_config_backup.erl
index a33ec6ac5c..0916e255e2 100644
--- a/lib/mnesia/test/mnesia_config_backup.erl
+++ b/lib/mnesia/test/mnesia_config_backup.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2010. 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
diff --git a/lib/mnesia/test/mnesia_config_event.erl b/lib/mnesia/test/mnesia_config_event.erl
index 6c1dea7ed5..832bf94eb9 100644
--- a/lib/mnesia/test/mnesia_config_event.erl
+++ b/lib/mnesia/test/mnesia_config_event.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2010. 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
diff --git a/lib/mnesia/test/mnesia_config_test.erl b/lib/mnesia/test/mnesia_config_test.erl
index 7b62c63a62..93510d539c 100644
--- a/lib/mnesia/test/mnesia_config_test.erl
+++ b/lib/mnesia/test/mnesia_config_test.erl
@@ -27,14 +27,14 @@
-record(test_table2,{i, b}).
-export([
- all/1,
+ all/0,groups/0,init_per_group/2,end_per_group/2,
access_module/1,
auto_repair/1,
backup_module/1,
debug/1,
dir/1,
dump_log_load_regulation/1,
- dump_log_thresholds/1,
+
dump_log_update_in_place/1,
embedded_mnemosyne/1,
event_module/1,
@@ -44,7 +44,7 @@
send_compressed/1,
app_test/1,
- schema_config/1,
+
schema_merge/1,
unknown_config/1,
@@ -56,13 +56,13 @@
start_first_one_disc_less_then_two_more_disc_less/1,
schema_location_and_extra_db_nodes_combinations/1,
table_load_to_disc_less_nodes/1,
- dynamic_connect/1,
+
dynamic_basic/1,
dynamic_ext/1,
dynamic_bad/1,
init_per_testcase/2,
- fin_per_testcase/2,
+ end_per_testcase/2,
c_nodes/0
]).
@@ -95,46 +95,40 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- [
- "Test all configuration parameters",
- "Perform an exhaustive test of all the various parameters that",
- "may be used to configure the Mnesia application.",
- "",
- "Hint: Check out the unofficial function mnesia:start/1.",
- " But be careful to cleanup all configuration parameters",
- " afterwards since the rest of the test suite may rely on",
- " these default configurations. Perhaps it is best to run",
- " these tests in a separate node which is dropped afterwards.",
- "Are really all configuration parameters covered?"];
-
-all(suite) ->
- [
- access_module,
- auto_repair,
- backup_module,
- debug,
- dir,
- dump_log_load_regulation,
- dump_log_thresholds,
- dump_log_update_in_place,
- embedded_mnemosyne,
- event_module,
- ignore_fallback_at_startup,
- inconsistent_database,
- max_wait_for_decision,
- send_compressed,
-
- app_test,
- schema_config,
- unknown_config
- ].
+all() ->
+ [access_module, auto_repair, backup_module, debug, dir,
+ dump_log_load_regulation, {group, dump_log_thresholds},
+ dump_log_update_in_place, embedded_mnemosyne,
+ event_module, ignore_fallback_at_startup,
+ inconsistent_database, max_wait_for_decision,
+ send_compressed, app_test, {group, schema_config},
+ unknown_config].
+
+groups() ->
+ [{dump_log_thresholds, [],
+ [dump_log_time_threshold, dump_log_write_threshold]},
+ {schema_config, [],
+ [start_one_disc_full_then_one_disc_less,
+ start_first_one_disc_less_then_one_disc_full,
+ start_first_one_disc_less_then_two_more_disc_less,
+ schema_location_and_extra_db_nodes_combinations,
+ table_load_to_disc_less_nodes, schema_merge,
+ {group, dynamic_connect}]},
+ {dynamic_connect, [],
+ [dynamic_basic, dynamic_ext, dynamic_bad]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -445,21 +439,6 @@ dump_log_update_in_place(Config) when is_list(Config) ->
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-dump_log_thresholds(doc) ->
- ["Elaborate with various values of the dump log thresholds and how",
- "they affects each others. Both the dump_log_time_threshold and the",
- "dump_log_write_threshold must be covered. Do also check that both",
- "kinds of overload events are generated as expected.",
- "",
- "Logs are checked by first doing whatever has to be done to trigger ",
- "a dump, and then stopping Mnesia and then look in the ",
- "data files and see that the correct amount of transactions ",
- "have been done."];
-dump_log_thresholds(suite) ->
- [
- dump_log_time_threshold,
- dump_log_write_threshold
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dump_log_write_threshold(doc)->
@@ -783,22 +762,6 @@ event_module(Config) when is_list(Config) ->
ok.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-schema_config(doc) ->
- ["Try many configurations with various schema_location's with and",
- "without explicit extra_db_nodes. Do also provoke various schema merge",
- "situations. Most of the other test suites focusses on tests where the",
- "schema is residing on disc. Now it is time to perform an exhaustive",
- "elaboration with various disc less configurations."];
-schema_config(suite) ->
- [
- start_one_disc_full_then_one_disc_less,
- start_first_one_disc_less_then_one_disc_full,
- start_first_one_disc_less_then_two_more_disc_less,
- schema_location_and_extra_db_nodes_combinations,
- table_load_to_disc_less_nodes,
- schema_merge,
- dynamic_connect
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
start_one_disc_full_then_one_disc_less(doc)->
["Start a disk node and then a disk less one. Distribute some",
@@ -1160,15 +1123,6 @@ sort(NS) when is_list(NS) ->
lists:sort(NS).
-dynamic_connect(doc) ->
- ["Test the new functionality where we start mnesia first and then "
- "connect to the other mnesia nodes"];
-dynamic_connect(suite) ->
- [
- dynamic_basic,
- dynamic_ext,
- dynamic_bad
- ].
dynamic_basic(suite) -> [];
diff --git a/lib/mnesia/test/mnesia_consistency_test.erl b/lib/mnesia/test/mnesia_consistency_test.erl
index ffe8ab7ac3..f38e13f3a2 100644
--- a/lib/mnesia/test/mnesia_consistency_test.erl
+++ b/lib/mnesia/test/mnesia_consistency_test.erl
@@ -27,33 +27,121 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify transaction consistency",
- "Consistency is the property of the application that requires any",
- "execution of the transaction to take the database from one",
- "consistent state to another. Verify that the database is",
- "consistent at any point in time.",
- "Verify for various configurations.",
- " Verify for both set and bag"];
-all(suite) ->
- [
- consistency_after_restart,
- consistency_after_dump_tables,
- consistency_after_add_replica,
- consistency_after_del_replica,
- consistency_after_move_replica,
- consistency_after_transform_table,
+all() ->
+ [{group, consistency_after_restart},
+ {group, consistency_after_dump_tables},
+ {group, consistency_after_add_replica},
+ {group, consistency_after_del_replica},
+ {group, consistency_after_move_replica},
+ {group, consistency_after_transform_table},
consistency_after_change_table_copy_type,
- consistency_after_fallback,
- consistency_after_restore,
+ {group, consistency_after_fallback},
+ {group, consistency_after_restore},
consistency_after_rename_of_node,
- checkpoint_retainer_consistency,
- backup_consistency
- ].
+ {group, checkpoint_retainer_consistency},
+ {group, backup_consistency}].
+
+groups() ->
+ [{consistency_after_restart, [],
+ [consistency_after_restart_1_ram,
+ consistency_after_restart_1_disc,
+ consistency_after_restart_1_disc_only,
+ consistency_after_restart_2_ram,
+ consistency_after_restart_2_disc,
+ consistency_after_restart_2_disc_only]},
+ {consistency_after_dump_tables, [],
+ [consistency_after_dump_tables_1_ram,
+ consistency_after_dump_tables_2_ram]},
+ {consistency_after_add_replica, [],
+ [consistency_after_add_replica_2_ram,
+ consistency_after_add_replica_2_disc,
+ consistency_after_add_replica_2_disc_only,
+ consistency_after_add_replica_3_ram,
+ consistency_after_add_replica_3_disc,
+ consistency_after_add_replica_3_disc_only]},
+ {consistency_after_del_replica, [],
+ [consistency_after_del_replica_2_ram,
+ consistency_after_del_replica_2_disc,
+ consistency_after_del_replica_2_disc_only,
+ consistency_after_del_replica_3_ram,
+ consistency_after_del_replica_3_disc,
+ consistency_after_del_replica_3_disc_only]},
+ {consistency_after_move_replica, [],
+ [consistency_after_move_replica_2_ram,
+ consistency_after_move_replica_2_disc,
+ consistency_after_move_replica_2_disc_only,
+ consistency_after_move_replica_3_ram,
+ consistency_after_move_replica_3_disc,
+ consistency_after_move_replica_3_disc_only]},
+ {consistency_after_transform_table, [],
+ [consistency_after_transform_table_ram,
+ consistency_after_transform_table_disc,
+ consistency_after_transform_table_disc_only]},
+ {consistency_after_fallback, [],
+ [consistency_after_fallback_2_ram,
+ consistency_after_fallback_2_disc,
+ consistency_after_fallback_2_disc_only,
+ consistency_after_fallback_3_ram,
+ consistency_after_fallback_3_disc,
+ consistency_after_fallback_3_disc_only]},
+ {consistency_after_restore, [],
+ [consistency_after_restore_clear_ram,
+ consistency_after_restore_clear_disc,
+ consistency_after_restore_clear_disc_only,
+ consistency_after_restore_recreate_ram,
+ consistency_after_restore_recreate_disc,
+ consistency_after_restore_recreate_disc_only]},
+ {checkpoint_retainer_consistency, [],
+ [{group, updates_during_checkpoint_activation},
+ {group, updates_during_checkpoint_iteration},
+ {group, load_table_with_activated_checkpoint},
+ {group,
+ add_table_copy_to_table_with_activated_checkpoint}]},
+ {updates_during_checkpoint_activation, [],
+ [updates_during_checkpoint_activation_2_ram,
+ updates_during_checkpoint_activation_2_disc,
+ updates_during_checkpoint_activation_2_disc_only,
+ updates_during_checkpoint_activation_3_ram,
+ updates_during_checkpoint_activation_3_disc,
+ updates_during_checkpoint_activation_3_disc_only]},
+ {updates_during_checkpoint_iteration, [],
+ [updates_during_checkpoint_iteration_2_ram,
+ updates_during_checkpoint_iteration_2_disc,
+ updates_during_checkpoint_iteration_2_disc_only]},
+ {load_table_with_activated_checkpoint, [],
+ [load_table_with_activated_checkpoint_ram,
+ load_table_with_activated_checkpoint_disc,
+ load_table_with_activated_checkpoint_disc_only]},
+ {add_table_copy_to_table_with_activated_checkpoint, [],
+ [add_table_copy_to_table_with_activated_checkpoint_ram,
+ add_table_copy_to_table_with_activated_checkpoint_disc,
+ add_table_copy_to_table_with_activated_checkpoint_disc_only]},
+ {backup_consistency, [],
+ [{group, interupted_install_fallback},
+ {group, interupted_uninstall_fallback},
+ {group, mnesia_down_during_backup_causes_switch},
+ {group, mnesia_down_during_backup_causes_abort},
+ {group, schema_transactions_during_backup}]},
+ {interupted_install_fallback, [],
+ [inst_fallback_process_dies, fatal_when_inconsistency]},
+ {interupted_uninstall_fallback, [], [after_delete]},
+ {mnesia_down_during_backup_causes_switch, [],
+ [cause_switch_before, cause_switch_after]},
+ {mnesia_down_during_backup_causes_abort, [],
+ [cause_abort_before, cause_abort_after]},
+ {schema_transactions_during_backup, [],
+ [change_schema_before, change_schema_after]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
@@ -185,15 +273,6 @@ receive_messages(ListOfMsgs) ->
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_restart(suite) ->
- [
- consistency_after_restart_1_ram,
- consistency_after_restart_1_disc,
- consistency_after_restart_1_disc_only,
- consistency_after_restart_2_ram,
- consistency_after_restart_2_disc,
- consistency_after_restart_2_disc_only
- ].
consistency_after_restart_1_ram(suite) -> [];
consistency_after_restart_1_ram(Config) when is_list(Config) ->
@@ -237,11 +316,6 @@ consistency_after_restart(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_dump_tables(suite) ->
- [
- consistency_after_dump_tables_1_ram,
- consistency_after_dump_tables_2_ram
- ].
consistency_after_dump_tables_1_ram(suite) -> [];
consistency_after_dump_tables_1_ram(Config) when is_list(Config) ->
@@ -274,15 +348,6 @@ consistency_after_dump_tables(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_add_replica(suite) ->
- [
- consistency_after_add_replica_2_ram,
- consistency_after_add_replica_2_disc,
- consistency_after_add_replica_2_disc_only,
- consistency_after_add_replica_3_ram,
- consistency_after_add_replica_3_disc,
- consistency_after_add_replica_3_disc_only
- ].
consistency_after_add_replica_2_ram(suite) -> [];
consistency_after_add_replica_2_ram(Config) when is_list(Config) ->
@@ -326,15 +391,6 @@ consistency_after_add_replica(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes0, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_del_replica(suite) ->
- [
- consistency_after_del_replica_2_ram,
- consistency_after_del_replica_2_disc,
- consistency_after_del_replica_2_disc_only,
- consistency_after_del_replica_3_ram,
- consistency_after_del_replica_3_disc,
- consistency_after_del_replica_3_disc_only
- ].
consistency_after_del_replica_2_ram(suite) -> [];
consistency_after_del_replica_2_ram(Config) when is_list(Config) ->
@@ -377,15 +433,6 @@ consistency_after_del_replica(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_move_replica(suite) ->
- [
- consistency_after_move_replica_2_ram,
- consistency_after_move_replica_2_disc,
- consistency_after_move_replica_2_disc_only,
- consistency_after_move_replica_3_ram,
- consistency_after_move_replica_3_disc,
- consistency_after_move_replica_3_disc_only
- ].
consistency_after_move_replica_2_ram(suite) -> [];
consistency_after_move_replica_2_ram(Config) when is_list(Config) ->
@@ -430,16 +477,6 @@ consistency_after_move_replica(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_transform_table(doc) ->
- ["Check that the database is consistent after transform_table.",
- " While applications are updating the involved tables. "];
-
-consistency_after_transform_table(suite) ->
- [
- consistency_after_transform_table_ram,
- consistency_after_transform_table_disc,
- consistency_after_transform_table_disc_only
- ].
consistency_after_transform_table_ram(suite) -> [];
@@ -498,20 +535,6 @@ consistency_after_change_table_copy_type(doc) ->
" While applications are updating the involved tables. "].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_fallback(doc) ->
- ["Check that installed fallbacks are consistent. Check this by starting ",
- "some nodes, run tpcb on them, take a backup at any time, install it ",
- "as a fallback, kill all nodes, start mnesia again and check for ",
- "any inconsistencies"];
-consistency_after_fallback(suite) ->
- [
- consistency_after_fallback_2_ram,
- consistency_after_fallback_2_disc,
- consistency_after_fallback_2_disc_only,
- consistency_after_fallback_3_ram,
- consistency_after_fallback_3_disc
- , consistency_after_fallback_3_disc_only
- ].
consistency_after_fallback_2_ram(suite) -> [];
consistency_after_fallback_2_ram(Config) when is_list(Config) ->
@@ -583,18 +606,6 @@ consistency_after_fallback(ReplicaType, NodeConfig, Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consistency_after_restore(doc) ->
- ["Verify consistency after restore operations."];
-
-consistency_after_restore(suite) ->
- [
- consistency_after_restore_clear_ram,
- consistency_after_restore_clear_disc,
- consistency_after_restore_clear_disc_only,
- consistency_after_restore_recreate_ram,
- consistency_after_restore_recreate_disc,
- consistency_after_restore_recreate_disc_only
- ].
consistency_after_restore_clear_ram(suite) -> [];
consistency_after_restore_clear_ram(Config) when is_list(Config) ->
@@ -716,32 +727,8 @@ consistency_after_rename_of_node(doc) ->
["Skipped because it is an unimportant case."].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-checkpoint_retainer_consistency(doc) ->
- ["Verify that the contents of a checkpoint retainer has the expected",
- "contents in various situations."];
-checkpoint_retainer_consistency(suite) ->
- [
- updates_during_checkpoint_activation,
- updates_during_checkpoint_iteration,
- load_table_with_activated_checkpoint,
- add_table_copy_to_table_with_activated_checkpoint
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-updates_during_checkpoint_activation(doc) ->
- ["Perform updates while the checkpoint getting activated",
- "and verify that all checkpoint retainers associated with",
- "different replicas of the same table really has the same",
- "contents."];
-updates_during_checkpoint_activation(suite) ->
- [
- updates_during_checkpoint_activation_2_ram,
- updates_during_checkpoint_activation_2_disc,
- updates_during_checkpoint_activation_2_disc_only,
- updates_during_checkpoint_activation_3_ram,
- updates_during_checkpoint_activation_3_disc
- , updates_during_checkpoint_activation_3_disc_only
- ].
updates_during_checkpoint_activation_2_ram(suite) -> [];
updates_during_checkpoint_activation_2_ram(Config) when is_list(Config) ->
@@ -808,17 +795,6 @@ updates_during_checkpoint_activation(ReplicaType,NodeConfig,Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-updates_during_checkpoint_iteration(doc) ->
- ["Perform updates while someone is iterating over a checkpoint",
- "and verify that the iterator really finds the expected data",
- "regardless of ongoing upates."];
-
-updates_during_checkpoint_iteration(suite) ->
- [
- updates_during_checkpoint_iteration_2_ram,
- updates_during_checkpoint_iteration_2_disc
- , updates_during_checkpoint_iteration_2_disc_only
- ].
updates_during_checkpoint_iteration_2_ram(suite) -> [];
updates_during_checkpoint_iteration_2_ram(Config) when is_list(Config) ->
@@ -890,17 +866,6 @@ loop_accounts(N_br, N_acc) when N_acc >= 1 ->
loop_accounts(_,_) -> done.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-load_table_with_activated_checkpoint(doc) ->
- ["Load a table with a checkpoint attached to it and verify that the",
- "newly loaded replica also gets a checkpoint retainer attached to it",
- "and that it is consistent with the original retainer."];
-
-load_table_with_activated_checkpoint(suite) ->
- [
- load_table_with_activated_checkpoint_ram,
- load_table_with_activated_checkpoint_disc,
- load_table_with_activated_checkpoint_disc_only
- ].
load_table_with_activated_checkpoint_ram(suite) -> [];
load_table_with_activated_checkpoint_ram(Config) when is_list(Config) ->
@@ -986,18 +951,6 @@ view(Source, Mod) ->
lists:sort(TabList).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-add_table_copy_to_table_with_activated_checkpoint(doc) ->
- ["Add a replica to a table with a checkpoint attached to it",
- "and verify that the new replica also gets a checkpoint",
- "retainer attached to it and that it is consistent with the",
- "original retainer."];
-
-add_table_copy_to_table_with_activated_checkpoint(suite) ->
- [
- add_table_copy_to_table_with_activated_checkpoint_ram,
- add_table_copy_to_table_with_activated_checkpoint_disc,
- add_table_copy_to_table_with_activated_checkpoint_disc_only
- ].
add_table_copy_to_table_with_activated_checkpoint_ram(suite) -> [];
add_table_copy_to_table_with_activated_checkpoint_ram(Config) when is_list(Config) ->
@@ -1070,25 +1023,8 @@ add_table_copy_to_table_with_activated_checkpoint(Type,Config) ->
?verify_mnesia(Nodes, []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-backup_consistency(suite) ->
- [
- interupted_install_fallback,
- interupted_uninstall_fallback,
- mnesia_down_during_backup_causes_switch,
- mnesia_down_during_backup_causes_abort,
- schema_transactions_during_backup
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-interupted_install_fallback(doc) ->
- ["Verify that a interrupted install_fallback really",
- "is performed on all nodes or none"];
-
-interupted_install_fallback(suite) ->
- [
- inst_fallback_process_dies,
- fatal_when_inconsistency
- ].
inst_fallback_process_dies(suite) ->
[];
@@ -1232,13 +1168,6 @@ is_running(Node, Shouldbe) ->
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-interupted_uninstall_fallback(doc) ->
- ["Verify that a interrupted uninstall_fallback really",
- "is performed on all nodes or none"];
-interupted_uninstall_fallback(suite) ->
- [
- after_delete
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -1371,17 +1300,6 @@ do_uninstall(Config,DebugPoint) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-mnesia_down_during_backup_causes_switch(doc) ->
- ["Verify that an ongoing backup is not disturbed",
- "even if the node hosting the replica that currently",
- "is being backup'ed is stopped. The backup utility",
- "is expected to switch over to another replica and",
- "fulfill the backup."];
-mnesia_down_during_backup_causes_switch(suite) ->
- [
- cause_switch_before,
- cause_switch_after
- ].
%%%%%%%%%%%%%%%
@@ -1401,16 +1319,6 @@ cause_switch_after(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-mnesia_down_during_backup_causes_abort(doc) ->
- ["Verify that an ongoing backup is aborted nicely",
- "without leaving any backup file if the last replica",
- "of a table becomes unavailable due to a node down",
- "or some crash."];
-mnesia_down_during_backup_causes_abort(suite) ->
- [
- cause_abort_before,
- cause_abort_after
- ].
%%%%%%%%%%%%%%%%%%
@@ -1432,14 +1340,6 @@ cause_abort_after(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-schema_transactions_during_backup(doc) ->
- ["Verify that an schema transactions does not",
- "affect an ongoing backup."];
-schema_transactions_during_backup(suite) ->
- [
- change_schema_before,
- change_schema_after
- ].
%%%%%%%%%%%%%
diff --git a/lib/mnesia/test/mnesia_cost.erl b/lib/mnesia/test/mnesia_cost.erl
index 54cb2b3064..3221f46f61 100644
--- a/lib/mnesia/test/mnesia_cost.erl
+++ b/lib/mnesia/test/mnesia_cost.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2010. 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
diff --git a/lib/mnesia/test/mnesia_dirty_access_test.erl b/lib/mnesia/test/mnesia_dirty_access_test.erl
index 5f9f2a9733..abbdab48c0 100644
--- a/lib/mnesia/test/mnesia_dirty_access_test.erl
+++ b/lib/mnesia/test/mnesia_dirty_access_test.erl
@@ -26,37 +26,72 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Evil dirty access, regardless of transaction scope.",
- "Invoke all functions in the API and try to cover all legal uses",
- "cases as well the illegal dito. This is a complement to the",
- "other more explicit test cases."];
-all(suite) ->
- [
- dirty_write,
- dirty_read,
- dirty_update_counter,
- dirty_delete,
- dirty_delete_object,
- dirty_match_object,
- dirty_index,
- dirty_iter,
- admin_tests
- ].
+all() ->
+ [{group, dirty_write}, {group, dirty_read},
+ {group, dirty_update_counter}, {group, dirty_delete},
+ {group, dirty_delete_object},
+ {group, dirty_match_object}, {group, dirty_index},
+ {group, dirty_iter}, {group, admin_tests}].
+
+groups() ->
+ [{dirty_write, [],
+ [dirty_write_ram, dirty_write_disc,
+ dirty_write_disc_only]},
+ {dirty_read, [],
+ [dirty_read_ram, dirty_read_disc,
+ dirty_read_disc_only]},
+ {dirty_update_counter, [],
+ [dirty_update_counter_ram, dirty_update_counter_disc,
+ dirty_update_counter_disc_only]},
+ {dirty_delete, [],
+ [dirty_delete_ram, dirty_delete_disc,
+ dirty_delete_disc_only]},
+ {dirty_delete_object, [],
+ [dirty_delete_object_ram, dirty_delete_object_disc,
+ dirty_delete_object_disc_only]},
+ {dirty_match_object, [],
+ [dirty_match_object_ram, dirty_match_object_disc,
+ dirty_match_object_disc_only]},
+ {dirty_index, [],
+ [{group, dirty_index_match_object},
+ {group, dirty_index_read},
+ {group, dirty_index_update}]},
+ {dirty_index_match_object, [],
+ [dirty_index_match_object_ram,
+ dirty_index_match_object_disc,
+ dirty_index_match_object_disc_only]},
+ {dirty_index_read, [],
+ [dirty_index_read_ram, dirty_index_read_disc,
+ dirty_index_read_disc_only]},
+ {dirty_index_update, [],
+ [dirty_index_update_set_ram,
+ dirty_index_update_set_disc,
+ dirty_index_update_set_disc_only,
+ dirty_index_update_bag_ram, dirty_index_update_bag_disc,
+ dirty_index_update_bag_disc_only]},
+ {dirty_iter, [],
+ [dirty_iter_ram, dirty_iter_disc,
+ dirty_iter_disc_only]},
+ {admin_tests, [],
+ [del_table_copy_1, del_table_copy_2, del_table_copy_3,
+ add_table_copy_1, add_table_copy_2, add_table_copy_3,
+ add_table_copy_4, move_table_copy_1, move_table_copy_2,
+ move_table_copy_3, move_table_copy_4]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Write records dirty
-dirty_write(suite) ->
- [
- dirty_write_ram,
- dirty_write_disc,
- dirty_write_disc_only
- ].
dirty_write_ram(suite) -> [];
dirty_write_ram(Config) when is_list(Config) ->
@@ -88,12 +123,6 @@ dirty_write(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Read records dirty
-dirty_read(suite) ->
- [
- dirty_read_ram,
- dirty_read_disc,
- dirty_read_disc_only
- ].
dirty_read_ram(suite) -> [];
dirty_read_ram(Config) when is_list(Config) ->
@@ -137,12 +166,6 @@ dirty_read(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Update counter record dirty
-dirty_update_counter(suite) ->
- [
- dirty_update_counter_ram,
- dirty_update_counter_disc,
- dirty_update_counter_disc_only
- ].
dirty_update_counter_ram(suite) -> [];
dirty_update_counter_ram(Config) when is_list(Config) ->
@@ -180,12 +203,6 @@ dirty_update_counter(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Delete record dirty
-dirty_delete(suite) ->
- [
- dirty_delete_ram,
- dirty_delete_disc,
- dirty_delete_disc_only
- ].
dirty_delete_ram(suite) -> [];
dirty_delete_ram(Config) when is_list(Config) ->
@@ -223,12 +240,6 @@ dirty_delete(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Delete matching record dirty
-dirty_delete_object(suite) ->
- [
- dirty_delete_object_ram,
- dirty_delete_object_disc,
- dirty_delete_object_disc_only
- ].
dirty_delete_object_ram(suite) -> [];
dirty_delete_object_ram(Config) when is_list(Config) ->
@@ -272,12 +283,6 @@ dirty_delete_object(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Read matching records dirty
-dirty_match_object(suite) ->
- [
- dirty_match_object_ram,
- dirty_match_object_disc,
- dirty_match_object_disc_only
- ].
dirty_match_object_ram(suite) -> [];
dirty_match_object_ram(Config) when is_list(Config) ->
@@ -311,22 +316,10 @@ dirty_match_object(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-dirty_index(suite) ->
- [
- dirty_index_match_object,
- dirty_index_read,
- dirty_index_update
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Dirty read matching records by using an index
-dirty_index_match_object(suite) ->
- [
- dirty_index_match_object_ram,
- dirty_index_match_object_disc,
- dirty_index_match_object_disc_only
- ].
dirty_index_match_object_ram(suite) -> [];
dirty_index_match_object_ram(Config) when is_list(Config) ->
@@ -364,12 +357,6 @@ dirty_index_match_object(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Read records by using an index
-dirty_index_read(suite) ->
- [
- dirty_index_read_ram,
- dirty_index_read_disc,
- dirty_index_read_disc_only
- ].
dirty_index_read_ram(suite) -> [];
dirty_index_read_ram(Config) when is_list(Config) ->
@@ -413,19 +400,6 @@ dirty_index_read(Config, Storage) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-dirty_index_update(suite) ->
- [
- dirty_index_update_set_ram,
- dirty_index_update_set_disc,
- dirty_index_update_set_disc_only,
- dirty_index_update_bag_ram,
- dirty_index_update_bag_disc,
- dirty_index_update_bag_disc_only
- ];
-dirty_index_update(doc) ->
- ["See Ticket OTP-2083, verifies that a table with a index is "
- "update in the correct way i.e. the index finds the correct "
- "records after a update"].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dirty_index_update_set_ram(suite) -> [];
@@ -631,12 +605,6 @@ dirty_index_update_bag(Config, Storage) ->
%% Dirty iteration
%% dirty_slot, dirty_first, dirty_next
-dirty_iter(suite) ->
- [
- dirty_iter_ram,
- dirty_iter_disc,
- dirty_iter_disc_only
- ].
dirty_iter_ram(suite) -> [];
dirty_iter_ram(Config) when is_list(Config) ->
@@ -700,21 +668,6 @@ all_nexts(Tab, PrevKey) ->
[PrevKey] ++ all_nexts(Tab, Key).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-admin_tests(doc) ->
- ["Verifies that dirty operations work during schema operations"];
-
-admin_tests(suite) ->
- [del_table_copy_1,
- del_table_copy_2,
- del_table_copy_3,
- add_table_copy_1,
- add_table_copy_2,
- add_table_copy_3,
- add_table_copy_4,
- move_table_copy_1,
- move_table_copy_2,
- move_table_copy_3,
- move_table_copy_4].
update_trans(Tab, Key, Acc) ->
Update =
diff --git a/lib/mnesia/test/mnesia_durability_test.erl b/lib/mnesia/test/mnesia_durability_test.erl
index b917b0ca40..2fee72f066 100644
--- a/lib/mnesia/test/mnesia_durability_test.erl
+++ b/lib/mnesia/test/mnesia_durability_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. 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
@@ -28,47 +28,54 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-record(test_rec,{key,val}).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify durability",
- "Verify that the effects of committed transactions are durable.",
- "The content of the tables tables must be restored at startup."];
-all(suite) ->
- [
- load_tables,
- durability_of_dump_tables,
+all() ->
+ [{group, load_tables},
+ {group, durability_of_dump_tables},
durability_of_disc_copies,
- durability_of_disc_only_copies
- ].
+ durability_of_disc_only_copies].
+
+groups() ->
+ [{load_tables, [],
+ [load_latest_data, load_local_contents_directly,
+ load_directly_when_all_are_ram_copiesA,
+ load_directly_when_all_are_ram_copiesB,
+ {group, late_load_when_all_are_ram_copies_on_ram_nodes},
+ load_when_last_replica_becomes_available,
+ load_when_we_have_down_from_all_other_replica_nodes,
+ late_load_transforms_into_disc_load,
+ late_load_leads_to_hanging,
+ force_load_when_nobody_intents_to_load,
+ force_load_when_someone_has_decided_to_load,
+ force_load_when_someone_else_already_has_loaded,
+ force_load_when_we_has_loaded,
+ force_load_on_a_non_local_table,
+ force_load_when_the_table_does_not_exist,
+ {group, load_tables_with_master_tables}]},
+ {late_load_when_all_are_ram_copies_on_ram_nodes, [],
+ [late_load_when_all_are_ram_copies_on_ram_nodes1,
+ late_load_when_all_are_ram_copies_on_ram_nodes2]},
+ {load_tables_with_master_tables, [],
+ [master_nodes, starting_master_nodes,
+ master_on_non_local_tables,
+ remote_force_load_with_local_master_node]},
+ {durability_of_dump_tables, [],
+ [dump_ram_copies, dump_disc_copies, dump_disc_only]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-load_tables(doc) ->
- ["Try to provoke all kinds of table load scenarios."];
-load_tables(suite) ->
- [
- load_latest_data,
- load_local_contents_directly,
- load_directly_when_all_are_ram_copiesA,
- load_directly_when_all_are_ram_copiesB,
- late_load_when_all_are_ram_copies_on_ram_nodes,
- load_when_last_replica_becomes_available,
- load_when_we_have_down_from_all_other_replica_nodes,
- late_load_transforms_into_disc_load,
- late_load_leads_to_hanging,
- force_load_when_nobody_intents_to_load,
- force_load_when_someone_has_decided_to_load,
- force_load_when_someone_else_already_has_loaded,
- force_load_when_we_has_loaded,
- force_load_on_a_non_local_table,
- force_load_when_the_table_does_not_exist,
- load_tables_with_master_tables
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load_latest_data(doc) ->
@@ -112,8 +119,8 @@ load_latest_data(Config) when is_list(Config) ->
?match([], mnesia_test_lib:kill_mnesia([N2])),
?match(ok, mnesia:dirty_write(Rec1)),
- ?match([], mnesia_test_lib:kill_mnesia([N1])),
?match([], mnesia_test_lib:kill_mnesia([N3])),
+ ?match([], mnesia_test_lib:kill_mnesia([N1])),
?match([], mnesia_test_lib:start_mnesia([N2], [])),
%% Should wait for N1
@@ -284,13 +291,6 @@ load_directly_when_all_are_ram_copiesB(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-late_load_when_all_are_ram_copies_on_ram_nodes(doc) ->
- ["Load of ram_copies tables when all replicas resides on disc less nodes"];
-late_load_when_all_are_ram_copies_on_ram_nodes(suite) ->
- [
- late_load_when_all_are_ram_copies_on_ram_nodes1,
- late_load_when_all_are_ram_copies_on_ram_nodes2
- ].
late_load_when_all_are_ram_copies_on_ram_nodes1(suite) -> [];
late_load_when_all_are_ram_copies_on_ram_nodes1(Config) when is_list(Config) ->
@@ -916,22 +916,6 @@ force_load_when_the_table_does_not_exist(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-load_tables_with_master_tables(doc) ->
- ["Verifies the semantics of different master nodes settings",
- "The semantics should be:",
- "1. Mnesia downs, Normally decides from where mnesia should load tables",
- "2. Master tables (overrides mnesia downs) ",
- "3. Force load (overrides Master tables) ",
- "--- 1st from active master nodes",
- "--- 2nd from active nodes",
- "--- 3rd get local copy (if ram create new one)"
- ];
-
-load_tables_with_master_tables(suite) ->
- [master_nodes,
- starting_master_nodes,
- master_on_non_local_tables,
- remote_force_load_with_local_master_node].
-define(SDwrite(Tup), fun() -> mnesia:write(Tup) end).
@@ -1156,13 +1140,6 @@ remote_force_load_with_local_master_node(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-durability_of_dump_tables(doc) ->
- [ "Verify that all tables contain the correct data when Mnesia",
- "is restarted and tables are loaded from disc to recover",
- " their previous contents. " ];
-durability_of_dump_tables(suite) -> [dump_ram_copies,
- dump_disc_copies,
- dump_disc_only].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/lib/mnesia/test/mnesia_evil_backup.erl b/lib/mnesia/test/mnesia_evil_backup.erl
index bbbebeb02c..9e0a8db1ae 100644
--- a/lib/mnesia/test/mnesia_evil_backup.erl
+++ b/lib/mnesia/test/mnesia_evil_backup.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2011. 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
@@ -35,31 +35,30 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Checking all the functionality regarding ",
- "to the backup and different ",
- "kinds of restore and fallback interface"];
-
-all(suite) ->
- [
- backup,
- bad_backup,
- global_backup_checkpoint,
- restore_tables,
- traverse_backup,
+all() ->
+ [backup, bad_backup, global_backup_checkpoint,
+ {group, restore_tables}, traverse_backup,
selective_backup_checkpoint,
- incremental_backup_checkpoint,
-%% local_backup_checkpoint,
- install_fallback,
- uninstall_fallback,
- local_fallback,
- sops_with_checkpoint
- ].
+ incremental_backup_checkpoint, install_fallback,
+ uninstall_fallback, local_fallback,
+ sops_with_checkpoint].
+
+groups() ->
+ [{restore_tables, [],
+ [restore_errors, restore_clear, restore_keep,
+ restore_recreate, restore_clear_ram]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
backup(doc) -> ["Checking the interface to the function backup",
"We don't check that the backups can be used here",
@@ -132,17 +131,6 @@ global_backup_checkpoint(Config) when is_list(Config) ->
?match(ok, file:delete(File2)),
?verify_mnesia(Nodes, []).
-restore_tables(doc) ->
- ["Tests the interface of restore"];
-
-restore_tables(suite) ->
- [
- restore_errors,
- restore_clear,
- restore_keep,
- restore_recreate,
- restore_clear_ram
- ].
restore_errors(suite) -> [];
restore_errors(Config) when is_list(Config) ->
@@ -256,9 +244,9 @@ restore(Config, Op) ->
[rpc:call(Node, ?MODULE, check_tab, [Res31, ?LINE]) || Node <- Nodes],
%% Restore all tables on it's nodes
- mnesia_schema:clear_table(Tab1),
- mnesia_schema:clear_table(Tab2),
- mnesia_schema:clear_table(Tab3),
+ mnesia:clear_table(Tab1),
+ mnesia:clear_table(Tab2),
+ mnesia:clear_table(Tab3),
[mnesia:dirty_write({Tab1, N, N+1}) || N <- lists:seq(1, 11)],
[mnesia:dirty_write({Tab2, N, N+1}) || N <- lists:seq(1, 11)],
[mnesia:dirty_write({Tab3, N, N+1}) || N <- lists:seq(1, 11)],
diff --git a/lib/mnesia/test/mnesia_evil_coverage_test.erl b/lib/mnesia/test/mnesia_evil_coverage_test.erl
index 06674d9eef..17d6c6c212 100644
--- a/lib/mnesia/test/mnesia_evil_coverage_test.erl
+++ b/lib/mnesia/test/mnesia_evil_coverage_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. 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
@@ -30,44 +30,54 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Evil usage of the API.",
- "Invoke all functions in the API and try to cover all legal uses",
- "cases as well the illegal dito. This is a complement to the",
- "other more explicit test cases."];
-all(suite) ->
- [
- system_info,
- table_info,
- error_description,
- db_node_lifecycle,
- evil_delete_db_node,
- start_and_stop,
- checkpoint,
- table_lifecycle,
- add_copy_conflict,
- add_copy_when_going_down,
- replica_management,
- schema_availability,
- local_content,
- table_access_modifications,
- replica_location,
- table_sync,
- user_properties,
- unsupp_user_props,
- record_name,
- snmp_access,
- iteration,
- debug_support,
- sorted_ets,
+all() ->
+ [system_info, table_info, error_description,
+ db_node_lifecycle, evil_delete_db_node, start_and_stop,
+ checkpoint, table_lifecycle, add_copy_conflict,
+ add_copy_when_going_down, replica_management,
+ schema_availability, local_content,
+ {group, table_access_modifications}, replica_location,
+ {group, table_sync}, user_properties, unsupp_user_props,
+ {group, record_name}, {group, snmp_access},
+ {group, subscriptions}, {group, iteration},
+ {group, debug_support}, sorted_ets,
{mnesia_dirty_access_test, all},
{mnesia_trans_access_test, all},
- {mnesia_evil_backup, all}
- ].
+ {mnesia_evil_backup, all}].
+
+groups() ->
+ [{table_access_modifications, [],
+ [change_table_access_mode, change_table_load_order,
+ set_master_nodes, offline_set_master_nodes]},
+ {table_sync, [],
+ [dump_tables, dump_log, wait_for_tables,
+ force_load_table]},
+ {snmp_access, [],
+ [snmp_open_table, snmp_close_table, snmp_get_next_index,
+ snmp_get_row, snmp_get_mnesia_key, snmp_update_counter,
+ snmp_order]},
+ {subscriptions, [],
+ [subscribe_standard, subscribe_extended]},
+ {iteration, [], [foldl]},
+ {debug_support, [],
+ [info, schema_0, schema_1, view_0, view_1, view_2,
+ lkill, kill]},
+ {record_name, [], [{group, record_name_dirty_access}]},
+ {record_name_dirty_access, [],
+ [record_name_dirty_access_ram,
+ record_name_dirty_access_disc,
+ record_name_dirty_access_disc_only]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -909,13 +919,6 @@ local_content(Config) when is_list(Config) ->
?verify_mnesia(Nodes, []).
-table_access_modifications(suite) ->
- [
- change_table_access_mode,
- change_table_load_order,
- set_master_nodes,
- offline_set_master_nodes
- ].
change_table_access_mode(suite) -> [];
change_table_access_mode(Config) when is_list(Config) ->
@@ -1102,13 +1105,6 @@ offline_set_master_nodes(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Syncronize table with log or disc
%%
-table_sync(suite) ->
- [
- dump_tables,
- dump_log,
- wait_for_tables,
- force_load_table
- ].
%% Dump ram tables on disc
dump_tables(suite) -> [];
@@ -1358,19 +1354,6 @@ unsupp_user_props(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-snmp_access(doc) ->
- ["Make Mnesia table accessible via SNMP"];
-
-snmp_access(suite) ->
- [
- snmp_open_table,
- snmp_close_table,
- snmp_get_next_index,
- snmp_get_row,
- snmp_get_mnesia_key,
- snmp_update_counter,
- snmp_order
- ].
snmp_open_table(suite) -> [];
snmp_open_table(Config) when is_list(Config) ->
@@ -1775,10 +1758,234 @@ get_keys(Tab, Key) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-iteration(doc) ->
- ["Verify that the iteration functions works as expected"];
-iteration(suite) ->
- [foldl].
+
+-record(tab, {i, e1, e2}). % Simple test table
+
+
+subscribe_extended(doc) ->
+ ["Test the extended set of events, test with and without checkpoints. "];
+subscribe_extended(suite) ->
+ [];
+subscribe_extended(Config) when is_list(Config) ->
+ [N1, N2]=Nodes=?acquire_nodes(2, Config),
+ Tab1 = etab,
+ Storage = mnesia_test_lib:storage_type(ram_copies, Config),
+ Def1 = [{Storage, [N1, N2]}, {attributes, record_info(fields, tab)}],
+ ?match({atomic, ok}, mnesia:create_table(Tab1, Def1)),
+
+ Tab2 = bag,
+ Def2 = [{Storage, [N1, N2]},
+ {type, bag},
+ {record_name, Tab1},
+ {attributes, record_info(fields, tab)}],
+ ?match({atomic, ok}, mnesia:create_table(Tab2, Def2)),
+
+ ?match({ok, N1}, mnesia:subscribe({table, Tab1, detailed})),
+ ?match({ok, N1}, mnesia:subscribe({table, Tab2, detailed})),
+
+ ?match({error, {already_exists, _}}, mnesia:subscribe({table, Tab1, simple})),
+ ?match({error, {badarg, {table, Tab1, bad}}}, mnesia:subscribe({table, Tab1, bad})),
+
+ ?match({ok, N1}, mnesia:subscribe(activity)),
+ test_ext_sub(Tab1, Tab2),
+
+ ?match({ok, N1}, mnesia:unsubscribe(activity)),
+ ?match({ok, N1}, mnesia:subscribe({table, Tab1, detailed})),
+ ?match({atomic, ok}, mnesia:clear_table(Tab1)),
+ ?match({mnesia_table_event, {delete, schema, {schema, Tab1}, [{schema, Tab1, _}],_}}, recv_event()),
+ ?match({mnesia_table_event, {write, schema, {schema, Tab1, _}, [], _}}, recv_event()),
+
+ ?match({atomic, ok}, mnesia:clear_table(Tab2)),
+ ?match({mnesia_table_event, {delete, schema, {schema, Tab2}, [{schema, Tab2, _}],_}},
+ recv_event()),
+ ?match({mnesia_table_event, {write, schema, {schema, Tab2, _}, [], _}}, recv_event()),
+
+ ?match({ok, N1}, mnesia:unsubscribe({table, Tab2, detailed})),
+ {ok, _, _} = mnesia:activate_checkpoint([{name, testing},
+ {ram_overrides_dump, true},
+ {max, [Tab1, Tab2]}]),
+ ?match({ok, N1}, mnesia:subscribe({table, Tab2, detailed})),
+ ?match({ok, N1}, mnesia:subscribe(activity)),
+ test_ext_sub(Tab1, Tab2),
+
+ ?verify_mnesia(Nodes, []).
+
+test_ext_sub(Tab1, Tab2) ->
+ %% The basics
+ Rec1 = {Tab1, 1, 0, 0},
+ Rec2 = {Tab1, 1, 1, 0},
+ Rec3 = {Tab1, 2, 1, 0},
+ Rec4 = {Tab1, 2, 2, 0},
+
+ Write = fun(Tab, Rec) ->
+ mnesia:transaction(fun() -> mnesia:write(Tab, Rec, write)
+ end)
+ end,
+ Delete = fun(Tab, Rec) ->
+ mnesia:transaction(fun() -> mnesia:delete(Tab, Rec, write)
+ end)
+ end,
+ DelObj = fun(Tab, Rec) ->
+ mnesia:transaction(fun() -> mnesia:delete_object(Tab, Rec, write)
+ end)
+ end,
+
+ S = self(),
+ D = {dirty, self()},
+ %% SET
+ ?match(ok, mnesia:dirty_write(Rec1)),
+ ?match({mnesia_table_event, {write, Tab1, Rec1, [], D}}, recv_event()),
+ ?match(ok, mnesia:dirty_write(Rec3)),
+ ?match({mnesia_table_event, {write, Tab1, Rec3, [], D}}, recv_event()),
+ ?match(ok, mnesia:dirty_write(Rec1)),
+ ?match({mnesia_table_event, {write, Tab1, Rec1, [Rec1], D}}, recv_event()),
+ ?match({atomic, ok}, Write(Tab1, Rec2)),
+ ?match({mnesia_table_event, {write, Tab1, Rec2, [Rec1], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match(ok, mnesia:dirty_delete({Tab1, 2})),
+ ?match({mnesia_table_event, {delete, Tab1, {Tab1, 2}, [Rec3], D}}, recv_event()),
+ ?match({atomic, ok}, DelObj(Tab1, Rec2)),
+ ?match({mnesia_table_event, {delete, Tab1, Rec2, [Rec2], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+
+ ?match({atomic, ok}, Delete(Tab1, 1)),
+ ?match({mnesia_table_event, {delete, Tab1, {Tab1, 1}, [], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+
+ ?match({ok, _N1}, mnesia:unsubscribe({table, Tab1, detailed})),
+
+ %% BAG
+
+ ?match({atomic, ok}, Write(Tab2, Rec1)),
+ ?match({mnesia_table_event, {write, Tab2, Rec1, [], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Write(Tab2, Rec4)),
+ ?match({mnesia_table_event, {write, Tab2, Rec4, [], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Write(Tab2, Rec3)),
+ ?match({mnesia_table_event, {write, Tab2, Rec3, [Rec4], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Write(Tab2, Rec2)),
+ ?match({mnesia_table_event, {write, Tab2, Rec2, [Rec1], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Write(Tab2, Rec1)),
+ ?match({mnesia_table_event, {write, Tab2, Rec1, [Rec1, Rec2], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, DelObj(Tab2, Rec2)),
+ ?match({mnesia_table_event, {delete, Tab2, Rec2, [Rec2], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Delete(Tab2, 1)),
+ ?match({mnesia_table_event, {delete, Tab2, {Tab2, 1}, [Rec1], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ?match({atomic, ok}, Delete(Tab2, 2)),
+ ?match({mnesia_table_event, {delete, Tab2, {Tab2, 2}, [Rec4, Rec3], {tid,_,S}}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid,_,S}}}, recv_event()),
+ ok.
+
+
+subscribe_standard(doc) ->
+ ["Tests system events and the orignal table events"];
+subscribe_standard(suite) -> [];
+subscribe_standard(Config) when is_list(Config)->
+ [N1, N2]=?acquire_nodes(2, Config),
+ Tab = tab,
+
+ Storage = mnesia_test_lib:storage_type(disc_copies, Config),
+ Def = [{Storage, [N1, N2]}, {attributes, record_info(fields, tab)}],
+
+ ?match({atomic, ok}, mnesia:create_table(Tab, Def)),
+
+ %% Check system events
+ ?match({ok, N1}, mnesia:subscribe(system)),
+ ?match({ok, N1}, mnesia:subscribe(activity)),
+
+ ?match([], mnesia_test_lib:kill_mnesia([N2])),
+ ?match({mnesia_system_event, {mnesia_down, N2}}, recv_event()),
+ ?match(timeout, recv_event()),
+
+ ?match([], mnesia_test_lib:start_mnesia([N2], [Tab])),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match({mnesia_system_event,{mnesia_up, N2}}, recv_event()),
+
+ ?match(true, lists:member(self(), mnesia:system_info(subscribers))),
+ ?match([], mnesia_test_lib:kill_mnesia([N1])),
+ timer:sleep(500),
+ mnesia_test_lib:flush(),
+ ?match([], mnesia_test_lib:start_mnesia([N1], [Tab])),
+ ?match(timeout, recv_event()),
+
+ ?match({ok, N1}, mnesia:subscribe(system)),
+ ?match({error, {already_exists, system}}, mnesia:subscribe(system)),
+ ?match(stopped, mnesia:stop()),
+ ?match({mnesia_system_event, {mnesia_down, N1}}, recv_event()),
+ ?match({error, {node_not_running, N1}}, mnesia:subscribe(system)),
+ ?match([], mnesia_test_lib:start_mnesia([N1, N2], [Tab])),
+
+ %% Check table events
+ ?match({ok, N1}, mnesia:subscribe(activity)),
+ Old_Level = mnesia:set_debug_level(trace),
+ ?match({ok, N1}, mnesia:subscribe({table,Tab})),
+
+ ?match({atomic, ok},
+ mnesia:transaction(fun() -> mnesia:write(#tab{i=155}) end)),
+ Self = self(),
+ ?match({mnesia_table_event, {write, _, _}}, recv_event()),
+ ?match({mnesia_activity_event, {complete, {tid, _, Self}}}, recv_event()),
+
+ ?match({ok, N1}, mnesia:unsubscribe({table,Tab})),
+ ?match({ok, N1}, mnesia:unsubscribe(activity)),
+
+ ?match({atomic, ok},
+ mnesia:transaction(fun() -> mnesia:write(#tab{i=255}) end)),
+
+ ?match(timeout, recv_event()),
+ mnesia:set_debug_level(Old_Level),
+
+ %% Check deletion of replica
+
+ ?match({ok, N1}, mnesia:subscribe({table,Tab})),
+ ?match({ok, N1}, mnesia:subscribe(activity)),
+ ?match(ok, mnesia:dirty_write(#tab{i=355})),
+ ?match({mnesia_table_event, {write, _, _}}, recv_event()),
+ ?match({atomic, ok}, mnesia:del_table_copy(Tab, N1)),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match(ok, mnesia:dirty_write(#tab{i=455})),
+ ?match(timeout, recv_event()),
+
+ ?match({atomic, ok}, mnesia:move_table_copy(Tab, N2, N1)),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match({ok, N1}, mnesia:subscribe({table,Tab})),
+ ?match(ok, mnesia:dirty_write(#tab{i=555})),
+ ?match({mnesia_table_event, {write, _, _}}, recv_event()),
+ ?match({atomic, ok}, mnesia:move_table_copy(Tab, N1, N2)),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match(ok, mnesia:dirty_write(#tab{i=655})),
+ ?match(timeout, recv_event()),
+
+ ?match({atomic, ok}, mnesia:add_table_copy(Tab, N1, ram_copies)),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match({ok, N1}, mnesia:subscribe({table,Tab})),
+ ?match({error, {already_exists, {table,Tab, simple}}},
+ mnesia:subscribe({table,Tab})),
+ ?match(ok, mnesia:dirty_write(#tab{i=755})),
+ ?match({mnesia_table_event, {write, _, _}}, recv_event()),
+
+ ?match({atomic, ok}, mnesia:delete_table(Tab)),
+ ?match({mnesia_activity_event, _}, recv_event()),
+ ?match(timeout, recv_event()),
+
+ mnesia_test_lib:kill_mnesia([N1]),
+
+ ?verify_mnesia([N2], [N1]).
+
+recv_event() ->
+ receive
+ Event -> Event
+ after 1000 ->
+ timeout
+ end.
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
foldl(suite) ->
@@ -1840,19 +2047,6 @@ sort_res(Else) ->
Else.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-debug_support(doc) ->
- ["Check that the debug support has not decayed."];
-debug_support(suite) ->
- [
- info,
- schema_0,
- schema_1,
- view_0,
- view_1,
- view_2,
- lkill,
- kill
- ].
info(suite) -> [];
info(Config) when is_list(Config) ->
@@ -1939,21 +2133,7 @@ kill(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-record_name(doc) ->
- ["Verify that record names may be differ from the name of ",
- "the hosting table. Check at least access, restore, "
- "registry, subscriptions and traveres_backup"];
-record_name(suite) ->
- [
- record_name_dirty_access
- ].
-
-record_name_dirty_access(suite) ->
- [
- record_name_dirty_access_ram,
- record_name_dirty_access_disc,
- record_name_dirty_access_disc_only
- ].
+
record_name_dirty_access_ram(suite) ->
[];
diff --git a/lib/mnesia/test/mnesia_examples_test.erl b/lib/mnesia/test/mnesia_examples_test.erl
index d1b1409c9d..373d47a05a 100644
--- a/lib/mnesia/test/mnesia_examples_test.erl
+++ b/lib/mnesia/test/mnesia_examples_test.erl
@@ -26,8 +26,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(init(N, Config),
mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]},
@@ -61,16 +61,21 @@ opt_load(Mod) ->
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Run all examples mentioned in the documentation",
- "Are really all examples covered?"];
-all(suite) ->
- [
- bup,
- company,
- meter,
- tpcb
- ].
+all() ->
+ [bup, company, meter, {group, tpcb}].
+
+groups() ->
+ [{tpcb, [],
+ [replica_test, sticky_replica_test, dist_test,
+ conflict_test, frag_test, frag2_test, remote_test,
+ remote_frag2_test]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bup(doc) -> ["Run the backup examples in bup.erl"];
@@ -85,19 +90,6 @@ company(doc) ->
["Run the company examples in company.erl and company_o.erl"].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-tpcb(doc) ->
- ["Run the sample configurations of the stress tests in mnesia_tpcb.erl"];
-tpcb(suite) ->
- [
- replica_test,
- sticky_replica_test,
- dist_test,
- conflict_test,
- frag_test,
- frag2_test,
- remote_test,
- remote_frag2_test
- ].
replica_test(suite) -> [];
replica_test(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_frag_test.erl b/lib/mnesia/test/mnesia_frag_test.erl
index 4add340254..d3f6762af7 100644
--- a/lib/mnesia/test/mnesia_frag_test.erl
+++ b/lib/mnesia/test/mnesia_frag_test.erl
@@ -27,8 +27,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(match_dist(ExpectedRes, Expr),
case ?match(ExpectedRes, Expr) of
@@ -37,34 +37,29 @@ fin_per_testcase(Func, Conf) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify the functionality of fragmented tables"];
-all(suite) ->
- [
- light,
- medium
- ].
-
-light(suite) ->
- [
- nice,
- evil
- ].
-
-medium(suite) ->
- [
- consistency
- ].
+all() ->
+ [{group, light}, {group, medium}].
+
+groups() ->
+ [{light, [], [{group, nice}, {group, evil}]},
+ {medium, [], [consistency]},
+ {nice, [],
+ [nice_single, nice_multi, nice_access, iter_access]},
+ {evil, [],
+ [evil_create, evil_delete, evil_change, evil_combine,
+ evil_loop, evil_delete_db_node]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-nice(suite) ->
- [
- nice_single,
- nice_multi,
- nice_access,
- iter_access
- ].
nice_single(suite) -> [];
nice_single(Config) when is_list(Config) ->
@@ -503,17 +498,6 @@ consistency(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-evil(doc) ->
- ["Evil coverage of fragmentation API."];
-evil(suite) ->
- [
- evil_create,
- evil_delete,
- evil_change,
- evil_combine,
- evil_loop,
- evil_delete_db_node
- ].
evil_create(suite) -> [];
evil_create(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_inconsistent_database_test.erl b/lib/mnesia/test/mnesia_inconsistent_database_test.erl
index b19cd8e01b..c4b6257d5b 100644
--- a/lib/mnesia/test/mnesia_inconsistent_database_test.erl
+++ b/lib/mnesia/test/mnesia_inconsistent_database_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1998-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1998-2010. 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
diff --git a/lib/mnesia/test/mnesia_install_test.erl b/lib/mnesia/test/mnesia_install_test.erl
index 42a2a19f37..3a2d44aa95 100644
--- a/lib/mnesia/test/mnesia_install_test.erl
+++ b/lib/mnesia/test/mnesia_install_test.erl
@@ -27,29 +27,22 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Run some small but demanding test cases in order to verify",
- "that the basic functionality in Mnesia still works.",
- "",
- "Try some very simple things to begin with and increase the",
- "difficulty stepwise. This test suite should be run before",
- "all the others if you expect to find bugs.",
- "",
- "The function mnesia_install_test:silly() does not use the whole",
- "infra structure of the test suite. Invoke it on a single node to",
- "begin with. If that works, proceed with pong = net_adm:ping(SomeOtherNode)",
- "and rerun silly() in order to perform some distributed tests."];
-all(suite) ->
- [
- silly_durability,
- silly_move,
- silly_upgrade
- %,stress
- ].
+all() ->
+ [silly_durability, silly_move, silly_upgrade].
+
+groups() ->
+ [{stress, [], stress_cases()}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Stepwise of more and more advanced features
@@ -86,11 +79,11 @@ silly2(Config) when is_list(Config) ->
[schema])),
MoveRes = silly_move(Config),
UpgradeRes = silly_upgrade(Config),
- StressRes = [StressFun(F) || F <- stress(suite)],
+ StressRes = [StressFun(F) || F <- stress_cases()],
?verify_mnesia([Node2], []),
[Res, MoveRes, UpgradeRes] ++ StressRes;
_ ->
- StressRes = [StressFun(F) || F <- stress(suite)],
+ StressRes = [StressFun(F) || F <- stress_cases()],
?warning("Too few nodes. Perform net_adm:ping(OtherNode) "
"and rerun!!!~n", []),
[Res | StressRes]
@@ -212,7 +205,7 @@ silly_upgrade(Config) when is_list(Config) ->
?match(ok, mnesia:install_fallback(Bup2)),
file:delete(Bup2),
%% Will generate intentional crash, fatal error
- ?match([], mnesia_test_lib:stop_mnesia([Node2])),
+ ?match([], mnesia_test_lib:stop_mnesia([Node2])),
wait_till_dead([Node1, Node2]),
?match([], mnesia_test_lib:start_mnesia([Node1, Node2], [Tab1, Tab2])),
?match(match, verify_state(Tab1, Tab2, CpState)),
@@ -220,22 +213,29 @@ silly_upgrade(Config) when is_list(Config) ->
?match(ok, mnesia:install_fallback(Bup)),
file:delete(Bup),
%% Will generate intentional crash, fatal error
- ?match([], mnesia_test_lib:stop_mnesia([Node1, Node2])),
+ ?match([], mnesia_test_lib:stop_mnesia([Node1, Node2])),
wait_till_dead([Node1, Node2]),
?match([], mnesia_test_lib:start_mnesia([Node1, Node2], [Tab1, Tab2])),
CpState2 = [X || X <- CpState, element(1, X) /= Tab1],
?match(match, verify_state(Tab1, Tab2, CpState2)),
?verify_mnesia(Nodes, []).
-wait_till_dead([]) -> ok;
-wait_till_dead([N|Ns]) ->
+wait_till_dead([]) ->
+ ok; %% timer:sleep(5);
+wait_till_dead(Repeat = [N|Ns]) ->
Apps = rpc:call(N, application, which_applications, []),
case lists:keymember(mnesia, 1, Apps) of
- true ->
+ true ->
timer:sleep(10),
- wait_till_dead([N|Ns]);
- false ->
- wait_till_dead(Ns)
+ wait_till_dead(Repeat);
+ false ->
+ case rpc:call(N, erlang, whereis, [mnesia_monitor]) of
+ undefined ->
+ wait_till_dead(Ns);
+ _ ->
+ timer:sleep(10),
+ wait_till_dead(Repeat)
+ end
end.
add_some_records(Tab1, Tab2, Old) ->
@@ -286,13 +286,9 @@ transform_some_records(Tab1, _Tab2, Old) ->
lists:sort(lists:zf(Filter, Old)).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-stress(doc) ->
- ["Stress the system a little"];
-stress(suite) ->
- [
- conflict,
- dist
- ].
+
+stress_cases() ->
+[conflict, dist].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dist(doc) ->
diff --git a/lib/mnesia/test/mnesia_isolation_test.erl b/lib/mnesia/test/mnesia_isolation_test.erl
index 4fc6e8fe58..3273bc4d40 100644
--- a/lib/mnesia/test/mnesia_isolation_test.erl
+++ b/lib/mnesia/test/mnesia_isolation_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2010. 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
@@ -27,46 +27,53 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify the isolation property.",
- "Operations of concurrent transactions must yield results which",
- "are indistinguishable from the results which would be obtained by",
- "forcing each transaction to be serially executed to completion in",
- "some order. This means that repeated reads of the same records",
- "within any committed transaction must have returned identical",
- "data when run concurrently with any mix of arbitary transactions.",
- "Updates in one transaction must not be visible in any other",
- "transaction before the transaction has been committed."];
-all(suite) ->
- [
- locking,
- visibility
- ].
+all() ->
+ [{group, locking}, {group, visibility}].
+
+groups() ->
+ [{locking, [],
+ [no_conflict, simple_queue_conflict,
+ advanced_queue_conflict, simple_deadlock_conflict,
+ advanced_deadlock_conflict, lock_burst,
+ {group, sticky_locks}, {group, unbound_locking},
+ {group, admin_conflict}, nasty]},
+ {sticky_locks, [], [basic_sticky_functionality]},
+ {unbound_locking, [], [unbound1, unbound2]},
+ {admin_conflict, [],
+ [create_table, delete_table, move_table_copy,
+ add_table_index, del_table_index, transform_table,
+ snmp_open_table, snmp_close_table,
+ change_table_copy_type, change_table_access,
+ add_table_copy, del_table_copy, dump_tables,
+ {group, extra_admin_tests}]},
+ {extra_admin_tests, [],
+ [del_table_copy_1, del_table_copy_2, del_table_copy_3,
+ add_table_copy_1, add_table_copy_2, add_table_copy_3,
+ add_table_copy_4, move_table_copy_1, move_table_copy_2,
+ move_table_copy_3, move_table_copy_4]},
+ {visibility, [],
+ [dirty_updates_visible_direct,
+ dirty_reads_regardless_of_trans,
+ trans_update_invisibible_outside_trans,
+ trans_update_visible_inside_trans, write_shadows,
+ delete_shadows, write_delete_shadows_bag,
+ write_delete_shadows_bag2, {group, iteration},
+ shadow_search, snmp_shadows]},
+ {removed_resources, [], [rr_kill_copy]},
+ {iteration, [], [foldl, first_next]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-locking(doc) ->
- ["Verify locking semantics for various configurations",
- " NoLock = lock_funs(no_lock, any_granularity)",
- " SharedLock = lock_funs(shared_lock, any_granularity)",
- " ExclusiveLock = lock_funs(exclusive_lock, any_granularity)",
- " AnyLock = lock_funs(any_lock, any_granularity)"];
-locking(suite) ->
- [no_conflict,
- simple_queue_conflict,
- advanced_queue_conflict,
- simple_deadlock_conflict,
- advanced_deadlock_conflict,
- lock_burst,
- sticky_locks,
- unbound_locking,
- admin_conflict,
-%% removed_resources,
- nasty
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -431,14 +438,6 @@ burst_incr(Tab, Father) ->
Father ! burst_incr_done.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-sticky_locks(doc) ->
- ["Simple Tests of sticky locks"];
-
-sticky_locks(suite) ->
- [
- basic_sticky_functionality
- %% Needs to be expandand a little bit further
- ].
basic_sticky_functionality(suite) -> [];
basic_sticky_functionality(Config) when is_list(Config) ->
@@ -519,12 +518,6 @@ get_held() ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-unbound_locking(suite) ->
- [unbound1, unbound2];
-
-unbound_locking(doc) ->
- ["Check that mnesia handles unbound key variables, GPRS bug."
- "Ticket id: OTP-3342"].
unbound1(suite) -> [];
unbound1(Config) when is_list(Config) ->
@@ -637,25 +630,6 @@ receiver() ->
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-admin_conflict(doc) ->
- ["Provoke lock conflicts with schema transactions and checkpoints."];
-admin_conflict(suite) ->
- [
- create_table,
- delete_table,
- move_table_copy,
- add_table_index,
- del_table_index,
- transform_table,
- snmp_open_table,
- snmp_close_table,
- change_table_copy_type,
- change_table_access,
- add_table_copy,
- del_table_copy,
- dump_tables,
- extra_admin_tests
- ].
create_table(suite) -> [];
create_table(Config) when is_list(Config) ->
@@ -1088,18 +1062,6 @@ insert(Tab, N) when N > 0 ->
ok = mnesia:sync_dirty(fun() -> mnesia:write({Tab, N, N, 0}) end),
insert(Tab, N-1).
-extra_admin_tests(suite) ->
- [del_table_copy_1,
- del_table_copy_2,
- del_table_copy_3,
- add_table_copy_1,
- add_table_copy_2,
- add_table_copy_3,
- add_table_copy_4,
- move_table_copy_1,
- move_table_copy_2,
- move_table_copy_3,
- move_table_copy_4].
update_own(Tab, Key, Acc) ->
Update =
@@ -1347,23 +1309,6 @@ move_table(CallFrom, FromNode, ToNode, [Node1, Node2, Node3], Def) ->
?verify_mnesia([Node1, Node2, Node3], []).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-visibility(doc) ->
- ["Verify the visibility semantics for various configurations"];
-visibility(suite) ->
- [
- dirty_updates_visible_direct,
- dirty_reads_regardless_of_trans,
- trans_update_invisibible_outside_trans,
- trans_update_visible_inside_trans,
- write_shadows,
- delete_shadows,
-%% delete_shadows2,
- write_delete_shadows_bag,
- write_delete_shadows_bag2,
- iteration,
- shadow_search,
- snmp_shadows
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dirty_updates_visible_direct(doc) ->
@@ -1969,10 +1914,6 @@ shadow_search(Config) when is_list(Config) ->
?verify_mnesia([Node1], []).
-removed_resources(suite) ->
- [rr_kill_copy];
-removed_resources(doc) ->
- ["Verify that the locking behave when resources are removed"].
rr_kill_copy(suite) -> [];
rr_kill_copy(Config) when is_list(Config) ->
@@ -2138,11 +2079,6 @@ get_exit(Pid) ->
?error("Timeout EXIT ~p~n", [Pid])
end.
-iteration(doc) ->
- ["Verify that the updates before/during iteration are visable "
- "and that the order is preserved for ordered_set tables"];
-iteration(suite) ->
- [foldl,first_next].
foldl(doc) ->
[""];
diff --git a/lib/mnesia/test/mnesia_majority_test.erl b/lib/mnesia/test/mnesia_majority_test.erl
new file mode 100644
index 0000000000..41ba0fd601
--- /dev/null
+++ b/lib/mnesia/test/mnesia_majority_test.erl
@@ -0,0 +1,186 @@
+%%
+%% %CopyrightBegin%
+%%
+%% Copyright Ericsson AB 2010-2011. 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
+%% compliance with the License. You should have received a copy of the
+%% Erlang Public License along with this software. If not, it can be
+%% retrieved online at http://www.erlang.org/.
+%%
+%% Software distributed under the License is distributed on an "AS IS"
+%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+%% the License for the specific language governing rights and limitations
+%% under the License.
+%%
+%% %CopyrightEnd%
+%%
+
+%%
+-module(mnesia_majority_test).
+-author('[email protected]').
+-compile(export_all).
+-include("mnesia_test_lib.hrl").
+
+init_per_testcase(Func, Conf) ->
+ mnesia_test_lib:init_per_testcase(Func, Conf).
+
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+all() ->
+ [
+ write
+ , wread
+ , delete
+ , clear_table
+ , frag
+ , change_majority
+ , frag_change_majority
+ ].
+
+write(suite) -> [];
+write(Config) when is_list(Config) ->
+ [N1, N2, N3] = ?acquire_nodes(3, Config),
+ Tab = t,
+ Schema = [{name, Tab}, {ram_copies, [N1,N2,N3]}, {majority,true}],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match({[ok,ok,ok],[]},
+ rpc:multicall([N1,N2,N3], mnesia, wait_for_tables, [[Tab], 3000])),
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ mnesia_test_lib:kill_mnesia([N3]),
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({aborted,{no_majority,Tab}},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)).
+
+wread(suite) -> [];
+wread(Config) when is_list(Config) ->
+ [N1, N2] = ?acquire_nodes(2, Config),
+ Tab = t,
+ Schema = [{name, Tab}, {ram_copies, [N1,N2]}, {majority,true}],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match({[ok,ok],[]},
+ rpc:multicall([N1,N2], mnesia, wait_for_tables, [[Tab], 3000])),
+ ?match({atomic,[]},
+ mnesia:transaction(fun() -> mnesia:read(t,1,write) end)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({aborted,{no_majority,Tab}},
+ mnesia:transaction(fun() -> mnesia:read(t,1,write) end)).
+
+delete(suite) -> [];
+delete(Config) when is_list(Config) ->
+ [N1, N2] = ?acquire_nodes(2, Config),
+ Tab = t,
+ Schema = [{name, Tab}, {ram_copies, [N1,N2]}, {majority,true}],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match({[ok,ok],[]},
+ rpc:multicall([N1,N2], mnesia, wait_for_tables, [[Tab], 3000])),
+ %% works as expected with majority of nodes present
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:delete({t,1}) end)),
+ ?match({atomic,[]},
+ mnesia:transaction(fun() -> mnesia:read({t,1}) end)),
+ %% put the record back
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ ?match({atomic,[{t,1,a}]},
+ mnesia:transaction(fun() -> mnesia:read({t,1}) end)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({aborted,{no_majority,Tab}},
+ mnesia:transaction(fun() -> mnesia:delete({t,1}) end)).
+
+clear_table(suite) -> [];
+clear_table(Config) when is_list(Config) ->
+ [N1, N2] = ?acquire_nodes(2, Config),
+ Tab = t,
+ Schema = [{name, Tab}, {ram_copies, [N1,N2]}, {majority,true}],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match({[ok,ok],[]},
+ rpc:multicall([N1,N2], mnesia, wait_for_tables, [[Tab], 3000])),
+ %% works as expected with majority of nodes present
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ ?match({atomic,ok}, mnesia:clear_table(t)),
+ ?match({atomic,[]},
+ mnesia:transaction(fun() -> mnesia:read({t,1}) end)),
+ %% put the record back
+ ?match({atomic,ok},
+ mnesia:transaction(fun() -> mnesia:write({t,1,a}) end)),
+ ?match({atomic,[{t,1,a}]},
+ mnesia:transaction(fun() -> mnesia:read({t,1}) end)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({aborted,{no_majority,Tab}}, mnesia:clear_table(t)).
+
+frag(suite) -> [];
+frag(Config) when is_list(Config) ->
+ [N1] = ?acquire_nodes(1, Config),
+ Tab = t,
+ Schema = [
+ {name, Tab}, {ram_copies, [N1]},
+ {majority,true},
+ {frag_properties, [{n_fragments, 2}]}
+ ],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match(true, mnesia:table_info(t, majority)),
+ ?match(true, mnesia:table_info(t_frag2, majority)).
+
+change_majority(suite) -> [];
+change_majority(Config) when is_list(Config) ->
+ [N1,N2] = ?acquire_nodes(2, Config),
+ Tab = t,
+ Schema = [
+ {name, Tab}, {ram_copies, [N1,N2]},
+ {majority,false}
+ ],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match(false, mnesia:table_info(t, majority)),
+ ?match({atomic, ok},
+ mnesia:change_table_majority(t, true)),
+ ?match(true, mnesia:table_info(t, majority)),
+ ?match(ok,
+ mnesia:activity(transaction, fun() ->
+ mnesia:write({t,1,a})
+ end)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({'EXIT',{aborted,{no_majority,_}}},
+ mnesia:activity(transaction, fun() ->
+ mnesia:write({t,1,a})
+ end)).
+
+frag_change_majority(suite) -> [];
+frag_change_majority(Config) when is_list(Config) ->
+ [N1,N2] = ?acquire_nodes(2, Config),
+ Tab = t,
+ Schema = [
+ {name, Tab}, {ram_copies, [N1,N2]},
+ {majority,false},
+ {frag_properties,
+ [{n_fragments, 2},
+ {n_ram_copies, 2},
+ {node_pool, [N1,N2]}]}
+ ],
+ ?match({atomic, ok}, mnesia:create_table(Schema)),
+ ?match(false, mnesia:table_info(t, majority)),
+ ?match(false, mnesia:table_info(t_frag2, majority)),
+ ?match({aborted,{bad_type,t_frag2}},
+ mnesia:change_table_majority(t_frag2, true)),
+ ?match({atomic, ok},
+ mnesia:change_table_majority(t, true)),
+ ?match(true, mnesia:table_info(t, majority)),
+ ?match(true, mnesia:table_info(t_frag2, majority)),
+ ?match(ok,
+ mnesia:activity(transaction, fun() ->
+ mnesia:write({t,1,a})
+ end, mnesia_frag)),
+ mnesia_test_lib:kill_mnesia([N2]),
+ ?match({'EXIT',{aborted,{no_majority,_}}},
+ mnesia:activity(transaction, fun() ->
+ mnesia:write({t,1,a})
+ end, mnesia_frag)).
diff --git a/lib/mnesia/test/mnesia_measure_test.erl b/lib/mnesia/test/mnesia_measure_test.erl
index fbf804dbec..e63689d83a 100644
--- a/lib/mnesia/test/mnesia_measure_test.erl
+++ b/lib/mnesia/test/mnesia_measure_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2010. 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
@@ -27,8 +27,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(init(N, Config),
mnesia_test_lib:prepare_test_case([{init_test_case, [mnesia]},
@@ -37,101 +37,62 @@ fin_per_testcase(Func, Conf) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Measure various aspects of Mnesia",
- "Verify that Mnesia has predictable response times,",
- "that the transaction system has fair algoritms,",
- "resource consumption, scalabilitym system limits etc.",
- "Perform some benchmarks."];
-all(suite) ->
- [
- prediction,
- consumption,
- scalability,
- benchmarks
- ].
+all() ->
+ [{group, prediction}, {group, consumption},
+ {group, scalability}, {group, benchmarks}].
+
+groups() ->
+ [{prediction, [],
+ [reader_disturbed_by_node_down,
+ writer_disturbed_by_node_down,
+ reader_disturbed_by_node_up,
+ writer_disturbed_by_node_up,
+ reader_disturbed_by_schema_ops,
+ writer_disturbed_by_schema_ops,
+ reader_disturbed_by_checkpoint,
+ writer_disturbed_by_checkpoint,
+ reader_disturbed_by_dump_log,
+ writer_disturbed_by_dump_log,
+ reader_disturbed_by_backup, writer_disturbed_by_backup,
+ reader_disturbed_by_restore,
+ writer_disturbed_by_restore, {group, fairness}]},
+ {fairness, [],
+ [reader_competing_with_reader,
+ reader_competing_with_writer,
+ writer_competing_with_reader,
+ writer_competing_with_writer]},
+ {consumption, [],
+ [measure_resource_consumption,
+ determine_resource_leakage]},
+ {scalability, [],
+ [determine_system_limits, performance_at_min_config,
+ performance_at_max_config, performance_at_full_load,
+ resource_consumption_at_min_config,
+ resource_consumption_at_max_config,
+ resource_consumption_at_full_load]},
+ {benchmarks, [],
+ [{group, meter}, cost, dbn_meters,
+ measure_all_api_functions, {group, tpcb},
+ mnemosyne_vs_mnesia_kernel]},
+ {tpcb, [], [ram_tpcb, disc_tpcb, disc_only_tpcb]},
+ {meter, [], [ram_meter, disc_meter, disc_only_meter]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-prediction(doc) ->
- ["The system must have predictable response times.",
- "The maintenance of the system should not impact on the",
- "availability. Make sure that the response times does not vary too",
- "much from the undisturbed normal usage.",
- "Verify that deadlocks never occurs."];
-prediction(suite) ->
- [
- reader_disturbed_by_node_down,
- writer_disturbed_by_node_down,
- reader_disturbed_by_node_up,
- writer_disturbed_by_node_up,
- reader_disturbed_by_schema_ops,
- writer_disturbed_by_schema_ops,
- reader_disturbed_by_checkpoint,
- writer_disturbed_by_checkpoint,
- reader_disturbed_by_dump_log,
- writer_disturbed_by_dump_log,
- reader_disturbed_by_backup,
- writer_disturbed_by_backup,
- reader_disturbed_by_restore,
- writer_disturbed_by_restore,
- fairness
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-fairness(doc) ->
- ["Verify that the transaction system behaves fair, even under intense",
- "stress. Combine different access patterns (transaction profiles)",
- "in order to verify that concurrent applications gets a fair share",
- "of the database resource. Verify that starvation never may occur."];
-fairness(suite) ->
- [
- reader_competing_with_reader,
- reader_competing_with_writer,
- writer_competing_with_reader,
- writer_competing_with_writer
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-consumption(doc) ->
- ["Measure the resource consumption and publish the outcome. Make",
- "sure that resources are released after failures."];
-consumption(suite) ->
- [
- measure_resource_consumption,
- determine_resource_leakage
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-scalability(doc) ->
- ["Try out where the system limits are. We must at least meet the",
- "documented system limits.",
- "Redo the performance meters for various configurations and load,",
- "especially near system limits."];
-scalability(suite) ->
- [
- determine_system_limits,
- performance_at_min_config,
- performance_at_max_config,
- performance_at_full_load,
- resource_consumption_at_min_config,
- resource_consumption_at_max_config,
- resource_consumption_at_full_load
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-benchmarks(doc) ->
- ["Measure typical database operations and publish them. Try to",
- "verify that new releases of Mnesia always outperforms old",
- "releases, or at least that the meters does not get worse."];
-benchmarks(suite) ->
- [
- meter,
- cost,
- dbn_meters,
- measure_all_api_functions,
- tpcb,
- mnemosyne_vs_mnesia_kernel
- ].
dbn_meters(suite) -> [];
dbn_meters(Config) when is_list(Config) ->
@@ -139,12 +100,6 @@ dbn_meters(Config) when is_list(Config) ->
?match(ok, mnesia_dbn_meters:start()),
ok.
-tpcb(suite) ->
- [
- ram_tpcb,
- disc_tpcb,
- disc_only_tpcb
- ].
tpcb(ReplicaType, Config) ->
HarakiriDelay = {tc_timeout, timer:minutes(20)},
@@ -171,12 +126,6 @@ disc_only_tpcb(suite) -> [];
disc_only_tpcb(Config) when is_list(Config) ->
tpcb(disc_only_copies, Config).
-meter(suite) ->
- [
- ram_meter,
- disc_meter,
- disc_only_meter
- ].
ram_meter(suite) -> [];
ram_meter(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_nice_coverage_test.erl b/lib/mnesia/test/mnesia_nice_coverage_test.erl
index aa9339f6b9..78eab67b11 100644
--- a/lib/mnesia/test/mnesia_nice_coverage_test.erl
+++ b/lib/mnesia/test/mnesia_nice_coverage_test.erl
@@ -28,16 +28,22 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Test nice usage of the entire API",
- "Invoke all functions in the API, at least once.",
- "Try to verify that all functions exists and that they perform",
- "reasonable things when used in the most simple way."];
-all(suite) -> [nice].
+all() ->
+ [nice].
+
+groups() ->
+ [].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
nice(doc) -> [""];
nice(suite) -> [];
diff --git a/lib/mnesia/test/mnesia_qlc_test.erl b/lib/mnesia/test/mnesia_qlc_test.erl
index 1e4f776c7d..5f46840ae9 100644
--- a/lib/mnesia/test/mnesia_qlc_test.erl
+++ b/lib/mnesia/test/mnesia_qlc_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
+%% Copyright Ericsson AB 2004-2011. 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
@@ -22,7 +22,7 @@
-compile(export_all).
--export([all/1]).
+-export([all/0,groups/0,init_per_group/2,end_per_group/2]).
-include("mnesia_test_lib.hrl").
-include_lib("stdlib/include/qlc.hrl").
@@ -31,20 +31,34 @@ init_per_testcase(Func, Conf) ->
setup(Conf),
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-all(doc) ->
- ["Test that the qlc mnesia interface works as expected."];
-all(suite) ->
+all() ->
case code:which(qlc) of
non_existing -> [];
- _ ->
- all_qlc()
+ _ -> all_qlc()
end.
-all_qlc() ->
- [dirty, trans, frag, info, mnesia_down].
+groups() ->
+ [{dirty, [],
+ [dirty_nice_ram_copies, dirty_nice_disc_copies,
+ dirty_nice_disc_only_copies]},
+ {trans, [],
+ [trans_nice_ram_copies, trans_nice_disc_copies,
+ trans_nice_disc_only_copies, {group, atomic}]},
+ {atomic, [], [atomic_eval]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
+
+all_qlc() ->
+ [{group, dirty}, {group, trans}, frag, info,
+ mnesia_down].
init_testcases(Type,Config) ->
Nodes = [N1,N2] = ?acquire_nodes(2, Config),
@@ -56,13 +70,10 @@ init_testcases(Type,Config) ->
end,
All = fun() -> [Write(Id) || Id <- lists:seq(1,10)], ok end,
?match({atomic, ok}, mnesia:sync_transaction(All)),
+ ?match({atomic, [{b, {b,100-1}, 1}]}, mnesia:transaction(fun() -> mnesia:read({b, {b, 99}}) end)),
Nodes.
%% Test cases
-dirty(suite) ->
- [dirty_nice_ram_copies,
- dirty_nice_disc_copies,
- dirty_nice_disc_only_copies].
dirty_nice_ram_copies(Setup) -> dirty_nice(Setup,ram_copies).
dirty_nice_disc_copies(Setup) -> dirty_nice(Setup,disc_copies).
@@ -109,12 +120,6 @@ dirty_nice(Config, Type) when is_list(Config) ->
end,
?verify_mnesia(Ns, []).
-trans(suite) ->
- [trans_nice_ram_copies,
- trans_nice_disc_copies,
- trans_nice_disc_only_copies,
- atomic
- ].
trans_nice_ram_copies(Setup) -> trans_nice(Setup,ram_copies).
trans_nice_disc_copies(Setup) -> trans_nice(Setup,disc_copies).
@@ -182,9 +187,7 @@ recs() ->
"-record(b, {k,v}). "
"-record(k, {t,v}). "
>>.
-
-atomic(suite) -> [atomic_eval];
-atomic(doc) -> [].
+
atomic_eval(suite) -> [];
atomic_eval(doc) -> [];
diff --git a/lib/mnesia/test/mnesia_recovery_test.erl b/lib/mnesia/test/mnesia_recovery_test.erl
index f6ecf2ce2e..625e6e824c 100644
--- a/lib/mnesia/test/mnesia_recovery_test.erl
+++ b/lib/mnesia/test/mnesia_recovery_test.erl
@@ -28,8 +28,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)).
@@ -42,34 +42,93 @@ fin_per_testcase(Func, Conf) ->
-endif.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify recoverability",
- "Verify that the effects of committed transactions are preserved",
- "after recovery from system failures. It must be possible to",
- "restore the tables to a consistent state on a node, from (any kind",
- "of) replica on other nodes as well as from local disk on the failed",
- "node. The system must also recover from instantaneous",
- "interruption causing disk files to not be completely synchronized."];
-
-all(suite) ->
- [
- mnesia_down,
- explicit_stop,
- coord_dies,
- schema_trans,
- async_dirty,
- sync_dirty,
- sym_trans,
- asym_trans,
- after_full_disc_partition,
- after_corrupt_files,
- disc_less,
- garb_decision,
- system_upgrade
- ].
-
-schema_trans(suite) ->
- [{mnesia_schema_recovery_test, all}].
+all() ->
+ [{group, mnesia_down}, {group, explicit_stop},
+ coord_dies, {group, schema_trans}, {group, async_dirty},
+ {group, sync_dirty}, {group, sym_trans},
+ {group, asym_trans}, after_full_disc_partition,
+ {group, after_corrupt_files}, disc_less, garb_decision,
+ system_upgrade].
+
+groups() ->
+ [{schema_trans, [],
+ [{mnesia_schema_recovery_test, all}]},
+ {mnesia_down, [],
+ [{group, mnesia_down_during_startup},
+ {group, master_node_tests}, {group, read_during_down},
+ {group, with_checkpoint}, delete_during_start]},
+ {master_node_tests, [],
+ [no_master_2, no_master_3, one_master_2, one_master_3,
+ two_master_2, two_master_3, all_master_2,
+ all_master_3]},
+ {read_during_down, [],
+ [dirty_read_during_down, trans_read_during_down]},
+ {mnesia_down_during_startup, [],
+ [mnesia_down_during_startup_disk_ram,
+ mnesia_down_during_startup_init_ram,
+ mnesia_down_during_startup_init_disc,
+ mnesia_down_during_startup_init_disc_only,
+ mnesia_down_during_startup_tm_ram,
+ mnesia_down_during_startup_tm_disc,
+ mnesia_down_during_startup_tm_disc_only]},
+ {with_checkpoint, [],
+ [with_checkpoint_same, with_checkpoint_other]},
+ {explicit_stop, [], [explicit_stop_during_snmp]},
+ {sym_trans, [],
+ [sym_trans_before_commit_kill_coord_node,
+ sym_trans_before_commit_kill_coord_pid,
+ sym_trans_before_commit_kill_part_after_ask,
+ sym_trans_before_commit_kill_part_before_ask,
+ sym_trans_after_commit_kill_coord_node,
+ sym_trans_after_commit_kill_coord_pid,
+ sym_trans_after_commit_kill_part_after_ask,
+ sym_trans_after_commit_kill_part_do_commit_pre,
+ sym_trans_after_commit_kill_part_do_commit_post]},
+ {sync_dirty, [],
+ [sync_dirty_pre_kill_part,
+ sync_dirty_pre_kill_coord_node,
+ sync_dirty_pre_kill_coord_pid,
+ sync_dirty_post_kill_part,
+ sync_dirty_post_kill_coord_node,
+ sync_dirty_post_kill_coord_pid]},
+ {async_dirty, [],
+ [async_dirty_pre_kill_part,
+ async_dirty_pre_kill_coord_node,
+ async_dirty_pre_kill_coord_pid,
+ async_dirty_post_kill_part,
+ async_dirty_post_kill_coord_node,
+ async_dirty_post_kill_coord_pid]},
+ {asym_trans, [],
+ [asym_trans_kill_part_ask,
+ asym_trans_kill_part_commit_vote,
+ asym_trans_kill_part_pre_commit,
+ asym_trans_kill_part_log_commit,
+ asym_trans_kill_part_do_commit,
+ asym_trans_kill_coord_got_votes,
+ asym_trans_kill_coord_pid_got_votes,
+ asym_trans_kill_coord_log_commit_rec,
+ asym_trans_kill_coord_pid_log_commit_rec,
+ asym_trans_kill_coord_log_commit_dec,
+ asym_trans_kill_coord_pid_log_commit_dec,
+ asym_trans_kill_coord_rec_acc_pre_commit_log_commit,
+ asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit,
+ asym_trans_kill_coord_rec_acc_pre_commit_done_commit,
+ asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit]},
+ {after_corrupt_files, [],
+ [after_corrupt_files_decision_log_head,
+ after_corrupt_files_decision_log_tail,
+ after_corrupt_files_latest_log_head,
+ after_corrupt_files_latest_log_tail,
+ after_corrupt_files_table_dat_head,
+ after_corrupt_files_table_dat_tail,
+ after_corrupt_files_schema_dat_head,
+ after_corrupt_files_schema_dat_tail]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
tpcb_config(ReplicaType, _NodeConfig, Nodes) ->
[{n_branches, 5},
@@ -83,30 +142,7 @@ tpcb_config(ReplicaType, _NodeConfig, Nodes) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-mnesia_down(doc) ->
- [" Various tests about recovery when mnesia goes down on one or several nodes."];
-mnesia_down(suite) ->
- [
- mnesia_down_during_startup,
- master_node_tests,
- read_during_down,
- with_checkpoint,
- delete_during_start
- ].
-
-master_node_tests(doc) ->
- ["Verify that mnesia loads the correct data after it has been down, regarding master node settings."];
-master_node_tests(suite) ->
- [
- no_master_2,
- no_master_3,
- one_master_2,
- one_master_3,
- two_master_2,
- two_master_3,
- all_master_2,
- all_master_3
- ].
+
no_master_2(suite) -> [];
no_master_2(Config) when is_list(Config) -> mnesia_down_2(no, Config).
@@ -251,13 +287,6 @@ mnesia_down_3(Masters, Config) ->
?verify_mnesia(Nodes, []).
-read_during_down(doc) ->
- ["Verify that read operation can continue to read when mnesia goes down"];
-read_during_down(suite) ->
- [
- dirty_read_during_down,
- trans_read_during_down
- ].
dirty_read_during_down(suite) ->
[];
@@ -325,20 +354,6 @@ loop_and_kill_mnesia(N, Node, Tabs) ->
timer:sleep(100),
loop_and_kill_mnesia(N-1, KN, Tabs).
-mnesia_down_during_startup(doc) ->
- ["Verify that mnesia can come back up again in a consistent state",
- "after it has gone down during startup (with different store and",
- "when it goes down in different situations"];
-mnesia_down_during_startup(suite) ->
- [
- mnesia_down_during_startup_disk_ram,
- mnesia_down_during_startup_init_ram,
- mnesia_down_during_startup_init_disc,
- mnesia_down_during_startup_init_disc_only,
- mnesia_down_during_startup_tm_ram,
- mnesia_down_during_startup_tm_disc,
- mnesia_down_during_startup_tm_disc_only
- ].
mnesia_down_during_startup_disk_ram(suite) -> [];
mnesia_down_during_startup_disk_ram(Config) when is_list(Config)->
@@ -433,10 +448,6 @@ mnesia_down_during_startup2(Config, ReplicaType, Debug_Point, _Father) ->
?verify_mnesia(Nodes, []).
-with_checkpoint(doc) ->
- ["Restart mnesia with checkpoint"];
-with_checkpoint(suite) ->
- [with_checkpoint_same, with_checkpoint_other].
with_checkpoint_same(suite) -> [];
with_checkpoint_same(Config) when is_list(Config) ->
@@ -581,10 +592,6 @@ verify_where2read([]) -> ok.
%%-------------------------------------------------------------------------------------------
-explicit_stop(doc) ->
- ["Stop Mnesia in different situations"];
-explicit_stop(suite) ->
- [explicit_stop_during_snmp].
%% This is a bad implementation, but at least gives a indication if something is wrong
explicit_stop_during_snmp(suite) -> [];
explicit_stop_during_snmp(Config) when is_list(Config) ->
@@ -700,21 +707,7 @@ coord_dies(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-sym_trans(doc) ->
- ["Recovery of symmetrical transactions in a couple of different",
- "situations; when coordinator or participant or node dies"];
-
-sym_trans(suite) ->
- [sym_trans_before_commit_kill_coord_node, %% coordinator node dies
- sym_trans_before_commit_kill_coord_pid, %% coordinator process dies
- sym_trans_before_commit_kill_part_after_ask, %% participating node dies
- sym_trans_before_commit_kill_part_before_ask,
- sym_trans_after_commit_kill_coord_node,
- sym_trans_after_commit_kill_coord_pid,
- sym_trans_after_commit_kill_part_after_ask,
- sym_trans_after_commit_kill_part_do_commit_pre,
- sym_trans_after_commit_kill_part_do_commit_post].
+
%kill_after_debug_point(Config, TestCase, {Debug_node, Debug_Point}, TransFun, Tab)
@@ -828,17 +821,6 @@ do_sym_trans([Tab], _Fahter) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-sync_dirty(doc) ->
- ["Verify recovery of synchronously operations in a couple of different",
- "situations"];
-sync_dirty(suite) ->
- [sync_dirty_pre_kill_part,
- sync_dirty_pre_kill_coord_node,
- sync_dirty_pre_kill_coord_pid,
- sync_dirty_post_kill_part,
- sync_dirty_post_kill_coord_node,
- sync_dirty_post_kill_coord_pid
- ].
sync_dirty_pre_kill_part(suite) -> [];
sync_dirty_pre_kill_part(Config) when is_list(Config) ->
@@ -916,16 +898,6 @@ do_sync_dirty([Tab], _Father) ->
?dl("SYNC_DIRTY done: ~p ", [Res]),
ok.
-async_dirty(doc) ->
- ["Verify recovery of asynchronously dirty operations in a couple of different",
- "situations"];
-async_dirty(suite) ->
- [async_dirty_pre_kill_part,
- async_dirty_pre_kill_coord_node,
- async_dirty_pre_kill_coord_pid,
- async_dirty_post_kill_part,
- async_dirty_post_kill_coord_node,
- async_dirty_post_kill_coord_pid].
async_dirty_pre_kill_part(suite) -> [];
async_dirty_pre_kill_part(Config) when is_list(Config) ->
@@ -1005,29 +977,6 @@ do_async_dirty([Tab], _Fahter) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-asym_trans(doc) ->
- ["Recovery of asymmetrical transactions in a couple of different",
- "situations, currently the error cases are not covered, i.e. ",
- "not tested are the situations when we kill mnesia or a process",
- "during a recovery"];
-asym_trans(suite) ->
- [
- asym_trans_kill_part_ask,
- asym_trans_kill_part_commit_vote,
- asym_trans_kill_part_pre_commit,
- asym_trans_kill_part_log_commit,
- asym_trans_kill_part_do_commit,
- asym_trans_kill_coord_got_votes,
- asym_trans_kill_coord_pid_got_votes,
- asym_trans_kill_coord_log_commit_rec,
- asym_trans_kill_coord_pid_log_commit_rec,
- asym_trans_kill_coord_log_commit_dec,
- asym_trans_kill_coord_pid_log_commit_dec,
- asym_trans_kill_coord_rec_acc_pre_commit_log_commit,
- asym_trans_kill_coord_pid_rec_acc_pre_commit_log_commit,
- asym_trans_kill_coord_rec_acc_pre_commit_done_commit,
- asym_trans_kill_coord_pid_rec_acc_pre_commit_done_commit
- ].
asym_trans_kill_part_ask(suite) -> [];
asym_trans_kill_part_ask(Config) when is_list(Config) ->
@@ -1435,18 +1384,6 @@ after_full_disc_partition(doc) ->
%% interrupted_fallback_start
%% is implemented in consistency interupted_install_fallback!
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-after_corrupt_files(doc) ->
- ["Verify that mnesia (and dets) can handle corrupt files"];
-after_corrupt_files(suite) -> % cope with unsynced disks
- [after_corrupt_files_decision_log_head,
- after_corrupt_files_decision_log_tail,
- after_corrupt_files_latest_log_head,
- after_corrupt_files_latest_log_tail,
- after_corrupt_files_table_dat_head,
- after_corrupt_files_table_dat_tail,
- after_corrupt_files_schema_dat_head,
- after_corrupt_files_schema_dat_tail
- ].
after_corrupt_files_decision_log_head(suite) -> [];
after_corrupt_files_decision_log_head(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_registry_test.erl b/lib/mnesia/test/mnesia_registry_test.erl
index 2305ef93b7..cf8da38632 100644
--- a/lib/mnesia/test/mnesia_registry_test.erl
+++ b/lib/mnesia/test/mnesia_registry_test.erl
@@ -26,17 +26,22 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Test the mnesia_registry module"];
-all(suite) ->
- [
- good_dump,
- bad_dump
- ].
+all() ->
+ [good_dump, bad_dump].
+
+groups() ->
+ [].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
good_dump(doc) ->
diff --git a/lib/mnesia/test/mnesia_schema_recovery_test.erl b/lib/mnesia/test/mnesia_schema_recovery_test.erl
index 387238ae6b..0fe26efd0b 100644
--- a/lib/mnesia/test/mnesia_schema_recovery_test.erl
+++ b/lib/mnesia/test/mnesia_schema_recovery_test.erl
@@ -26,8 +26,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(receive_messages(Msgs), receive_messages(Msgs, ?FILE, ?LINE)).
@@ -41,92 +41,82 @@ fin_per_testcase(Func, Conf) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Verify recoverabiliy of schema transactions.",
- " Verify that a schema transaction",
- " can be completed when it has been logged correctly and Mnesia",
- " crashed before the log has been dumped. Then the transaction ",
- " should be handled during the log dump at startup"
- ];
-all(suite) ->
- [interrupted_before_log_dump,
- interrupted_after_log_dump].
-
-interrupted_before_log_dump(suite) ->
- [interrupted_before_create_ram,
- interrupted_before_create_disc,
- interrupted_before_create_disc_only,
- interrupted_before_create_nostore,
- interrupted_before_delete_ram,
- interrupted_before_delete_disc,
- interrupted_before_delete_disc_only,
- interrupted_before_add_ram,
- interrupted_before_add_disc,
- interrupted_before_add_disc_only,
- interrupted_before_add_kill_copier,
- interrupted_before_move_ram,
- interrupted_before_move_disc,
- interrupted_before_move_disc_only,
- interrupted_before_move_kill_copier,
- interrupted_before_delcopy_ram,
- interrupted_before_delcopy_disc,
- interrupted_before_delcopy_disc_only,
- interrupted_before_delcopy_kill_copier,
- interrupted_before_addindex_ram,
- interrupted_before_addindex_disc,
- interrupted_before_addindex_disc_only,
- interrupted_before_delindex_ram,
- interrupted_before_delindex_disc,
- interrupted_before_delindex_disc_only,
- interrupted_before_change_type_ram2disc,
- interrupted_before_change_type_ram2disc_only,
- interrupted_before_change_type_disc2ram,
- interrupted_before_change_type_disc2disc_only,
- interrupted_before_change_type_disc_only2ram,
- interrupted_before_change_type_disc_only2disc,
- interrupted_before_change_type_other_node,
- interrupted_before_change_schema_type %% Change schema table copy type!!
- ].
-
-interrupted_after_log_dump(suite) ->
- [interrupted_after_create_ram,
- interrupted_after_create_disc,
- interrupted_after_create_disc_only,
- interrupted_after_create_nostore,
- interrupted_after_delete_ram,
- interrupted_after_delete_disc,
- interrupted_after_delete_disc_only,
- interrupted_after_add_ram,
- interrupted_after_add_disc,
- interrupted_after_add_disc_only,
- interrupted_after_add_kill_copier,
- interrupted_after_move_ram,
- interrupted_after_move_disc,
- interrupted_after_move_disc_only,
- interrupted_after_move_kill_copier,
- interrupted_after_delcopy_ram,
- interrupted_after_delcopy_disc,
- interrupted_after_delcopy_disc_only,
- interrupted_after_delcopy_kill_copier,
- interrupted_after_addindex_ram,
- interrupted_after_addindex_disc,
- interrupted_after_addindex_disc_only,
- interrupted_after_delindex_ram,
- interrupted_after_delindex_disc,
- interrupted_after_delindex_disc_only,
- interrupted_after_change_type_ram2disc,
- interrupted_after_change_type_ram2disc_only,
- interrupted_after_change_type_disc2ram,
- interrupted_after_change_type_disc2disc_only,
- interrupted_after_change_type_disc_only2ram,
- interrupted_after_change_type_disc_only2disc,
- interrupted_after_change_type_other_node,
- interrupted_after_change_schema_type %% Change schema table copy type!!
-
-% interrupted_before_change_access_mode,
-% interrupted_before_transform,
-% interrupted_before_restore,
- ].
+all() ->
+ [{group, interrupted_before_log_dump},
+ {group, interrupted_after_log_dump}].
+
+groups() ->
+ [{interrupted_before_log_dump, [],
+ [interrupted_before_create_ram,
+ interrupted_before_create_disc,
+ interrupted_before_create_disc_only,
+ interrupted_before_create_nostore,
+ interrupted_before_delete_ram,
+ interrupted_before_delete_disc,
+ interrupted_before_delete_disc_only,
+ interrupted_before_add_ram, interrupted_before_add_disc,
+ interrupted_before_add_disc_only,
+ interrupted_before_add_kill_copier,
+ interrupted_before_move_ram,
+ interrupted_before_move_disc,
+ interrupted_before_move_disc_only,
+ interrupted_before_move_kill_copier,
+ interrupted_before_delcopy_ram,
+ interrupted_before_delcopy_disc,
+ interrupted_before_delcopy_disc_only,
+ interrupted_before_delcopy_kill_copier,
+ interrupted_before_addindex_ram,
+ interrupted_before_addindex_disc,
+ interrupted_before_addindex_disc_only,
+ interrupted_before_delindex_ram,
+ interrupted_before_delindex_disc,
+ interrupted_before_delindex_disc_only,
+ interrupted_before_change_type_ram2disc,
+ interrupted_before_change_type_ram2disc_only,
+ interrupted_before_change_type_disc2ram,
+ interrupted_before_change_type_disc2disc_only,
+ interrupted_before_change_type_disc_only2ram,
+ interrupted_before_change_type_disc_only2disc,
+ interrupted_before_change_type_other_node,
+ interrupted_before_change_schema_type]},
+ {interrupted_after_log_dump, [],
+ [interrupted_after_create_ram,
+ interrupted_after_create_disc,
+ interrupted_after_create_disc_only,
+ interrupted_after_create_nostore,
+ interrupted_after_delete_ram,
+ interrupted_after_delete_disc,
+ interrupted_after_delete_disc_only,
+ interrupted_after_add_ram, interrupted_after_add_disc,
+ interrupted_after_add_disc_only,
+ interrupted_after_add_kill_copier,
+ interrupted_after_move_ram, interrupted_after_move_disc,
+ interrupted_after_move_disc_only,
+ interrupted_after_move_kill_copier,
+ interrupted_after_delcopy_ram,
+ interrupted_after_delcopy_disc,
+ interrupted_after_delcopy_disc_only,
+ interrupted_after_delcopy_kill_copier,
+ interrupted_after_addindex_ram,
+ interrupted_after_addindex_disc,
+ interrupted_after_addindex_disc_only,
+ interrupted_after_delindex_ram,
+ interrupted_after_delindex_disc,
+ interrupted_after_delindex_disc_only,
+ interrupted_after_change_type_ram2disc,
+ interrupted_after_change_type_ram2disc_only,
+ interrupted_after_change_type_disc2ram,
+ interrupted_after_change_type_disc2disc_only,
+ interrupted_after_change_type_disc_only2ram,
+ interrupted_after_change_type_disc_only2disc,
+ interrupted_after_change_type_other_node,
+ interrupted_after_change_schema_type]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
interrupted_before_create_ram(suite) -> [];
interrupted_before_create_ram(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mnesia_test_lib.erl b/lib/mnesia/test/mnesia_test_lib.erl
index 1e98f017f7..9da45975d5 100644
--- a/lib/mnesia/test/mnesia_test_lib.erl
+++ b/lib/mnesia/test/mnesia_test_lib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. 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
@@ -130,7 +130,7 @@
doc/1,
struct/1,
init_per_testcase/2,
- fin_per_testcase/2,
+ end_per_testcase/2,
kill_tc/2
]).
@@ -144,7 +144,7 @@ init_per_testcase(_Func, Config) ->
global:register_name(mnesia_global_logger, group_leader()),
Config.
-fin_per_testcase(_Func, Config) ->
+end_per_testcase(_Func, Config) ->
global:unregister_name(mnesia_global_logger),
%% Nodes = select_nodes(all, Config, ?FILE, ?LINE),
%% rpc:multicall(Nodes, mnesia, lkill, []),
@@ -413,32 +413,28 @@ test_driver([T|TestCases], Config) ->
[L1|L2];
test_driver({Module, TestCases}, Config) when is_list(TestCases)->
test_driver(default_module(Module, TestCases), Config);
-test_driver({_, {Module, TestCase}}, Config) ->
- test_driver({Module, TestCase}, Config);
+test_driver({Module, all}, Config) ->
+ get_suite(Module, all, Config);
+test_driver({Module, G={group, _}}, Config) ->
+ get_suite(Module, G, Config);
+test_driver({_, {group, Module, Group}}, Config) ->
+ get_suite(Module, {group, Group}, Config);
+
test_driver({Module, TestCase}, Config) ->
Sec = timer:seconds(1) * 1000,
- case get_suite(Module, TestCase) of
- [] when Config == suite ->
+ case Config of
+ suite ->
{Module, TestCase, 'IMPL'};
- [] ->
+ _ ->
log("Eval test case: ~w~n", [{Module, TestCase}]),
- {T, Res} =
- timer:tc(?MODULE, eval_test_case, [Module, TestCase, Config]),
- log("Tested ~w in ~w sec~n", [TestCase, T div Sec]),
- {T div Sec, Res};
- Suite when is_list(Suite), Config == suite ->
- Res = test_driver(default_module(Module, Suite), Config),
- {{Module, TestCase}, Res};
- Suite when is_list(Suite) ->
- log("Expand test case ~w~n", [{Module, TestCase}]),
- Def = default_module(Module, Suite),
- {T, Res} = timer:tc(?MODULE, test_driver, [Def, Config]),
- {T div Sec, {{Module, TestCase}, Res}};
- 'NYI' when Config == suite ->
- {Module, TestCase, 'NYI'};
- 'NYI' ->
- log("<WARNING> Test case ~w NYI~n", [{Module, TestCase}]),
- {0, {skip, {Module, TestCase}, "NYI"}}
+ try timer:tc(?MODULE, eval_test_case, [Module, TestCase, Config]) of
+ {T, Res} ->
+ log("Tested ~w in ~w sec~n", [TestCase, T div Sec]),
+ {T div Sec, Res}
+ catch error:function_clause ->
+ log("<WARNING> Test case ~w NYI~n", [{Module, TestCase}]),
+ {0, {skip, {Module, TestCase}, "NYI"}}
+ end
end;
test_driver(TestCase, Config) ->
DefaultModule = mnesia_SUITE,
@@ -449,18 +445,50 @@ test_driver(TestCase, Config) ->
default_module(DefaultModule, TestCases) when is_list(TestCases) ->
Fun = fun(T) ->
case T of
+ {group, _} -> {true, {DefaultModule, T}};
{_, _} -> true;
T -> {true, {DefaultModule, T}}
end
end,
lists:zf(Fun, TestCases).
+get_suite(Module, TestCase, Config) ->
+ case get_suite(Module, TestCase) of
+ Suite when is_list(Suite), Config == suite ->
+ Res = test_driver(default_module(Module, Suite), Config),
+ {{Module, TestCase}, Res};
+ Suite when is_list(Suite) ->
+ log("Expand test case ~w~n", [{Module, TestCase}]),
+ Def = default_module(Module, Suite),
+ {T, Res} = timer:tc(?MODULE, test_driver, [Def, Config]),
+ Sec = timer:seconds(1) * 1000,
+ {T div Sec, {{Module, TestCase}, Res}};
+ 'NYI' when Config == suite ->
+ {Module, TestCase, 'NYI'};
+ 'NYI' ->
+ log("<WARNING> Test case ~w NYI~n", [{Module, TestCase}]),
+ {0, {skip, {Module, TestCase}, "NYI"}}
+ end.
+
%% Returns a list (possibly empty) or the atom 'NYI'
-get_suite(Mod, Fun) ->
- case catch (apply(Mod, Fun, [suite])) of
+get_suite(Mod, {group, Suite}) ->
+ try
+ Groups = Mod:groups(),
+ {_, _, TCList} = lists:keyfind(Suite, 1, Groups),
+ TCList
+ catch
+ _:Reason ->
+ io:format("Not implemented ~p ~p (~p ~p)~n",
+ [Mod,Suite,Reason, erlang:get_stacktrace()]),
+ 'NYI'
+ end;
+get_suite(Mod, all) ->
+ case catch (apply(Mod, all, [])) of
{'EXIT', _} -> 'NYI';
List when is_list(List) -> List
- end.
+ end;
+get_suite(_Mod, _Fun) ->
+ [].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -492,20 +520,24 @@ wait_for_evaluator(Pid, Mod, Fun, Config) ->
{'EXIT', Pid, {skipped, Reason}} ->
log("<WARNING> Test case ~w skipped, because ~p~n",
[{Mod, Fun}, Reason]),
- Mod:fin_per_testcase(Fun, Config),
+ Mod:end_per_testcase(Fun, Config),
{skip, {Mod, Fun}, Reason};
{'EXIT', Pid, Reason} ->
log("<>ERROR<> Eval process ~w exited, because ~p~n",
[{Mod, Fun}, Reason]),
- Mod:fin_per_testcase(Fun, Config),
+ Mod:end_per_testcase(Fun, Config),
{crash, {Mod, Fun}, Reason}
end.
test_case_evaluator(Mod, Fun, [Config]) ->
NewConfig = Mod:init_per_testcase(Fun, Config),
- R = apply(Mod, Fun, [NewConfig]),
- Mod:fin_per_testcase(Fun, NewConfig),
- exit({test_case_ok, R}).
+ try
+ R = apply(Mod, Fun, [NewConfig]),
+ Mod:end_per_testcase(Fun, NewConfig),
+ exit({test_case_ok, R})
+ catch error:function_clause ->
+ exit({skipped, 'NYI'})
+ end.
activity_evaluator(Coordinator) ->
activity_evaluator_loop(Coordinator),
diff --git a/lib/mnesia/test/mnesia_test_lib.hrl b/lib/mnesia/test/mnesia_test_lib.hrl
index 85f12200d4..fc377dbd2c 100644
--- a/lib/mnesia/test/mnesia_test_lib.hrl
+++ b/lib/mnesia/test/mnesia_test_lib.hrl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. 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
diff --git a/lib/mnesia/test/mnesia_tpcb.erl b/lib/mnesia/test/mnesia_tpcb.erl
index 903c53a21c..595412ff24 100644
--- a/lib/mnesia/test/mnesia_tpcb.erl
+++ b/lib/mnesia/test/mnesia_tpcb.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2010. 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
diff --git a/lib/mnesia/test/mnesia_trans_access_test.erl b/lib/mnesia/test/mnesia_trans_access_test.erl
index c67382e694..ca3f0fbf49 100644
--- a/lib/mnesia/test/mnesia_trans_access_test.erl
+++ b/lib/mnesia/test/mnesia_trans_access_test.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2011. 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
@@ -26,8 +26,8 @@
init_per_testcase(Func, Conf) ->
mnesia_test_lib:init_per_testcase(Func, Conf).
-fin_per_testcase(Func, Conf) ->
- mnesia_test_lib:fin_per_testcase(Func, Conf).
+end_per_testcase(Func, Conf) ->
+ mnesia_test_lib:end_per_testcase(Func, Conf).
-define(receive_messages(Msgs), mnesia_recovery_test:receive_messages(Msgs, ?FILE, ?LINE)).
@@ -40,18 +40,41 @@ fin_per_testcase(Func, Conf) ->
-endif.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-all(doc) ->
- ["Evil access of records in the scope of transactions",
- "Invoke all functions in the API and try to cover all legal uses",
- "cases as well the illegal dito. This is a complement to the",
- "other more explicit test cases."];
-all(suite) ->
- [
- write, read, wread, delete, delete_object,
- match_object, select, select14, all_keys,
- transaction, nested_activities,
- index_tabs, index_lifecycle
- ].
+all() ->
+ [write, read, wread, delete, delete_object,
+ match_object, select, select14, all_keys, transaction,
+ {group, nested_activities}, {group, index_tabs},
+ {group, index_lifecycle}].
+
+groups() ->
+ [{nested_activities, [],
+ [basic_nested, {group, nested_transactions},
+ mix_of_nested_activities]},
+ {nested_transactions, [],
+ [nested_trans_both_ok, nested_trans_child_dies,
+ nested_trans_parent_dies, nested_trans_both_dies]},
+ {index_tabs, [],
+ [index_match_object, index_read, {group, index_update},
+ index_write]},
+ {index_update, [],
+ [index_update_set, index_update_bag]},
+ {index_lifecycle, [],
+ [add_table_index_ram, add_table_index_disc,
+ add_table_index_disc_only, create_live_table_index_ram,
+ create_live_table_index_disc,
+ create_live_table_index_disc_only, del_table_index_ram,
+ del_table_index_disc, del_table_index_disc_only,
+ {group, idx_schema_changes}]},
+ {idx_schema_changes, [],
+ [idx_schema_changes_ram, idx_schema_changes_disc,
+ idx_schema_changes_disc_only]}].
+
+init_per_group(_GroupName, Config) ->
+ Config.
+
+end_per_group(_GroupName, Config) ->
+ Config.
+
%% Write records
@@ -404,12 +427,6 @@ transaction(Config) when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-nested_activities(suite) ->
- [
- basic_nested,
- nested_transactions,
- mix_of_nested_activities
- ].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -520,13 +537,6 @@ n_f4() ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-nested_transactions(doc) ->
- ["Verify that nested_transactions are handled as expected"];
-nested_transactions(suite) ->
- [nested_trans_both_ok,
- nested_trans_child_dies,
- nested_trans_parent_dies,
- nested_trans_both_dies].
nested_trans_both_ok(suite) -> [];
nested_trans_both_ok(Config) when is_list(Config) ->
@@ -671,13 +681,6 @@ read_op(Oid) ->
Ops
end.
-index_tabs(suite) ->
- [
- index_match_object,
- index_read,
- index_update,
- index_write
- ].
%% Read matching records by using an index
@@ -767,10 +770,6 @@ index_read(Config) when is_list(Config) ->
?match({'EXIT', {aborted, no_transaction}}, mnesia:index_read(Tab, 2, ValPos)),
?verify_mnesia(Nodes, []).
-index_update(suite) -> [index_update_set, index_update_bag];
-index_update(doc) -> ["See Ticket OTP-2083, verifies that a table with a index is "
- "update in the correct way i.e. the index finds the correct "
- "records after a update"].
index_update_set(suite) -> [];
index_update_set(Config)when is_list(Config) ->
[Node1] = Nodes = ?acquire_nodes(1, Config),
@@ -1046,19 +1045,6 @@ index_write(Config)when is_list(Config) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Add and drop indecies
-index_lifecycle(suite) ->
- [
- add_table_index_ram,
- add_table_index_disc,
- add_table_index_disc_only,
- create_live_table_index_ram,
- create_live_table_index_disc,
- create_live_table_index_disc_only,
- del_table_index_ram,
- del_table_index_disc,
- del_table_index_disc_only,
- idx_schema_changes
- ].
add_table_index_ram(suite) -> [];
add_table_index_ram(Config) when is_list(Config) ->
@@ -1116,9 +1102,9 @@ create_live_table_index_disc_only(Config) when is_list(Config) ->
create_live_table_index(Config, disc_only_copies).
create_live_table_index(Config, Storage) ->
- [Node1] = Nodes = ?acquire_nodes(1, Config),
+ [N1,N2,N3] = Nodes = ?acquire_nodes(3, Config),
Tab = create_live_table_index,
- Schema = [{name, Tab}, {attributes, [k, v]}, {Storage, [Node1]}],
+ Schema = [{name, Tab}, {attributes, [k, v]}, {Storage, Nodes}],
?match({atomic, ok}, mnesia:create_table(Schema)),
ValPos = 3,
mnesia:dirty_write({Tab, 1, 2}),
@@ -1129,9 +1115,35 @@ create_live_table_index(Config, Storage) ->
end,
?match({atomic, ok}, mnesia:transaction(Fun)),
?match({atomic, ok}, mnesia:add_table_index(Tab, ValPos)),
+ IRead = fun() -> lists:sort(mnesia:index_read(Tab, 2, ValPos)) end,
+ ?match({atomic, [{Tab, 1, 2},{Tab, 2, 2}]}, mnesia:transaction(IRead)),
+ ?match({atomic, ok}, mnesia:del_table_index(Tab, ValPos)),
+
+ %% Bug when adding index when table is still unloaded
+ %% By setting load order we hopefully will trigger the bug
+ mnesia:change_table_copy_type(Tab, N2, ram_copies),
+ mnesia:change_table_copy_type(Tab, N3, ram_copies),
+ ?match({atomic,ok}, mnesia:change_table_copy_type(schema, N2, ram_copies)),
+ ?match({atomic,ok}, mnesia:change_table_copy_type(schema, N3, ram_copies)),
+
+ Create = fun(N) ->
+ TabN = list_to_atom("tab_" ++ integer_to_list(N)),
+ Def = [{ram_copies, Nodes}, {load_order, N}],
+ mnesia:create_table(TabN, Def)
+ end,
+
+ ?match([{atomic,ok}|_], [Create(N) || N <- lists:seq(1,50)]),
+
+ ?match([], mnesia_test_lib:stop_mnesia([N2,N3])),
+ ?match(ok, rpc:call(N2, mnesia, start, [[{extra_db_nodes,[N1]}]])),
+ ?match(ok, rpc:call(N3, mnesia, start, [[{extra_db_nodes,[N1]}]])),
+
+ ?match({atomic, ok}, mnesia:add_table_index(Tab, ValPos)),
+
+ ?match({atomic, [{Tab, 1, 2},{Tab, 2, 2}]}, mnesia:transaction(IRead)),
?match({atomic, [{Tab, 1, 2},{Tab, 2, 2}]},
- mnesia:transaction(fun() -> lists:sort(mnesia:index_read(Tab, 2, ValPos))
- end)),
+ rpc:call(N2, mnesia, transaction, [IRead])),
+
?verify_mnesia(Nodes, []).
%% Drop table index
@@ -1171,13 +1183,6 @@ del_table_index(Config, Storage) ->
?match({atomic, ok}, mnesia:transaction(NestedFun)),
?verify_mnesia(Nodes, []).
-idx_schema_changes(suite) -> [idx_schema_changes_ram,
- idx_schema_changes_disc,
- idx_schema_changes_disc_only];
-idx_schema_changes(doc) ->
- ["Tests that index tables are handled correctly when schema changes.",
- "For example when a replica is deleted or inserted",
- "TICKET OTP-2XXX (ELVIRA)"].
idx_schema_changes_ram(suite) -> [];
idx_schema_changes_ram(Config) when is_list(Config) ->
diff --git a/lib/mnesia/test/mt.erl b/lib/mnesia/test/mt.erl
index f69c4a11fd..f1152a7bc4 100644
--- a/lib/mnesia/test/mt.erl
+++ b/lib/mnesia/test/mt.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1997-2010. All Rights Reserved.
+%% Copyright Ericsson AB 1997-2011. 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
@@ -57,6 +57,7 @@ alias(heavy) -> {mnesia_SUITE, heavy};
alias(install) -> mnesia_install_test;
alias(isolation) -> mnesia_isolation_test;
alias(light) -> {mnesia_SUITE, light};
+alias(majority) -> mnesia_majority_test;
alias(measure) -> mnesia_measure_test;
alias(medium) -> {mnesia_SUITE, medium};
alias(nice) -> mnesia_nice_coverage_test;
@@ -76,17 +77,24 @@ resolve(Suite0) when is_atom(Suite0) ->
Suite when is_atom(Suite) ->
{Suite, all};
{Suite, Case} ->
- {Suite, Case}
+ {Suite, is_group(Suite,Case)}
end;
resolve({Suite0, Case}) when is_atom(Suite0), is_atom(Case) ->
case alias(Suite0) of
Suite when is_atom(Suite) ->
- {Suite, Case};
+ {Suite, is_group(Suite,Case)};
{Suite, Case2} ->
- {Suite, Case2}
+ {Suite, is_group(Suite,Case2)}
end;
resolve(List) when is_list(List) ->
[resolve(Case) || Case <- List].
+
+is_group(Mod, Case) ->
+ try {_,_,_} = lists:keyfind(Case, 1, Mod:groups()),
+ {group, Case}
+ catch _:{badmatch,_} ->
+ Case
+ end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Run one or more test cases