perf test: Add basic core_wide expression test
Add basic test for coverage, similar to #smt_on. Signed-off-by: Ian Rogers <irogers@google.com> Cc: Ahmad Yasin <ahmad.yasin@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Caleb Biggers <caleb.biggers@intel.com> Cc: Florian Fischer <florian.fischer@muhq.space> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@arm.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: John Garry <john.garry@huawei.com> Cc: Kan Liang <kan.liang@linux.intel.com> Cc: Kshipra Bopardikar <kshipra.bopardikar@intel.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Miaoqian Lin <linmq006@gmail.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Perry Taylor <perry.taylor@intel.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Cc: Thomas Richter <tmricht@linux.ibm.com> Cc: Xing Zhengjun <zhengjun.xing@linux.intel.com> Link: https://lore.kernel.org/r/20220831174926.579643-8-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
1725e9cd32
commit
f0c4b97a29
@ -158,6 +158,9 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
|
||||
{
|
||||
struct cpu_topology *topology = cpu_topology__new();
|
||||
bool smton = smt_on(topology);
|
||||
bool corewide = core_wide(/*system_wide=*/false,
|
||||
/*user_requested_cpus=*/false,
|
||||
topology);
|
||||
|
||||
cpu_topology__delete(topology);
|
||||
expr__ctx_clear(ctx);
|
||||
@ -168,6 +171,16 @@ static int test__expr(struct test_suite *t __maybe_unused, int subtest __maybe_u
|
||||
TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids,
|
||||
smton ? "EVENT1" : "EVENT2",
|
||||
(void **)&val_ptr));
|
||||
|
||||
expr__ctx_clear(ctx);
|
||||
TEST_ASSERT_VAL("find ids",
|
||||
expr__find_ids("EVENT1 if #core_wide else EVENT2",
|
||||
NULL, ctx) == 0);
|
||||
TEST_ASSERT_VAL("find ids", hashmap__size(ctx->ids) == 1);
|
||||
TEST_ASSERT_VAL("find ids", hashmap__find(ctx->ids,
|
||||
corewide ? "EVENT1" : "EVENT2",
|
||||
(void **)&val_ptr));
|
||||
|
||||
}
|
||||
/* The expression is a constant 1.0 without needing to evaluate EVENT1. */
|
||||
expr__ctx_clear(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user