diff options
author | Dan Gudmundsson <[email protected]> | 2013-12-02 09:50:57 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-12-02 09:50:57 +0100 |
commit | 0201ed20979a8828c2e989552684c09f320d0126 (patch) | |
tree | d33761c6a7a3d1a298671a0adffe8fc59e19d48f /lib/mnesia/test/mnesia_evil_coverage_test.erl | |
parent | 22ae0b2bd6fbe973915b19551c7d6a397a8c8a60 (diff) | |
parent | 49799666d163a72114d7a936f6f528c3726018ae (diff) | |
download | otp-0201ed20979a8828c2e989552684c09f320d0126.tar.gz otp-0201ed20979a8828c2e989552684c09f320d0126.tar.bz2 otp-0201ed20979a8828c2e989552684c09f320d0126.zip |
Merge branch 'dgud/mnesia/subscr-dirty_update_counter/OTP-11485' into maint
* dgud/mnesia/subscr-dirty_update_counter/OTP-11485:
mnesia: Fix dirty_update bug when subscriber exists
Diffstat (limited to 'lib/mnesia/test/mnesia_evil_coverage_test.erl')
-rw-r--r-- | lib/mnesia/test/mnesia_evil_coverage_test.erl | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/lib/mnesia/test/mnesia_evil_coverage_test.erl b/lib/mnesia/test/mnesia_evil_coverage_test.erl index db23a39943..91820238e5 100644 --- a/lib/mnesia/test/mnesia_evil_coverage_test.erl +++ b/lib/mnesia/test/mnesia_evil_coverage_test.erl @@ -1869,14 +1869,19 @@ subscribe_extended(Config) when is_list(Config) -> {attributes, record_info(fields, tab)}], ?match({atomic, ok}, mnesia:create_table(Tab2, Def2)), + Tab3 = ctab, + Def3 = [{Storage, [N1, N2]}], + ?match({atomic, ok}, mnesia:create_table(Tab3, Def3)), + ?match({ok, N1}, mnesia:subscribe({table, Tab1, detailed})), ?match({ok, N1}, mnesia:subscribe({table, Tab2, detailed})), + ?match({ok, N1}, mnesia:subscribe({table, Tab3, 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), + test_ext_sub(Tab1, Tab2, Tab3), ?match({ok, N1}, mnesia:unsubscribe(activity)), ?match({ok, N1}, mnesia:subscribe({table, Tab1, detailed})), @@ -1895,11 +1900,11 @@ subscribe_extended(Config) when is_list(Config) -> {max, [Tab1, Tab2]}]), ?match({ok, N1}, mnesia:subscribe({table, Tab2, detailed})), ?match({ok, N1}, mnesia:subscribe(activity)), - test_ext_sub(Tab1, Tab2), + test_ext_sub(Tab1, Tab2, Tab3), ?verify_mnesia(Nodes, []). -test_ext_sub(Tab1, Tab2) -> +test_ext_sub(Tab1, Tab2, Tab3) -> %% The basics Rec1 = {Tab1, 1, 0, 0}, Rec2 = {Tab1, 1, 1, 0}, @@ -1940,7 +1945,6 @@ test_ext_sub(Tab1, Tab2) -> ?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 @@ -1969,6 +1973,17 @@ test_ext_sub(Tab1, Tab2) -> ?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()), + + %% COUNTERS + + Rec5 = {Tab3, counter, 0}, + ?match(ok, mnesia:dirty_write(Rec5)), + ?match({mnesia_table_event, {write, Tab3, Rec5, [], D}}, recv_event()), + ?match(1, mnesia:dirty_update_counter({Tab3, counter}, 1)), + ?match({mnesia_table_event, {write, Tab3, {Tab3,counter,1}, [Rec5], D}}, recv_event()), + ?match(ok, mnesia:dirty_delete({Tab3, counter})), + ?match({mnesia_table_event, {delete, Tab3, {Tab3,counter}, + [{Tab3,counter,1}], D}}, recv_event()), ok. @@ -1987,7 +2002,7 @@ subscribe_standard(Config) when is_list(Config)-> %% Check system events ?match({error, {badarg, foo}}, mnesia:unsubscribe(foo)), ?match({error, badarg}, mnesia:unsubscribe({table, foo})), - ?match(_, mnesia:unsubscribe(activity)), + mnesia:unsubscribe(activity), ?match({ok, N1}, mnesia:subscribe(system)), ?match({ok, N1}, mnesia:subscribe(activity)), |