perf test: Add expr test for events with hyphens
authorIan Rogers <irogers@google.com>
Thu, 11 Nov 2021 00:21:02 +0000 (16:21 -0800)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Sat, 13 Nov 2021 21:11:50 +0000 (18:11 -0300)
An example of such an event is topdown-fe-bound.

Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: John Garry <john.garry@huawei.com>
Cc: Kajol Jain <kjain@linux.ibm.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul A . Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Riccardo Mancini <rickyman7@gmail.com>
Cc: Song Liu <song@kernel.org>
Cc: Wan Jiabing <wanjiabing@vivo.com>
Cc: Yury Norov <yury.norov@gmail.com>
Link: https://lore.kernel.org/r/20211111002109.194172-2-irogers@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/tests/expr.c

index 0c041ac..48c62d0 100644 (file)
@@ -134,6 +134,16 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
        TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, "EVENT2,param=3@",
                                                    (void **)&val_ptr));
 
+       expr__ctx_clear(ctx);
+       TEST_ASSERT_VAL("find ids",
+                       expr__find_ids("dash\\-event1 - dash\\-event2",
+                                      NULL, ctx) == 0);
+       TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 2);
+       TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, "dash-event1",
+                                                   (void **)&val_ptr));
+       TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids, "dash-event2",
+                                                   (void **)&val_ptr));
+
        /* Only EVENT1 or EVENT2 need be measured depending on the value of smt_on. */
        expr__ctx_clear(ctx);
        TEST_ASSERT_VAL("find ids",