Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf test subcmd help: Add exclude disjoint subcmd names

The test is based on an error/fix posted to linux-perf-users.

Reported-by: Sri Jayaramappa <sjayaram@akamai.com>
Reviewed-by: Sri Jayaramappa <sjayaram@akamai.com>
Signed-off-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Guilherme Amadio <amadio@gentoo.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Closes: https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/
Closes: https://urldefense.com/v3/__https://lore.kernel.org/linux-perf-users/20251202213632.2873731-1-sjayaram@akamai.com/__;!!GjvTz_vk!XehekKNUE4Ib_tvqIH6PMIIhly4X3BZ-Y40RC1HKMQ-6OdYEFvUPQhyWv_gk9vsRRN4_RcOLS2Bh0CQ$
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Ian Rogers and committed by
Arnaldo Carvalho de Melo
ef92c435 6e5f2ad6

+26
+26
tools/perf/tests/subcmd-help.c
··· 95 95 return TEST_OK; 96 96 } 97 97 98 + static int test__exclude_cmdnames_no_overlap(struct test_suite *test __maybe_unused, 99 + int subtest __maybe_unused) 100 + { 101 + struct cmdnames cmds1 = {}; 102 + struct cmdnames cmds2 = {}; 103 + 104 + add_cmdname(&cmds1, "read-vdso32", 11); 105 + add_cmdname(&cmds2, "archive", 7); 106 + 107 + TEST_ASSERT_VAL("invalid original size", cmds1.cnt == 1); 108 + TEST_ASSERT_VAL("invalid original size", cmds2.cnt == 1); 109 + 110 + exclude_cmds(&cmds1, &cmds2); 111 + 112 + TEST_ASSERT_VAL("invalid excluded size", cmds1.cnt == 1); 113 + TEST_ASSERT_VAL("invalid excluded size", cmds2.cnt == 1); 114 + 115 + TEST_ASSERT_VAL("cannot find cmd", is_in_cmdlist(&cmds1, "read-vdso32") == 1); 116 + TEST_ASSERT_VAL("wrong cmd", is_in_cmdlist(&cmds1, "archive") == 0); 117 + 118 + clean_cmdnames(&cmds1); 119 + clean_cmdnames(&cmds2); 120 + return TEST_OK; 121 + } 122 + 98 123 static struct test_case tests__subcmd_help[] = { 99 124 TEST_CASE("Load subcmd names", load_cmdnames), 100 125 TEST_CASE("Uniquify subcmd names", uniq_cmdnames), 101 126 TEST_CASE("Exclude duplicate subcmd names", exclude_cmdnames), 127 + TEST_CASE("Exclude disjoint subcmd names", exclude_cmdnames_no_overlap), 102 128 { .name = NULL, } 103 129 }; 104 130