TEST_ASSERT_VAL("wrong sample_type",
PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_tracepoint_multi(struct evlist *evlist)
TEST_ASSERT_VAL("wrong sample_period",
1 == evsel->core.attr.sample_period);
}
- return 0;
+ return TEST_OK;
}
static int test__checkevent_raw(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_numeric(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_symbolic_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config",
PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_symbolic_name_config(struct evlist *evlist)
0 == evsel->core.attr.config1);
TEST_ASSERT_VAL("wrong config2",
1 == evsel->core.attr.config2);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_symbolic_alias(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config",
PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_genhw(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint(struct evlist *evlist)
evsel->core.attr.bp_type);
TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 ==
evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_x(struct evlist *evlist)
TEST_ASSERT_VAL("wrong bp_type",
HW_BREAKPOINT_X == evsel->core.attr.bp_type);
TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_r(struct evlist *evlist)
HW_BREAKPOINT_R == evsel->core.attr.bp_type);
TEST_ASSERT_VAL("wrong bp_len",
HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_w(struct evlist *evlist)
HW_BREAKPOINT_W == evsel->core.attr.bp_type);
TEST_ASSERT_VAL("wrong bp_len",
HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_rw(struct evlist *evlist)
(HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->core.attr.bp_type);
TEST_ASSERT_VAL("wrong bp_len",
HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_tracepoint_modifier(struct evlist *evlist)
*/
TEST_ASSERT_VAL("wrong period", 0 == evsel->core.attr.sample_period);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_list(struct evlist *evlist)
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_pmu_name(struct evlist *evlist)
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "cpu/config=2/u"));
- return 0;
+ return TEST_OK;
}
static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist)
TEST_ASSERT_VAL("wrong callgraph", !evsel__has_callchain(evsel));
TEST_ASSERT_VAL("wrong time", !(PERF_SAMPLE_TIME & evsel->core.attr.sample_type));
- return 0;
+ return TEST_OK;
}
static int test__checkevent_pmu_events(struct evlist *evlist)
TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
- return 0;
+ return TEST_OK;
}
TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.pinned);
- return 0;
+ return TEST_OK;
}
static int test__checkterms_simple(struct list_head *terms)
term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
TEST_ASSERT_VAL("wrong val", term->val.num == 0xead);
TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "config"));
- return 0;
+ return TEST_OK;
}
static int test__group1(struct evlist *evlist)
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__group2(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__group3(struct evlist *evlist __maybe_unused)
TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__group4(struct evlist *evlist __maybe_unused)
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__group5(struct evlist *evlist __maybe_unused)
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
- return 0;
+ return TEST_OK;
}
static int test__group_gh1(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
- return 0;
+ return TEST_OK;
}
static int test__group_gh2(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
- return 0;
+ return TEST_OK;
}
static int test__group_gh3(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
- return 0;
+ return TEST_OK;
}
static int test__group_gh4(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
- return 0;
+ return TEST_OK;
}
static int test__leader_sample1(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__leader_sample2(struct evlist *evlist __maybe_unused)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_pinned_modifier(struct evlist *evlist)
PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_exclusive_modifier(struct evlist *evlist)
PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_len(struct evlist *evlist)
{
TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 ==
evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_breakpoint_len_w(struct evlist *evlist)
TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 ==
evsel->core.attr.bp_len);
- return 0;
+ return TEST_OK;
}
static int
TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config",
PERF_COUNT_SW_TASK_CLOCK == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_config_symbol(struct evlist *evlist)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_config_raw(struct evlist *evlist)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_config_num(struct evlist *evlist)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_config_cache(struct evlist *evlist)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0);
- return 0;
+ return TEST_OK;
}
static bool test__intel_pt_valid(void)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_complex_name(struct evlist *evlist)
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0);
- return 0;
+ return TEST_OK;
}
static int test__checkevent_raw_pmu(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__sym_event_slash(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
- return 0;
+ return TEST_OK;
}
static int test__sym_event_dc(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
- return 0;
+ return TEST_OK;
}
static int count_tracepoints(void)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__hybrid_hw_group_event(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0xc0 == evsel->core.attr.config);
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
- return 0;
+ return TEST_OK;
}
static int test__hybrid_sw_hw_group_event(struct evlist *evlist)
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x3c == evsel->core.attr.config);
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
- return 0;
+ return TEST_OK;
}
static int test__hybrid_hw_sw_group_event(struct evlist *evlist)
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
- return 0;
+ return TEST_OK;
}
static int test__hybrid_group_modifier1(struct evlist *evlist)
TEST_ASSERT_VAL("wrong leader", evsel__has_leader(evsel, leader));
TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
- return 0;
+ return TEST_OK;
}
static int test__hybrid_raw1(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
/* The type of second event is randome value */
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__hybrid_raw2(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
- return 0;
+ return TEST_OK;
}
static int test__hybrid_cache_event(struct evlist *evlist)
TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong config", 0x2 == (evsel->core.attr.config & 0xffffffff));
- return 0;
+ return TEST_OK;
}
struct evlist_test {
int ret;
if (e->valid && !e->valid()) {
- pr_debug("... SKIP");
- return 0;
+ pr_debug("... SKIP\n");
+ return TEST_OK;
}
evlist = evlist__new();
- if (evlist == NULL)
- return -ENOMEM;
-
+ if (evlist == NULL) {
+ pr_err("Failed allocation");
+ return TEST_FAIL;
+ }
parse_events_error__init(&err);
ret = parse_events(evlist, e->name, &err);
if (ret) {
pr_debug("failed to parse event '%s', err %d, str '%s'\n",
e->name, ret, err.str);
parse_events_error__print(&err, e->name);
+ ret = TEST_FAIL;
+ if (strstr(err.str, "can't access trace events"))
+ ret = TEST_SKIP;
} else {
ret = e->check(evlist);
}
return ret;
}
+static int combine_test_results(int existing, int latest)
+{
+ if (existing == TEST_FAIL)
+ return TEST_FAIL;
+ if (existing == TEST_SKIP)
+ return latest == TEST_OK ? TEST_SKIP : latest;
+ return latest;
+}
+
static int test_events(const struct evlist_test *events, int cnt)
{
- int ret1, ret2 = 0;
+ int ret = TEST_OK;
for (int i = 0; i < cnt; i++) {
const struct evlist_test *e = &events[i];
+ int test_ret;
- pr_debug("running test %d '%s'", i, e->name);
- ret1 = test_event(e);
- if (ret1)
- ret2 = ret1;
- pr_debug("\n");
+ pr_debug("running test %d '%s'\n", i, e->name);
+ test_ret = test_event(e);
+ if (test_ret != TEST_OK) {
+ pr_debug("Event test failure: test %d '%s'", i, e->name);
+ ret = combine_test_results(ret, test_ret);
+ }
}
- return ret2;
+ return ret;
+}
+
+static int test__events2(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
+{
+ return test_events(test__events, ARRAY_SIZE(test__events));
}
static int test_term(const struct terms_test *t)
return ret;
}
+static int test__terms2(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
+{
+ return test_terms(test__terms, ARRAY_SIZE(test__terms));
+}
+
static int test_pmu(void)
{
struct stat st;
return !ret;
}
-static int test_pmu_events(void)
+static int test__pmu_events(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
struct stat st;
char path[PATH_MAX];
DIR *dir;
int ret;
+ if (!test_pmu())
+ return TEST_SKIP;
+
snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/events/",
sysfs__mountpoint());
ret = stat(path, &st);
if (ret) {
- pr_debug("omitting PMU cpu events tests\n");
- return 0;
+ pr_debug("omitting PMU cpu events tests: %s\n", path);
+ return TEST_OK;
}
dir = opendir(path);
if (!dir) {
- pr_debug("can't open pmu event dir");
- return -1;
+ pr_debug("can't open pmu event dir: %s\n", path);
+ return TEST_FAIL;
}
- while (!ret && (ent = readdir(dir))) {
+ ret = TEST_OK;
+ while ((ent = readdir(dir))) {
struct evlist_test e = { .name = NULL, };
char name[2 * NAME_MAX + 1 + 12 + 3];
+ int test_ret;
/* Names containing . are special and cannot be used directly */
if (strchr(ent->d_name, '.'))
e.name = name;
e.check = test__checkevent_pmu_events;
- ret = test_event(&e);
- if (ret)
- break;
+ test_ret = test_event(&e);
+ if (test_ret != TEST_OK) {
+ pr_debug("Test PMU event failed for '%s'", name);
+ ret = combine_test_results(ret, test_ret);
+ }
snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
e.name = name;
e.check = test__checkevent_pmu_events_mix;
- ret = test_event(&e);
+ test_ret = test_event(&e);
+ if (test_ret != TEST_OK) {
+ pr_debug("Test PMU event failed for '%s'", name);
+ ret = combine_test_results(ret, test_ret);
+ }
}
closedir(dir);
return ret;
}
+static int test__pmu_events2(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
+{
+ if (!test_pmu())
+ return TEST_SKIP;
+
+ return test_events(test__events_pmu, ARRAY_SIZE(test__events_pmu));
+}
+
static bool test_alias(char **event, char **alias)
{
char path[PATH_MAX];
return false;
}
+static int test__hybrid(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
+{
+ if (!perf_pmu__has_hybrid())
+ return TEST_SKIP;
+
+ return test_events(test__hybrid_events, ARRAY_SIZE(test__hybrid_events));
+}
+
static int test__checkevent_pmu_events_alias(struct evlist *evlist)
{
struct evsel *evsel1 = evlist__first(evlist);
TEST_ASSERT_VAL("wrong type", evsel1->core.attr.type == evsel2->core.attr.type);
TEST_ASSERT_VAL("wrong config", evsel1->core.attr.config == evsel2->core.attr.config);
- return 0;
+ return TEST_OK;
}
-static int test_pmu_events_alias(char *event, char *alias)
+static int test__pmu_events_alias(char *event, char *alias)
{
struct evlist_test e = { .name = NULL, };
char name[2 * NAME_MAX + 20];
return test_event(&e);
}
-static int test_pmu_events_alias2(void)
+static int test__alias(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
{
- static const char events[][30] = {
- "event-hyphen",
- "event-two-hyph",
- };
- unsigned long i;
- int ret = 0;
+ char *event, *alias;
+ int ret;
- for (i = 0; i < ARRAY_SIZE(events); i++) {
- ret = test_event_fake_pmu(&events[i][0]);
- if (ret) {
- pr_err("check_parse_fake %s failed\n", &events[i][0]);
- break;
- }
- }
+ if (!test_alias(&event, &alias))
+ return TEST_SKIP;
+ ret = test__pmu_events_alias(event, alias);
+
+ free(event);
+ free(alias);
return ret;
}
-static int test__parse_events(struct test_suite *test __maybe_unused, int subtest __maybe_unused)
+static int test__pmu_events_alias2(struct test_suite *test __maybe_unused,
+ int subtest __maybe_unused)
{
- int ret1, ret2 = 0;
- char *event, *alias;
-
-#define TEST_EVENTS(tests) \
-do { \
- ret1 = test_events(tests, ARRAY_SIZE(tests)); \
- if (!ret2) \
- ret2 = ret1; \
-} while (0)
-
- if (perf_pmu__has_hybrid()) {
- TEST_EVENTS(test__hybrid_events);
- return ret2;
- }
-
- TEST_EVENTS(test__events);
-
- if (test_pmu())
- TEST_EVENTS(test__events_pmu);
-
- if (test_pmu()) {
- int ret = test_pmu_events();
- if (ret)
- return ret;
- }
+ static const char events[][30] = {
+ "event-hyphen",
+ "event-two-hyph",
+ };
+ int ret = TEST_OK;
- if (test_alias(&event, &alias)) {
- int ret = test_pmu_events_alias(event, alias);
+ for (unsigned int i = 0; i < ARRAY_SIZE(events); i++) {
+ int test_ret = test_event_fake_pmu(&events[i][0]);
- free(event);
- free(alias);
- if (ret)
- return ret;
+ if (test_ret != TEST_OK) {
+ pr_debug("check_parse_fake %s failed\n", &events[i][0]);
+ ret = combine_test_results(ret, test_ret);
+ }
}
- ret1 = test_pmu_events_alias2();
- if (!ret2)
- ret2 = ret1;
-
- ret1 = test_terms(test__terms, ARRAY_SIZE(test__terms));
- if (!ret2)
- ret2 = ret1;
-
- return ret2;
+ return ret;
}
-DEFINE_SUITE("Parse event definition strings", parse_events);
+static struct test_case tests__parse_events[] = {
+ TEST_CASE_REASON("Test event parsing",
+ events2,
+ "permissions"),
+ TEST_CASE_REASON("Test parsing of \"hybrid\" CPU events",
+ hybrid,
+ "not hybrid"),
+ TEST_CASE_REASON("Parsing of all PMU events from sysfs",
+ pmu_events,
+ "permissions"),
+ TEST_CASE_REASON("Parsing of given PMU events from sysfs",
+ pmu_events2,
+ "permissions"),
+ TEST_CASE_REASON("Parsing of aliased events from sysfs", alias,
+ "no aliases in sysfs"),
+ TEST_CASE("Parsing of aliased events", pmu_events_alias2),
+ TEST_CASE("Parsing of terms (event modifiers)", terms2),
+ { .name = NULL, }
+};
+
+struct test_suite suite__parse_events = {
+ .desc = "Parse event definition strings",
+ .test_cases = tests__parse_events,
+};