aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-01-21 11:52:53 -0500
committerSteven Rostedt <rostedt@goodmis.org>2011-01-21 12:07:23 -0500
commit33f493c4de54138bcd9aac9454aae01d648e85f0 (patch)
tree8f7f1db95eeed7fb0b6b479a5f2dfb7436598f2e
parentd41d342e3bc4f3c15dd56a483053471378222de8 (diff)
parse-event: Add way to just test a filter string
If pevent->test_filters is set when a filter string is added, then it will print the filters strings that were created and exit. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.h2
-rw-r--r--parse-filter.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/parse-events.h b/parse-events.h
index 43213d4..3a4ef08 100644
--- a/parse-events.h
+++ b/parse-events.h
@@ -332,6 +332,8 @@ struct pevent {
332 332
333 int print_raw; 333 int print_raw;
334 334
335 int test_filters;
336
335 struct format_field *bprint_ip_field; 337 struct format_field *bprint_ip_field;
336 struct format_field *bprint_fmt_field; 338 struct format_field *bprint_fmt_field;
337 struct format_field *bprint_buf_field; 339 struct format_field *bprint_buf_field;
diff --git a/parse-filter.c b/parse-filter.c
index bd52033..d84a22b 100644
--- a/parse-filter.c
+++ b/parse-filter.c
@@ -1252,10 +1252,20 @@ int pevent_filter_add_filter_str(struct event_filter *filter,
1252 /* Failures are returned if a parse error happened */ 1252 /* Failures are returned if a parse error happened */
1253 if (ret < 0) 1253 if (ret < 0)
1254 rtn = ret; 1254 rtn = ret;
1255
1256 if (ret >= 0 && pevent->test_filters) {
1257 char *test;
1258 test = pevent_filter_make_string(filter, event->event->id);
1259 printf(" '%s: %s'\n", event->event->name, test);
1260 free(test);
1261 }
1255 } 1262 }
1256 1263
1257 free_events(events); 1264 free_events(events);
1258 1265
1266 if (rtn >= 0 && pevent->test_filters)
1267 exit(0);
1268
1259 return rtn; 1269 return rtn;
1260} 1270}
1261 1271