aboutsummaryrefslogtreecommitdiffstats
path: root/lib/common_test/src/ct_util.erl
diff options
context:
space:
mode:
authorPeter Andersson <[email protected]>2014-05-02 11:00:26 +0200
committerPeter Andersson <[email protected]>2014-05-02 11:00:26 +0200
commit43fe944a466c47cca84cc4b02371004847927355 (patch)
tree148a5071a0d882d14261710a8c806d324bc334b8 /lib/common_test/src/ct_util.erl
parent10f47281bf94e7e3ed98f97f3c1531036edce9cc (diff)
parentaf8a352109ba87f7960ab46bd6ed1d237b87ed7c (diff)
downloadotp-43fe944a466c47cca84cc4b02371004847927355.tar.gz
otp-43fe944a466c47cca84cc4b02371004847927355.tar.bz2
otp-43fe944a466c47cca84cc4b02371004847927355.zip
Merge remote branch 'origin/peppe/common_test/ct_comment_problem' into maint
* origin/peppe/common_test/ct_comment_problem: Fix problem with comments getting lost when running parallel test cases
Diffstat (limited to 'lib/common_test/src/ct_util.erl')
-rw-r--r--lib/common_test/src/ct_util.erl25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/common_test/src/ct_util.erl b/lib/common_test/src/ct_util.erl
index f5eb3a72f0..56027586d1 100644
--- a/lib/common_test/src/ct_util.erl
+++ b/lib/common_test/src/ct_util.erl
@@ -37,7 +37,7 @@
save_suite_data_async/3, save_suite_data_async/2,
read_suite_data/1,
delete_suite_data/0, delete_suite_data/1, match_delete_suite_data/1,
- delete_testdata/0, delete_testdata/1,
+ delete_testdata/0, delete_testdata/1, match_delete_testdata/1,
set_testdata/1, get_testdata/1, get_testdata/2,
set_testdata_async/1, update_testdata/2, update_testdata/3,
set_verbosity/1, get_verbosity/1]).
@@ -270,6 +270,9 @@ delete_testdata() ->
delete_testdata(Key) ->
call({delete_testdata, Key}).
+match_delete_testdata(KeyPat) ->
+ call({match_delete_testdata, KeyPat}).
+
update_testdata(Key, Fun) ->
update_testdata(Key, Fun, []).
@@ -361,7 +364,25 @@ loop(Mode,TestData,StartDir) ->
{{delete_testdata,Key},From} ->
TestData1 = lists:keydelete(Key,1,TestData),
return(From,ok),
- loop(From,TestData1,StartDir);
+ loop(From,TestData1,StartDir);
+ {{match_delete_testdata,{Key1,Key2}},From} ->
+ %% handles keys with 2 elements
+ TestData1 =
+ lists:filter(fun({Key,_}) when not is_tuple(Key) ->
+ true;
+ ({Key,_}) when tuple_size(Key) =/= 2 ->
+ true;
+ ({{_,KeyB},_}) when Key1 == '_' ->
+ KeyB =/= Key2;
+ ({{KeyA,_},_}) when Key2 == '_' ->
+ KeyA =/= Key1;
+ (_) when Key1 == '_' ; Key2 == '_' ->
+ false;
+ (_) ->
+ true
+ end, TestData),
+ return(From,ok),
+ loop(From,TestData1,StartDir);
{{set_testdata,New = {Key,_Val}},From} ->
TestData1 = lists:keydelete(Key,1,TestData),
return(From,ok),