diff options
Diffstat (limited to 'tools/perf/tests/parse-events.c')
-rw-r--r-- | tools/perf/tests/parse-events.c | 324 |
1 files changed, 295 insertions, 29 deletions
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c index 32ee478905eb..c5636f36fe31 100644 --- a/tools/perf/tests/parse-events.c +++ b/tools/perf/tests/parse-events.c | |||
@@ -3,6 +3,7 @@ | |||
3 | #include "evsel.h" | 3 | #include "evsel.h" |
4 | #include "evlist.h" | 4 | #include "evlist.h" |
5 | #include "sysfs.h" | 5 | #include "sysfs.h" |
6 | #include "debugfs.h" | ||
6 | #include "tests.h" | 7 | #include "tests.h" |
7 | #include <linux/hw_breakpoint.h> | 8 | #include <linux/hw_breakpoint.h> |
8 | 9 | ||
@@ -22,6 +23,7 @@ static int test__checkevent_tracepoint(struct perf_evlist *evlist) | |||
22 | struct perf_evsel *evsel = perf_evlist__first(evlist); | 23 | struct perf_evsel *evsel = perf_evlist__first(evlist); |
23 | 24 | ||
24 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); | 25 | TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->nr_entries); |
26 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); | ||
25 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); | 27 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->attr.type); |
26 | TEST_ASSERT_VAL("wrong sample_type", | 28 | TEST_ASSERT_VAL("wrong sample_type", |
27 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); | 29 | PERF_TP_SAMPLE_TYPE == evsel->attr.sample_type); |
@@ -34,6 +36,7 @@ static int test__checkevent_tracepoint_multi(struct perf_evlist *evlist) | |||
34 | struct perf_evsel *evsel; | 36 | struct perf_evsel *evsel; |
35 | 37 | ||
36 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); | 38 | TEST_ASSERT_VAL("wrong number of entries", evlist->nr_entries > 1); |
39 | TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups); | ||
37 | 40 | ||
38 | list_for_each_entry(evsel, &evlist->entries, node) { | 41 | list_for_each_entry(evsel, &evlist->entries, node) { |
39 | TEST_ASSERT_VAL("wrong type", | 42 | TEST_ASSERT_VAL("wrong type", |
@@ -463,10 +466,10 @@ static int test__checkevent_pmu_events(struct perf_evlist *evlist) | |||
463 | 466 | ||
464 | static int test__checkterms_simple(struct list_head *terms) | 467 | static int test__checkterms_simple(struct list_head *terms) |
465 | { | 468 | { |
466 | struct parse_events__term *term; | 469 | struct parse_events_term *term; |
467 | 470 | ||
468 | /* config=10 */ | 471 | /* config=10 */ |
469 | term = list_entry(terms->next, struct parse_events__term, list); | 472 | term = list_entry(terms->next, struct parse_events_term, list); |
470 | TEST_ASSERT_VAL("wrong type term", | 473 | TEST_ASSERT_VAL("wrong type term", |
471 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG); | 474 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG); |
472 | TEST_ASSERT_VAL("wrong type val", | 475 | TEST_ASSERT_VAL("wrong type val", |
@@ -475,7 +478,7 @@ static int test__checkterms_simple(struct list_head *terms) | |||
475 | TEST_ASSERT_VAL("wrong config", !term->config); | 478 | TEST_ASSERT_VAL("wrong config", !term->config); |
476 | 479 | ||
477 | /* config1 */ | 480 | /* config1 */ |
478 | term = list_entry(term->list.next, struct parse_events__term, list); | 481 | term = list_entry(term->list.next, struct parse_events_term, list); |
479 | TEST_ASSERT_VAL("wrong type term", | 482 | TEST_ASSERT_VAL("wrong type term", |
480 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1); | 483 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1); |
481 | TEST_ASSERT_VAL("wrong type val", | 484 | TEST_ASSERT_VAL("wrong type val", |
@@ -484,7 +487,7 @@ static int test__checkterms_simple(struct list_head *terms) | |||
484 | TEST_ASSERT_VAL("wrong config", !term->config); | 487 | TEST_ASSERT_VAL("wrong config", !term->config); |
485 | 488 | ||
486 | /* config2=3 */ | 489 | /* config2=3 */ |
487 | term = list_entry(term->list.next, struct parse_events__term, list); | 490 | term = list_entry(term->list.next, struct parse_events_term, list); |
488 | TEST_ASSERT_VAL("wrong type term", | 491 | TEST_ASSERT_VAL("wrong type term", |
489 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2); | 492 | term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2); |
490 | TEST_ASSERT_VAL("wrong type val", | 493 | TEST_ASSERT_VAL("wrong type val", |
@@ -493,7 +496,7 @@ static int test__checkterms_simple(struct list_head *terms) | |||
493 | TEST_ASSERT_VAL("wrong config", !term->config); | 496 | TEST_ASSERT_VAL("wrong config", !term->config); |
494 | 497 | ||
495 | /* umask=1*/ | 498 | /* umask=1*/ |
496 | term = list_entry(term->list.next, struct parse_events__term, list); | 499 | term = list_entry(term->list.next, struct parse_events_term, list); |
497 | TEST_ASSERT_VAL("wrong type term", | 500 | TEST_ASSERT_VAL("wrong type term", |
498 | term->type_term == PARSE_EVENTS__TERM_TYPE_USER); | 501 | term->type_term == PARSE_EVENTS__TERM_TYPE_USER); |
499 | TEST_ASSERT_VAL("wrong type val", | 502 | TEST_ASSERT_VAL("wrong type val", |
@@ -509,6 +512,7 @@ static int test__group1(struct perf_evlist *evlist) | |||
509 | struct perf_evsel *evsel, *leader; | 512 | struct perf_evsel *evsel, *leader; |
510 | 513 | ||
511 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | 514 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
515 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
512 | 516 | ||
513 | /* instructions:k */ | 517 | /* instructions:k */ |
514 | evsel = leader = perf_evlist__first(evlist); | 518 | evsel = leader = perf_evlist__first(evlist); |
@@ -521,7 +525,9 @@ static int test__group1(struct perf_evlist *evlist) | |||
521 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 525 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
522 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 526 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
523 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 527 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
524 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 528 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
529 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
530 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
525 | 531 | ||
526 | /* cycles:upp */ | 532 | /* cycles:upp */ |
527 | evsel = perf_evsel__next(evsel); | 533 | evsel = perf_evsel__next(evsel); |
@@ -536,6 +542,7 @@ static int test__group1(struct perf_evlist *evlist) | |||
536 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 542 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
537 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); | 543 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
538 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 544 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
545 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
539 | 546 | ||
540 | return 0; | 547 | return 0; |
541 | } | 548 | } |
@@ -545,6 +552,7 @@ static int test__group2(struct perf_evlist *evlist) | |||
545 | struct perf_evsel *evsel, *leader; | 552 | struct perf_evsel *evsel, *leader; |
546 | 553 | ||
547 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); | 554 | TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->nr_entries); |
555 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
548 | 556 | ||
549 | /* faults + :ku modifier */ | 557 | /* faults + :ku modifier */ |
550 | evsel = leader = perf_evlist__first(evlist); | 558 | evsel = leader = perf_evlist__first(evlist); |
@@ -557,7 +565,9 @@ static int test__group2(struct perf_evlist *evlist) | |||
557 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 565 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
558 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 566 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
559 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 567 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
560 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 568 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
569 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
570 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
561 | 571 | ||
562 | /* cache-references + :u modifier */ | 572 | /* cache-references + :u modifier */ |
563 | evsel = perf_evsel__next(evsel); | 573 | evsel = perf_evsel__next(evsel); |
@@ -567,10 +577,11 @@ static int test__group2(struct perf_evlist *evlist) | |||
567 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | 577 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); |
568 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | 578 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); |
569 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | 579 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); |
570 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 580 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
571 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 581 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
572 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 582 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
573 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 583 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
584 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
574 | 585 | ||
575 | /* cycles:k */ | 586 | /* cycles:k */ |
576 | evsel = perf_evsel__next(evsel); | 587 | evsel = perf_evsel__next(evsel); |
@@ -583,7 +594,7 @@ static int test__group2(struct perf_evlist *evlist) | |||
583 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 594 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
584 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 595 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
585 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 596 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
586 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 597 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
587 | 598 | ||
588 | return 0; | 599 | return 0; |
589 | } | 600 | } |
@@ -593,6 +604,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
593 | struct perf_evsel *evsel, *leader; | 604 | struct perf_evsel *evsel, *leader; |
594 | 605 | ||
595 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); | 606 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); |
607 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); | ||
596 | 608 | ||
597 | /* group1 syscalls:sys_enter_open:H */ | 609 | /* group1 syscalls:sys_enter_open:H */ |
598 | evsel = leader = perf_evlist__first(evlist); | 610 | evsel = leader = perf_evlist__first(evlist); |
@@ -606,9 +618,11 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
606 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | 618 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
607 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 619 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
608 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 620 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
609 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 621 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
610 | TEST_ASSERT_VAL("wrong group name", | 622 | TEST_ASSERT_VAL("wrong group name", |
611 | !strcmp(leader->group_name, "group1")); | 623 | !strcmp(leader->group_name, "group1")); |
624 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
625 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
612 | 626 | ||
613 | /* group1 cycles:kppp */ | 627 | /* group1 cycles:kppp */ |
614 | evsel = perf_evsel__next(evsel); | 628 | evsel = perf_evsel__next(evsel); |
@@ -624,6 +638,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
624 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3); | 638 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 3); |
625 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 639 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
626 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 640 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
641 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
627 | 642 | ||
628 | /* group2 cycles + G modifier */ | 643 | /* group2 cycles + G modifier */ |
629 | evsel = leader = perf_evsel__next(evsel); | 644 | evsel = leader = perf_evsel__next(evsel); |
@@ -636,9 +651,11 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
636 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 651 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
637 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 652 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
638 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 653 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
639 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 654 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
640 | TEST_ASSERT_VAL("wrong group name", | 655 | TEST_ASSERT_VAL("wrong group name", |
641 | !strcmp(leader->group_name, "group2")); | 656 | !strcmp(leader->group_name, "group2")); |
657 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
658 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
642 | 659 | ||
643 | /* group2 1:3 + G modifier */ | 660 | /* group2 1:3 + G modifier */ |
644 | evsel = perf_evsel__next(evsel); | 661 | evsel = perf_evsel__next(evsel); |
@@ -651,6 +668,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
651 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 668 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
652 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 669 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
653 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 670 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
671 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
654 | 672 | ||
655 | /* instructions:u */ | 673 | /* instructions:u */ |
656 | evsel = perf_evsel__next(evsel); | 674 | evsel = perf_evsel__next(evsel); |
@@ -663,7 +681,7 @@ static int test__group3(struct perf_evlist *evlist __maybe_unused) | |||
663 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | 681 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); |
664 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 682 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
665 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 683 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
666 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 684 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
667 | 685 | ||
668 | return 0; | 686 | return 0; |
669 | } | 687 | } |
@@ -673,6 +691,7 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
673 | struct perf_evsel *evsel, *leader; | 691 | struct perf_evsel *evsel, *leader; |
674 | 692 | ||
675 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | 693 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); |
694 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
676 | 695 | ||
677 | /* cycles:u + p */ | 696 | /* cycles:u + p */ |
678 | evsel = leader = perf_evlist__first(evlist); | 697 | evsel = leader = perf_evlist__first(evlist); |
@@ -687,7 +706,9 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
687 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 706 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
688 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); | 707 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 1); |
689 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 708 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
690 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 709 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
710 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
711 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
691 | 712 | ||
692 | /* instructions:kp + p */ | 713 | /* instructions:kp + p */ |
693 | evsel = perf_evsel__next(evsel); | 714 | evsel = perf_evsel__next(evsel); |
@@ -702,6 +723,7 @@ static int test__group4(struct perf_evlist *evlist __maybe_unused) | |||
702 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 723 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
703 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); | 724 | TEST_ASSERT_VAL("wrong precise_ip", evsel->attr.precise_ip == 2); |
704 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 725 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
726 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
705 | 727 | ||
706 | return 0; | 728 | return 0; |
707 | } | 729 | } |
@@ -711,6 +733,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
711 | struct perf_evsel *evsel, *leader; | 733 | struct perf_evsel *evsel, *leader; |
712 | 734 | ||
713 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); | 735 | TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->nr_entries); |
736 | TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups); | ||
714 | 737 | ||
715 | /* cycles + G */ | 738 | /* cycles + G */ |
716 | evsel = leader = perf_evlist__first(evlist); | 739 | evsel = leader = perf_evlist__first(evlist); |
@@ -724,7 +747,9 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
724 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 747 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
725 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 748 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
726 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 749 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
727 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 750 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
751 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
752 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
728 | 753 | ||
729 | /* instructions + G */ | 754 | /* instructions + G */ |
730 | evsel = perf_evsel__next(evsel); | 755 | evsel = perf_evsel__next(evsel); |
@@ -738,6 +763,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
738 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 763 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
739 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 764 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
740 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 765 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
766 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
741 | 767 | ||
742 | /* cycles:G */ | 768 | /* cycles:G */ |
743 | evsel = leader = perf_evsel__next(evsel); | 769 | evsel = leader = perf_evsel__next(evsel); |
@@ -751,7 +777,9 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
751 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 777 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
752 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 778 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
753 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | 779 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); |
754 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 780 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
781 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
782 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
755 | 783 | ||
756 | /* instructions:G */ | 784 | /* instructions:G */ |
757 | evsel = perf_evsel__next(evsel); | 785 | evsel = perf_evsel__next(evsel); |
@@ -765,6 +793,7 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
765 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | 793 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); |
766 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 794 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
767 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | 795 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); |
796 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
768 | 797 | ||
769 | /* cycles */ | 798 | /* cycles */ |
770 | evsel = perf_evsel__next(evsel); | 799 | evsel = perf_evsel__next(evsel); |
@@ -777,18 +806,235 @@ static int test__group5(struct perf_evlist *evlist __maybe_unused) | |||
777 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | 806 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); |
778 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | 807 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); |
779 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | 808 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); |
780 | TEST_ASSERT_VAL("wrong leader", !perf_evsel__is_group_member(evsel)); | 809 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); |
810 | |||
811 | return 0; | ||
812 | } | ||
813 | |||
814 | static int test__group_gh1(struct perf_evlist *evlist) | ||
815 | { | ||
816 | struct perf_evsel *evsel, *leader; | ||
817 | |||
818 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
819 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
820 | |||
821 | /* cycles + :H group modifier */ | ||
822 | evsel = leader = perf_evlist__first(evlist); | ||
823 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
824 | TEST_ASSERT_VAL("wrong config", | ||
825 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); | ||
826 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
827 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
828 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
829 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
830 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
831 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
832 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | ||
833 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); | ||
834 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
835 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
836 | |||
837 | /* cache-misses:G + :H group modifier */ | ||
838 | evsel = perf_evsel__next(evsel); | ||
839 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
840 | TEST_ASSERT_VAL("wrong config", | ||
841 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); | ||
842 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
843 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
844 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
845 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
846 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
847 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
848 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | ||
849 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
850 | |||
851 | return 0; | ||
852 | } | ||
853 | |||
854 | static int test__group_gh2(struct perf_evlist *evlist) | ||
855 | { | ||
856 | struct perf_evsel *evsel, *leader; | ||
857 | |||
858 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
859 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
860 | |||
861 | /* cycles + :G group modifier */ | ||
862 | evsel = leader = perf_evlist__first(evlist); | ||
863 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
864 | TEST_ASSERT_VAL("wrong config", | ||
865 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); | ||
866 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
867 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
868 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
869 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
870 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | ||
871 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
872 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | ||
873 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); | ||
874 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
875 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
876 | |||
877 | /* cache-misses:H + :G group modifier */ | ||
878 | evsel = perf_evsel__next(evsel); | ||
879 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
880 | TEST_ASSERT_VAL("wrong config", | ||
881 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); | ||
882 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
883 | TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->attr.exclude_kernel); | ||
884 | TEST_ASSERT_VAL("wrong exclude_hv", !evsel->attr.exclude_hv); | ||
885 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
886 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
887 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
888 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | ||
889 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
890 | |||
891 | return 0; | ||
892 | } | ||
893 | |||
894 | static int test__group_gh3(struct perf_evlist *evlist) | ||
895 | { | ||
896 | struct perf_evsel *evsel, *leader; | ||
897 | |||
898 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
899 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
900 | |||
901 | /* cycles:G + :u group modifier */ | ||
902 | evsel = leader = perf_evlist__first(evlist); | ||
903 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
904 | TEST_ASSERT_VAL("wrong config", | ||
905 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); | ||
906 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
907 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
908 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
909 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
910 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | ||
911 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
912 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | ||
913 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); | ||
914 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
915 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
916 | |||
917 | /* cache-misses:H + :u group modifier */ | ||
918 | evsel = perf_evsel__next(evsel); | ||
919 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
920 | TEST_ASSERT_VAL("wrong config", | ||
921 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); | ||
922 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
923 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
924 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
925 | TEST_ASSERT_VAL("wrong exclude guest", evsel->attr.exclude_guest); | ||
926 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
927 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
928 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | ||
929 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
930 | |||
931 | return 0; | ||
932 | } | ||
933 | |||
934 | static int test__group_gh4(struct perf_evlist *evlist) | ||
935 | { | ||
936 | struct perf_evsel *evsel, *leader; | ||
937 | |||
938 | TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->nr_entries); | ||
939 | TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups); | ||
940 | |||
941 | /* cycles:G + :uG group modifier */ | ||
942 | evsel = leader = perf_evlist__first(evlist); | ||
943 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
944 | TEST_ASSERT_VAL("wrong config", | ||
945 | PERF_COUNT_HW_CPU_CYCLES == evsel->attr.config); | ||
946 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
947 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
948 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
949 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
950 | TEST_ASSERT_VAL("wrong exclude host", evsel->attr.exclude_host); | ||
951 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
952 | TEST_ASSERT_VAL("wrong group name", !evsel->group_name); | ||
953 | TEST_ASSERT_VAL("wrong leader", perf_evsel__is_group_leader(evsel)); | ||
954 | TEST_ASSERT_VAL("wrong nr_members", evsel->nr_members == 2); | ||
955 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 0); | ||
956 | |||
957 | /* cache-misses:H + :uG group modifier */ | ||
958 | evsel = perf_evsel__next(evsel); | ||
959 | TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->attr.type); | ||
960 | TEST_ASSERT_VAL("wrong config", | ||
961 | PERF_COUNT_HW_CACHE_MISSES == evsel->attr.config); | ||
962 | TEST_ASSERT_VAL("wrong exclude_user", !evsel->attr.exclude_user); | ||
963 | TEST_ASSERT_VAL("wrong exclude_kernel", evsel->attr.exclude_kernel); | ||
964 | TEST_ASSERT_VAL("wrong exclude_hv", evsel->attr.exclude_hv); | ||
965 | TEST_ASSERT_VAL("wrong exclude guest", !evsel->attr.exclude_guest); | ||
966 | TEST_ASSERT_VAL("wrong exclude host", !evsel->attr.exclude_host); | ||
967 | TEST_ASSERT_VAL("wrong precise_ip", !evsel->attr.precise_ip); | ||
968 | TEST_ASSERT_VAL("wrong leader", evsel->leader == leader); | ||
969 | TEST_ASSERT_VAL("wrong group_idx", perf_evsel__group_idx(evsel) == 1); | ||
781 | 970 | ||
782 | return 0; | 971 | return 0; |
783 | } | 972 | } |
784 | 973 | ||
785 | struct test__event_st { | 974 | static int count_tracepoints(void) |
975 | { | ||
976 | char events_path[PATH_MAX]; | ||
977 | struct dirent *events_ent; | ||
978 | DIR *events_dir; | ||
979 | int cnt = 0; | ||
980 | |||
981 | scnprintf(events_path, PATH_MAX, "%s/tracing/events", | ||
982 | debugfs_find_mountpoint()); | ||
983 | |||
984 | events_dir = opendir(events_path); | ||
985 | |||
986 | TEST_ASSERT_VAL("Can't open events dir", events_dir); | ||
987 | |||
988 | while ((events_ent = readdir(events_dir))) { | ||
989 | char sys_path[PATH_MAX]; | ||
990 | struct dirent *sys_ent; | ||
991 | DIR *sys_dir; | ||
992 | |||
993 | if (!strcmp(events_ent->d_name, ".") | ||
994 | || !strcmp(events_ent->d_name, "..") | ||
995 | || !strcmp(events_ent->d_name, "enable") | ||
996 | || !strcmp(events_ent->d_name, "header_event") | ||
997 | || !strcmp(events_ent->d_name, "header_page")) | ||
998 | continue; | ||
999 | |||
1000 | scnprintf(sys_path, PATH_MAX, "%s/%s", | ||
1001 | events_path, events_ent->d_name); | ||
1002 | |||
1003 | sys_dir = opendir(sys_path); | ||
1004 | TEST_ASSERT_VAL("Can't open sys dir", sys_dir); | ||
1005 | |||
1006 | while ((sys_ent = readdir(sys_dir))) { | ||
1007 | if (!strcmp(sys_ent->d_name, ".") | ||
1008 | || !strcmp(sys_ent->d_name, "..") | ||
1009 | || !strcmp(sys_ent->d_name, "enable") | ||
1010 | || !strcmp(sys_ent->d_name, "filter")) | ||
1011 | continue; | ||
1012 | |||
1013 | cnt++; | ||
1014 | } | ||
1015 | |||
1016 | closedir(sys_dir); | ||
1017 | } | ||
1018 | |||
1019 | closedir(events_dir); | ||
1020 | return cnt; | ||
1021 | } | ||
1022 | |||
1023 | static int test__all_tracepoints(struct perf_evlist *evlist) | ||
1024 | { | ||
1025 | TEST_ASSERT_VAL("wrong events count", | ||
1026 | count_tracepoints() == evlist->nr_entries); | ||
1027 | |||
1028 | return test__checkevent_tracepoint_multi(evlist); | ||
1029 | } | ||
1030 | |||
1031 | struct evlist_test { | ||
786 | const char *name; | 1032 | const char *name; |
787 | __u32 type; | 1033 | __u32 type; |
788 | int (*check)(struct perf_evlist *evlist); | 1034 | int (*check)(struct perf_evlist *evlist); |
789 | }; | 1035 | }; |
790 | 1036 | ||
791 | static struct test__event_st test__events[] = { | 1037 | static struct evlist_test test__events[] = { |
792 | [0] = { | 1038 | [0] = { |
793 | .name = "syscalls:sys_enter_open", | 1039 | .name = "syscalls:sys_enter_open", |
794 | .check = test__checkevent_tracepoint, | 1040 | .check = test__checkevent_tracepoint, |
@@ -921,9 +1167,29 @@ static struct test__event_st test__events[] = { | |||
921 | .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", | 1167 | .name = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles", |
922 | .check = test__group5, | 1168 | .check = test__group5, |
923 | }, | 1169 | }, |
1170 | [33] = { | ||
1171 | .name = "*:*", | ||
1172 | .check = test__all_tracepoints, | ||
1173 | }, | ||
1174 | [34] = { | ||
1175 | .name = "{cycles,cache-misses:G}:H", | ||
1176 | .check = test__group_gh1, | ||
1177 | }, | ||
1178 | [35] = { | ||
1179 | .name = "{cycles,cache-misses:H}:G", | ||
1180 | .check = test__group_gh2, | ||
1181 | }, | ||
1182 | [36] = { | ||
1183 | .name = "{cycles:G,cache-misses:H}:u", | ||
1184 | .check = test__group_gh3, | ||
1185 | }, | ||
1186 | [37] = { | ||
1187 | .name = "{cycles:G,cache-misses:H}:uG", | ||
1188 | .check = test__group_gh4, | ||
1189 | }, | ||
924 | }; | 1190 | }; |
925 | 1191 | ||
926 | static struct test__event_st test__events_pmu[] = { | 1192 | static struct evlist_test test__events_pmu[] = { |
927 | [0] = { | 1193 | [0] = { |
928 | .name = "cpu/config=10,config1,config2=3,period=1000/u", | 1194 | .name = "cpu/config=10,config1,config2=3,period=1000/u", |
929 | .check = test__checkevent_pmu, | 1195 | .check = test__checkevent_pmu, |
@@ -934,20 +1200,20 @@ static struct test__event_st test__events_pmu[] = { | |||
934 | }, | 1200 | }, |
935 | }; | 1201 | }; |
936 | 1202 | ||
937 | struct test__term { | 1203 | struct terms_test { |
938 | const char *str; | 1204 | const char *str; |
939 | __u32 type; | 1205 | __u32 type; |
940 | int (*check)(struct list_head *terms); | 1206 | int (*check)(struct list_head *terms); |
941 | }; | 1207 | }; |
942 | 1208 | ||
943 | static struct test__term test__terms[] = { | 1209 | static struct terms_test test__terms[] = { |
944 | [0] = { | 1210 | [0] = { |
945 | .str = "config=10,config1,config2=3,umask=1", | 1211 | .str = "config=10,config1,config2=3,umask=1", |
946 | .check = test__checkterms_simple, | 1212 | .check = test__checkterms_simple, |
947 | }, | 1213 | }, |
948 | }; | 1214 | }; |
949 | 1215 | ||
950 | static int test_event(struct test__event_st *e) | 1216 | static int test_event(struct evlist_test *e) |
951 | { | 1217 | { |
952 | struct perf_evlist *evlist; | 1218 | struct perf_evlist *evlist; |
953 | int ret; | 1219 | int ret; |
@@ -956,7 +1222,7 @@ static int test_event(struct test__event_st *e) | |||
956 | if (evlist == NULL) | 1222 | if (evlist == NULL) |
957 | return -ENOMEM; | 1223 | return -ENOMEM; |
958 | 1224 | ||
959 | ret = parse_events(evlist, e->name, 0); | 1225 | ret = parse_events(evlist, e->name); |
960 | if (ret) { | 1226 | if (ret) { |
961 | pr_debug("failed to parse event '%s', err %d\n", | 1227 | pr_debug("failed to parse event '%s', err %d\n", |
962 | e->name, ret); | 1228 | e->name, ret); |
@@ -969,13 +1235,13 @@ static int test_event(struct test__event_st *e) | |||
969 | return ret; | 1235 | return ret; |
970 | } | 1236 | } |
971 | 1237 | ||
972 | static int test_events(struct test__event_st *events, unsigned cnt) | 1238 | static int test_events(struct evlist_test *events, unsigned cnt) |
973 | { | 1239 | { |
974 | int ret1, ret2 = 0; | 1240 | int ret1, ret2 = 0; |
975 | unsigned i; | 1241 | unsigned i; |
976 | 1242 | ||
977 | for (i = 0; i < cnt; i++) { | 1243 | for (i = 0; i < cnt; i++) { |
978 | struct test__event_st *e = &events[i]; | 1244 | struct evlist_test *e = &events[i]; |
979 | 1245 | ||
980 | pr_debug("running test %d '%s'\n", i, e->name); | 1246 | pr_debug("running test %d '%s'\n", i, e->name); |
981 | ret1 = test_event(e); | 1247 | ret1 = test_event(e); |
@@ -986,7 +1252,7 @@ static int test_events(struct test__event_st *events, unsigned cnt) | |||
986 | return ret2; | 1252 | return ret2; |
987 | } | 1253 | } |
988 | 1254 | ||
989 | static int test_term(struct test__term *t) | 1255 | static int test_term(struct terms_test *t) |
990 | { | 1256 | { |
991 | struct list_head *terms; | 1257 | struct list_head *terms; |
992 | int ret; | 1258 | int ret; |
@@ -1010,13 +1276,13 @@ static int test_term(struct test__term *t) | |||
1010 | return ret; | 1276 | return ret; |
1011 | } | 1277 | } |
1012 | 1278 | ||
1013 | static int test_terms(struct test__term *terms, unsigned cnt) | 1279 | static int test_terms(struct terms_test *terms, unsigned cnt) |
1014 | { | 1280 | { |
1015 | int ret = 0; | 1281 | int ret = 0; |
1016 | unsigned i; | 1282 | unsigned i; |
1017 | 1283 | ||
1018 | for (i = 0; i < cnt; i++) { | 1284 | for (i = 0; i < cnt; i++) { |
1019 | struct test__term *t = &terms[i]; | 1285 | struct terms_test *t = &terms[i]; |
1020 | 1286 | ||
1021 | pr_debug("running test %d '%s'\n", i, t->str); | 1287 | pr_debug("running test %d '%s'\n", i, t->str); |
1022 | ret = test_term(t); | 1288 | ret = test_term(t); |
@@ -1067,7 +1333,7 @@ static int test_pmu_events(void) | |||
1067 | 1333 | ||
1068 | while (!ret && (ent = readdir(dir))) { | 1334 | while (!ret && (ent = readdir(dir))) { |
1069 | #define MAX_NAME 100 | 1335 | #define MAX_NAME 100 |
1070 | struct test__event_st e; | 1336 | struct evlist_test e; |
1071 | char name[MAX_NAME]; | 1337 | char name[MAX_NAME]; |
1072 | 1338 | ||
1073 | if (!strcmp(ent->d_name, ".") || | 1339 | if (!strcmp(ent->d_name, ".") || |