aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJiri Olsa <jolsa@redhat.com>2012-07-03 18:00:47 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-07-04 10:31:26 -0400
commitebf124ffab59e9e1c6179347fe95fe5baf32dcd7 (patch)
tree1fde0113d90607c1a818dda151a07488d3c84da7 /tools
parent17d7a1123f0f6d532830152564cc812cc73db2f3 (diff)
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>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/parse-events-test.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c
index dd0c306a0698..1b997d2b89ce 100644
--- a/tools/perf/util/parse-events-test.c
+++ b/tools/perf/util/parse-events-test.c
@@ -634,8 +634,6 @@ static struct test__event_st test__events[] = {
634 }, 634 },
635}; 635};
636 636
637#define TEST__EVENTS_CNT (sizeof(test__events) / sizeof(struct test__event_st))
638
639static struct test__event_st test__events_pmu[] = { 637static struct test__event_st test__events_pmu[] = {
640 [0] = { 638 [0] = {
641 .name = "cpu/config=10,config1,config2=3,period=1000/u", 639 .name = "cpu/config=10,config1,config2=3,period=1000/u",
@@ -647,9 +645,6 @@ static struct test__event_st test__events_pmu[] = {
647 }, 645 },
648}; 646};
649 647
650#define TEST__EVENTS_PMU_CNT (sizeof(test__events_pmu) / \
651 sizeof(struct test__event_st))
652
653struct test__term { 648struct test__term {
654 const char *str; 649 const char *str;
655 __u32 type; 650 __u32 type;
@@ -765,21 +760,17 @@ int parse_events__test(void)
765{ 760{
766 int ret; 761 int ret;
767 762
768 do { 763#define TEST_EVENTS(tests) \
769 ret = test_events(test__events, TEST__EVENTS_CNT); 764do { \
770 if (ret) 765 ret = test_events(tests, ARRAY_SIZE(tests)); \
771 break; 766 if (ret) \
772 767 return ret; \
773 if (test_pmu()) { 768} while (0)
774 ret = test_events(test__events_pmu,
775 TEST__EVENTS_PMU_CNT);
776 if (ret)
777 break;
778 }
779 769
780 ret = test_terms(test__terms, TEST__TERMS_CNT); 770 TEST_EVENTS(test__events);
781 771
782 } while (0); 772 if (test_pmu())
773 TEST_EVENTS(test__events_pmu);
783 774
784 return ret; 775 return test_terms(test__terms, ARRAY_SIZE(test__terms));
785} 776}