perf test: Use ARRAY_SIZE in parse events tests
Use ARRAY_SIZE instead of defining the sizes separately for each test arrays. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1341352848-11833-10-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
17d7a1123f
commit
ebf124ffab
@@ -634,8 +634,6 @@ static struct test__event_st test__events[] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
|
|
||||||
|
|
||||||
static struct test__event_st test__events_pmu[] = {
|
static struct test__event_st test__events_pmu[] = {
|
||||||
[0] = {
|
[0] = {
|
||||||
.name = "cpu/config=10,config1,config2=3,period=1000/u",
|
.name = "cpu/config=10,config1,config2=3,period=1000/u",
|
||||||
@@ -647,9 +645,6 @@ static struct test__event_st test__events_pmu[] = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TEST__EVENTS_PMU_CNT (sizeof(test__events_pmu) / \
|
|
||||||
sizeof(struct test__event_st))
|
|
||||||
|
|
||||||
struct test__term {
|
struct test__term {
|
||||||
const char *str;
|
const char *str;
|
||||||
__u32 type;
|
__u32 type;
|
||||||
@@ -765,21 +760,17 @@ int parse_events__test(void)
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
do {
|
#define TEST_EVENTS(tests) \
|
||||||
ret = test_events(test__events, TEST__EVENTS_CNT);
|
do { \
|
||||||
if (ret)
|
ret = test_events(tests, ARRAY_SIZE(tests)); \
|
||||||
break;
|
if (ret) \
|
||||||
|
return ret; \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
if (test_pmu()) {
|
TEST_EVENTS(test__events);
|
||||||
ret = test_events(test__events_pmu,
|
|
||||||
TEST__EVENTS_PMU_CNT);
|
|
||||||
if (ret)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = test_terms(test__terms, TEST__TERMS_CNT);
|
if (test_pmu())
|
||||||
|
TEST_EVENTS(test__events_pmu);
|
||||||
|
|
||||||
} while (0);
|
return test_terms(test__terms, ARRAY_SIZE(test__terms));
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user