Commit 3b536651 authored by Ian Rogers's avatar Ian Rogers Committed by Arnaldo Carvalho de Melo

perf test: Provide a subtest callback to ask for the reason for skipping a subtest

Now subtests can inform why a test was skipped. The upcoming patch
improvint PMU event metric testing will use it.
Signed-off-by: default avatarIan Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Jin Yao <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@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: Leo Yan <leo.yan@linaro.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Clarke <pc@us.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lore.kernel.org/lkml/20200513212933.41273-1-irogers@google.com
[ split from a larger patch ]
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 4ac22b48
...@@ -429,8 +429,15 @@ static int test_and_print(struct test *t, bool force_skip, int subtest) ...@@ -429,8 +429,15 @@ static int test_and_print(struct test *t, bool force_skip, int subtest)
case TEST_OK: case TEST_OK:
pr_info(" Ok\n"); pr_info(" Ok\n");
break; break;
case TEST_SKIP: case TEST_SKIP: {
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n"); const char *skip_reason = NULL;
if (t->subtest.skip_reason)
skip_reason = t->subtest.skip_reason(subtest);
if (skip_reason)
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip (%s)\n", skip_reason);
else
color_fprintf(stderr, PERF_COLOR_YELLOW, " Skip\n");
}
break; break;
case TEST_FAIL: case TEST_FAIL:
default: default:
......
...@@ -34,6 +34,7 @@ struct test { ...@@ -34,6 +34,7 @@ struct test {
bool skip_if_fail; bool skip_if_fail;
int (*get_nr)(void); int (*get_nr)(void);
const char *(*get_desc)(int subtest); const char *(*get_desc)(int subtest);
const char *(*skip_reason)(int subtest);
} subtest; } subtest;
bool (*is_supported)(void); bool (*is_supported)(void);
void *priv; void *priv;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment