aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2010-11-22 18:21:39 +0100
committerLukas Larsson <[email protected]>2010-12-08 18:07:51 +0100
commit7a86a1a4802ac7ad596519a22377ed85cecfaaf5 (patch)
tree22e0099f4d7a3ac78fc6cdcf6303badabcde223c /lib
parentc054d38535e4128e1c5b21980c9e5137a888ec56 (diff)
downloadotp-7a86a1a4802ac7ad596519a22377ed85cecfaaf5.tar.gz
otp-7a86a1a4802ac7ad596519a22377ed85cecfaaf5.tar.bz2
otp-7a86a1a4802ac7ad596519a22377ed85cecfaaf5.zip
Add possibility to use '_' and '$proplist' anywhere in a event spec
Diffstat (limited to 'lib')
-rw-r--r--lib/common_test/test/ct_test_support.erl36
1 files changed, 24 insertions, 12 deletions
diff --git a/lib/common_test/test/ct_test_support.erl b/lib/common_test/test/ct_test_support.erl
index 5e9792f02c..d9b9f85ded 100644
--- a/lib/common_test/test/ct_test_support.erl
+++ b/lib/common_test/test/ct_test_support.erl
@@ -877,21 +877,33 @@ locate({TEH,tc_done,{undefined,undefined,{testcase_aborted,
end;
%% matches any event of type Name
-locate({TEH,Name,Data}, Node, [Ev|Evs], Config) when Data == '_' ->
- case Ev of
- {TEH,#event{name=Name, node=Node}} ->
- {Config,Evs};
- _ ->
+locate({TEH,Name,Data}, Node, [{TEH,#event{name=Name,
+ data = EvData,
+ node = Node}}|Evs],
+ Config) ->
+ try match_data(Data, EvData) of
+ match ->
+ {Config,Evs}
+ catch _:_ ->
nomatch
end;
-locate({TEH,Name,Data}, Node, [Ev|Evs], Config) ->
- case Ev of
- {TEH,#event{name=Name, node=Node, data=Data}} ->
- {Config,Evs};
- _ ->
- nomatch
- end.
+locate({TEH,Name,Data}, Node, [_|Evs], Config) ->
+ nomatch.
+
+match_data([H1|MatchT],[H2|ValT]) ->
+ match_data(H1,H2),
+ match_data(MatchT,ValT);
+match_data(Tuple1,Tuple2) when is_tuple(Tuple1),is_tuple(Tuple2) ->
+ match_data(tuple_to_list(Tuple1),tuple_to_list(Tuple2));
+match_data(D,D) ->
+ match;
+match_data('_',_) ->
+ match;
+match_data('$proplist',Proplist) ->
+ lists:foreach(fun({_,_}) -> ok end,Proplist);
+match_data([],[]) ->
+ match.
log_events(TC, Events, PrivDir) ->
LogFile = filename:join(PrivDir, atom_to_list(TC)++".events"),