Thread (1 message) flat view 1 message, 1 author, 2020-05-06
STALE2281d REVIEWED: 1 (0M)

1 review trailer.

[PATCH 19/91] perf tests expr: Added test for runtime param in metric expression

From: Arnaldo Carvalho de Melo <acme@kernel.org>
Date: 2020-05-06 15:24:02
Also in: linux-perf-users, lkml
Subsystem: performance events subsystem, the rest · Maintainers: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo, Namhyung Kim, Linus Torvalds

From: Kajol Jain <redacted>

Added test case for parsing  "?" in metric expression.

Signed-off-by: Kajol Jain <redacted>
Acked-by: Jiri Olsa <redacted>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <redacted>
Cc: Anju T Sudhakar <redacted>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jin Yao <redacted>
Cc: Joe Mario <redacted>
Cc: Kan Liang <redacted>
Cc: Madhavan Srinivasan <redacted>
Cc: Mamatha Inamdar <redacted>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Petlan <redacted>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <redacted>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ravi Bangoria <redacted>
Cc: Sukadev Bhattiprolu <redacted>
Cc: Thomas Gleixner <redacted>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lore.kernel.org/lkml/20200401203340.31402-6-kjain@linux.ibm.com (local)
Signed-off-by: Arnaldo Carvalho de Melo <redacted>
---
 tools/perf/tests/expr.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/tools/perf/tests/expr.c b/tools/perf/tests/expr.c
index 516504cf0ea5..f9e8e5628836 100644
--- a/tools/perf/tests/expr.c
+++ b/tools/perf/tests/expr.c
@@ -59,6 +59,14 @@ int test__expr(struct test *t __maybe_unused, int subtest __maybe_unused)
 	TEST_ASSERT_VAL("find other", !strcmp(other[2], "BOZO"));
 	TEST_ASSERT_VAL("find other", other[3] == NULL);
 
+	TEST_ASSERT_VAL("find other",
+			expr__find_other("EVENT1\\,param\\=?@ + EVENT2\\,param\\=?@", NULL,
+				   &other, &num_other, 3) == 0);
+	TEST_ASSERT_VAL("find other", num_other == 2);
+	TEST_ASSERT_VAL("find other", !strcmp(other[0], "EVENT1,param=3/"));
+	TEST_ASSERT_VAL("find other", !strcmp(other[1], "EVENT2,param=3/"));
+	TEST_ASSERT_VAL("find other", other[2] == NULL);
+
 	for (i = 0; i < num_other; i++)
 		zfree(&other[i]);
 	free((void *)other);
-- 
2.21.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help