Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    2) #include "parse-events.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    3) #include "evsel.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    4) #include "evlist.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    5) #include <api/fs/fs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    6) #include "tests.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    7) #include "debug.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    8) #include "pmu.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300    9) #include <dirent.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   10) #include <errno.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   11) #include <sys/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   12) #include <sys/stat.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   13) #include <unistd.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   14) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   15) #include <linux/hw_breakpoint.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   16) #include <api/fs/tracing_path.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   18) #define PERF_TP_SAMPLE_TYPE (PERF_SAMPLE_RAW | PERF_SAMPLE_TIME | \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   19) 			     PERF_SAMPLE_CPU | PERF_SAMPLE_PERIOD)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   21) #if defined(__s390x__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   22) /* Return true if kvm module is available and loaded. Test this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   23)  * and retun success when trace point kvm_s390_create_vm
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   24)  * exists. Otherwise this test always fails.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   25)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   26) static bool kvm_s390_create_vm_valid(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   27) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   28) 	char *eventfile;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   29) 	bool rc = false;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   31) 	eventfile = get_events_file("kvm-s390");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   33) 	if (eventfile) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   34) 		DIR *mydir = opendir(eventfile);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   35) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   36) 		if (mydir) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   37) 			rc = true;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   38) 			closedir(mydir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   39) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   40) 		put_events_file(eventfile);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   41) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   43) 	return rc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   44) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   47) static int test__checkevent_tracepoint(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   49) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   51) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   52) 	TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   53) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   54) 	TEST_ASSERT_VAL("wrong sample_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   55) 		PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   56) 	TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   57) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   58) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   60) static int test__checkevent_tracepoint_multi(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   61) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   62) 	struct evsel *evsel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   64) 	TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries > 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   65) 	TEST_ASSERT_VAL("wrong number of groups", 0 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   67) 	evlist__for_each_entry(evlist, evsel) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   68) 		TEST_ASSERT_VAL("wrong type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   69) 			PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   70) 		TEST_ASSERT_VAL("wrong sample_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   71) 			PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   72) 		TEST_ASSERT_VAL("wrong sample_period",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   73) 			1 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   74) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   75) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   76) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   78) static int test__checkevent_raw(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   79) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   80) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   82) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   83) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   84) 	TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   85) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   86) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   88) static int test__checkevent_numeric(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   89) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   90) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   91) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   92) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   93) 	TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   94) 	TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   95) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   96) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   97) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   98) static int test__checkevent_symbolic_name(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   99) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  100) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  101) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  102) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  103) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  104) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  105) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  106) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  107) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  108) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  109) static int test__checkevent_symbolic_name_config(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  110) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  111) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  113) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  114) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  115) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  116) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  117) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  118) 	 * The period value gets configured within perf_evlist__config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  119) 	 * while this test executes only parse events method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  120) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  121) 	TEST_ASSERT_VAL("wrong period",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  122) 			0 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  123) 	TEST_ASSERT_VAL("wrong config1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  124) 			0 == evsel->core.attr.config1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  125) 	TEST_ASSERT_VAL("wrong config2",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  126) 			1 == evsel->core.attr.config2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  127) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  130) static int test__checkevent_symbolic_alias(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  131) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  132) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  133) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  134) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  135) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  136) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  137) 			PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  138) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  139) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  140) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  141) static int test__checkevent_genhw(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  142) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  143) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  144) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  145) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  146) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HW_CACHE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  147) 	TEST_ASSERT_VAL("wrong config", (1 << 16) == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  148) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  149) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  151) static int test__checkevent_breakpoint(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  152) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  153) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  155) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  156) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  157) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  158) 	TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  159) 					 evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  160) 	TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_4 ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  161) 					evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  162) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  165) static int test__checkevent_breakpoint_x(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  166) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  167) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  169) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  170) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  171) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  172) 	TEST_ASSERT_VAL("wrong bp_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  173) 			HW_BREAKPOINT_X == evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  174) 	TEST_ASSERT_VAL("wrong bp_len", sizeof(long) == evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  175) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  176) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  178) static int test__checkevent_breakpoint_r(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  179) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  180) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  182) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  183) 	TEST_ASSERT_VAL("wrong type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  184) 			PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  185) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  186) 	TEST_ASSERT_VAL("wrong bp_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  187) 			HW_BREAKPOINT_R == evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  188) 	TEST_ASSERT_VAL("wrong bp_len",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  189) 			HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  190) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  191) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  193) static int test__checkevent_breakpoint_w(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  194) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  195) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  197) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  198) 	TEST_ASSERT_VAL("wrong type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  199) 			PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  200) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  201) 	TEST_ASSERT_VAL("wrong bp_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  202) 			HW_BREAKPOINT_W == evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  203) 	TEST_ASSERT_VAL("wrong bp_len",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  204) 			HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  205) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  206) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  207) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  208) static int test__checkevent_breakpoint_rw(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  209) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  210) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  212) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  213) 	TEST_ASSERT_VAL("wrong type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  214) 			PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  215) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  216) 	TEST_ASSERT_VAL("wrong bp_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  217) 		(HW_BREAKPOINT_R|HW_BREAKPOINT_W) == evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  218) 	TEST_ASSERT_VAL("wrong bp_len",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  219) 			HW_BREAKPOINT_LEN_4 == evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  220) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  221) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  222) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  223) static int test__checkevent_tracepoint_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  224) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  225) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  226) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  227) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  228) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  229) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  230) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  231) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  232) 	return test__checkevent_tracepoint(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  233) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  234) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  235) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  236) test__checkevent_tracepoint_multi_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  237) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  238) 	struct evsel *evsel;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  239) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  240) 	TEST_ASSERT_VAL("wrong number of entries", evlist->core.nr_entries > 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  241) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  242) 	evlist__for_each_entry(evlist, evsel) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  243) 		TEST_ASSERT_VAL("wrong exclude_user",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  244) 				!evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  245) 		TEST_ASSERT_VAL("wrong exclude_kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  246) 				evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  247) 		TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  248) 		TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  249) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  251) 	return test__checkevent_tracepoint_multi(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  252) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  254) static int test__checkevent_raw_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  255) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  256) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  258) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  259) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  260) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  261) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  262) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  263) 	return test__checkevent_raw(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  264) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  266) static int test__checkevent_numeric_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  267) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  268) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  269) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  270) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  271) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  272) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  273) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  274) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  275) 	return test__checkevent_numeric(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  276) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  277) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  278) static int test__checkevent_symbolic_name_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  279) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  280) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  282) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  283) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  284) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  285) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  287) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  288) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  289) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  290) static int test__checkevent_exclude_host_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  291) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  292) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  293) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  294) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  295) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  296) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  297) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  298) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  300) static int test__checkevent_exclude_guest_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  301) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  302) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  303) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  304) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  305) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  306) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  307) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  308) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  309) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  310) static int test__checkevent_symbolic_alias_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  311) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  312) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  313) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  314) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  315) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  316) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  317) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  318) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  319) 	return test__checkevent_symbolic_alias(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  320) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  321) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  322) static int test__checkevent_genhw_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  323) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  324) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  325) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  326) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  327) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  328) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  329) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  330) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  331) 	return test__checkevent_genhw(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  332) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  333) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  334) static int test__checkevent_exclude_idle_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  335) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  336) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  338) 	TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  339) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  340) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  341) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  342) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  343) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  344) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  345) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  346) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  347) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  348) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  349) static int test__checkevent_exclude_idle_modifier_1(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  350) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  351) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  353) 	TEST_ASSERT_VAL("wrong exclude idle", evsel->core.attr.exclude_idle);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  354) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  355) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  356) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  357) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  358) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  359) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  361) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  362) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  363) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  364) static int test__checkevent_breakpoint_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  365) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  366) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  367) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  369) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  370) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  371) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  372) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  373) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  374) 			!strcmp(evsel__name(evsel), "mem:0:u"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  375) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  376) 	return test__checkevent_breakpoint(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  377) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  378) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  379) static int test__checkevent_breakpoint_x_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  380) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  381) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  382) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  383) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  384) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  385) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  386) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  387) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  388) 			!strcmp(evsel__name(evsel), "mem:0:x:k"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  389) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  390) 	return test__checkevent_breakpoint_x(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  391) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  392) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  393) static int test__checkevent_breakpoint_r_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  394) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  395) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  396) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  397) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  398) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  399) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  400) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  401) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  402) 			!strcmp(evsel__name(evsel), "mem:0:r:hp"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  404) 	return test__checkevent_breakpoint_r(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  405) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  406) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  407) static int test__checkevent_breakpoint_w_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  408) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  409) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  410) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  411) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  412) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  413) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  414) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  415) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  416) 			!strcmp(evsel__name(evsel), "mem:0:w:up"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  417) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  418) 	return test__checkevent_breakpoint_w(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  419) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  421) static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  422) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  423) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  425) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  426) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  427) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  428) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  429) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  430) 			!strcmp(evsel__name(evsel), "mem:0:rw:kp"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  431) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  432) 	return test__checkevent_breakpoint_rw(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  433) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  434) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  435) static int test__checkevent_pmu(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  436) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  437) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  438) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  439) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  440) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  441) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  442) 	TEST_ASSERT_VAL("wrong config",    10 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  443) 	TEST_ASSERT_VAL("wrong config1",    1 == evsel->core.attr.config1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  444) 	TEST_ASSERT_VAL("wrong config2",    3 == evsel->core.attr.config2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  445) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  446) 	 * The period value gets configured within perf_evlist__config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  447) 	 * while this test executes only parse events method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  448) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  449) 	TEST_ASSERT_VAL("wrong period",     0 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  450) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  451) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  452) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  453) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  454) static int test__checkevent_list(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  455) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  456) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  457) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  458) 	TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  459) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  460) 	/* r1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  461) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  462) 	TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  463) 	TEST_ASSERT_VAL("wrong config1", 0 == evsel->core.attr.config1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  464) 	TEST_ASSERT_VAL("wrong config2", 0 == evsel->core.attr.config2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  465) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  466) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  467) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  468) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  469) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  470) 	/* syscalls:sys_enter_openat:k */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  471) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  472) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  473) 	TEST_ASSERT_VAL("wrong sample_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  474) 		PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  475) 	TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  476) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  477) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  478) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  479) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  480) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  481) 	/* 1:1:hp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  482) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  483) 	TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  484) 	TEST_ASSERT_VAL("wrong config", 1 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  485) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  486) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  487) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  488) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  489) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  490) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  491) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  492) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  493) static int test__checkevent_pmu_name(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  494) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  495) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  496) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  497) 	/* cpu/config=1,name=krava/u */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  498) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  499) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  500) 	TEST_ASSERT_VAL("wrong config",  1 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  501) 	TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "krava"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  502) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  503) 	/* cpu/config=2/u" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  504) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  505) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  506) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  507) 	TEST_ASSERT_VAL("wrong config",  2 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  508) 	TEST_ASSERT_VAL("wrong name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  509) 			!strcmp(evsel__name(evsel), "cpu/config=2/u"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  510) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  511) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  512) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  514) static int test__checkevent_pmu_partial_time_callgraph(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  515) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  516) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  517) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  518) 	/* cpu/config=1,call-graph=fp,time,period=100000/ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  519) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  520) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  521) 	TEST_ASSERT_VAL("wrong config",  1 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  522) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  523) 	 * The period, time and callgraph value gets configured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  524) 	 * within perf_evlist__config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  525) 	 * while this test executes only parse events method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  526) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  527) 	TEST_ASSERT_VAL("wrong period",     0 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  528) 	TEST_ASSERT_VAL("wrong callgraph",  !evsel__has_callchain(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  529) 	TEST_ASSERT_VAL("wrong time",  !(PERF_SAMPLE_TIME & evsel->core.attr.sample_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  530) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  531) 	/* cpu/config=2,call-graph=no,time=0,period=2000/ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  532) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  533) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  534) 	TEST_ASSERT_VAL("wrong config",  2 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  535) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  536) 	 * The period, time and callgraph value gets configured
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  537) 	 * within perf_evlist__config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  538) 	 * while this test executes only parse events method.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  539) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  540) 	TEST_ASSERT_VAL("wrong period",     0 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  541) 	TEST_ASSERT_VAL("wrong callgraph",  !evsel__has_callchain(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  542) 	TEST_ASSERT_VAL("wrong time",  !(PERF_SAMPLE_TIME & evsel->core.attr.sample_type));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  543) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  544) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  545) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  546) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  547) static int test__checkevent_pmu_events(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  548) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  549) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  550) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  551) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  552) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  553) 	TEST_ASSERT_VAL("wrong exclude_user",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  554) 			!evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  555) 	TEST_ASSERT_VAL("wrong exclude_kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  556) 			evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  557) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  558) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  559) 	TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  560) 	TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  561) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  562) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  563) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  564) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  565) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  566) static int test__checkevent_pmu_events_mix(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  567) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  568) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  569) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  570) 	/* pmu-event:u */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  571) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  572) 	TEST_ASSERT_VAL("wrong exclude_user",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  573) 			!evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  574) 	TEST_ASSERT_VAL("wrong exclude_kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  575) 			evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  576) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  577) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  578) 	TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  579) 	TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  580) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  581) 	/* cpu/pmu-event/u*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  582) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  583) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  584) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_RAW == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  585) 	TEST_ASSERT_VAL("wrong exclude_user",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  586) 			!evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  587) 	TEST_ASSERT_VAL("wrong exclude_kernel",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  588) 			evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  589) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  590) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  591) 	TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  592) 	TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  593) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  594) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  595) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  596) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  597) static int test__checkterms_simple(struct list_head *terms)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  598) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  599) 	struct parse_events_term *term;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  600) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  601) 	/* config=10 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  602) 	term = list_entry(terms->next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  603) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  604) 			term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  605) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  606) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  607) 	TEST_ASSERT_VAL("wrong val", term->val.num == 10);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  608) 	TEST_ASSERT_VAL("wrong config", !term->config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  609) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  610) 	/* config1 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  611) 	term = list_entry(term->list.next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  612) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  613) 			term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  614) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  615) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  616) 	TEST_ASSERT_VAL("wrong val", term->val.num == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  617) 	TEST_ASSERT_VAL("wrong config", !term->config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  618) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  619) 	/* config2=3 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  620) 	term = list_entry(term->list.next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  621) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  622) 			term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  623) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  624) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  625) 	TEST_ASSERT_VAL("wrong val", term->val.num == 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  626) 	TEST_ASSERT_VAL("wrong config", !term->config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  627) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  628) 	/* umask=1*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  629) 	term = list_entry(term->list.next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  630) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  631) 			term->type_term == PARSE_EVENTS__TERM_TYPE_USER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  632) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  633) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  634) 	TEST_ASSERT_VAL("wrong val", term->val.num == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  635) 	TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "umask"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  636) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  637) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  638) 	 * read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  639) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  640) 	 * The perf_pmu__test_parse_init injects 'read' term into
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  641) 	 * perf_pmu_events_list, so 'read' is evaluated as read term
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  642) 	 * and not as raw event with 'ead' hex value.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  643) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  644) 	term = list_entry(term->list.next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  645) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  646) 			term->type_term == PARSE_EVENTS__TERM_TYPE_USER);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  647) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  648) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  649) 	TEST_ASSERT_VAL("wrong val", term->val.num == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  650) 	TEST_ASSERT_VAL("wrong config", !strcmp(term->config, "read"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  651) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  652) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  653) 	 * r0xead
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  654) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  655) 	 * To be still able to pass 'ead' value with 'r' syntax,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  656) 	 * we added support to parse 'r0xHEX' event.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  657) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  658) 	term = list_entry(term->list.next, struct parse_events_term, list);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  659) 	TEST_ASSERT_VAL("wrong type term",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  660) 			term->type_term == PARSE_EVENTS__TERM_TYPE_CONFIG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  661) 	TEST_ASSERT_VAL("wrong type val",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  662) 			term->type_val == PARSE_EVENTS__TERM_TYPE_NUM);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  663) 	TEST_ASSERT_VAL("wrong val", term->val.num == 0xead);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  664) 	TEST_ASSERT_VAL("wrong config", !term->config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  665) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  666) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  667) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  668) static int test__group1(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  669) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  670) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  671) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  672) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  673) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  674) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  675) 	/* instructions:k */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  676) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  677) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  678) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  679) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  680) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  681) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  682) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  683) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  684) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  685) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  686) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  687) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  688) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  689) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  690) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  691) 	/* cycles:upp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  692) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  693) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  694) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  695) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  696) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  697) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  698) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  699) 	/* use of precise requires exclude_guest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  700) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  701) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  702) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  703) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  704) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  705) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  706) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  707) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  708) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  709) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  710) static int test__group2(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  711) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  712) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  713) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  714) 	TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  715) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  716) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  717) 	/* faults + :ku modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  718) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  719) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  720) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  721) 			PERF_COUNT_SW_PAGE_FAULTS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  722) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  723) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  724) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  725) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  726) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  727) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  728) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  729) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  730) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  731) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  732) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  733) 	/* cache-references + :u modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  734) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  735) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  736) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  737) 			PERF_COUNT_HW_CACHE_REFERENCES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  738) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  739) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  740) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  741) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  742) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  743) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  744) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  745) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  746) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  747) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  748) 	/* cycles:k */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  749) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  750) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  751) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  752) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  753) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  754) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  755) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  756) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  757) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  758) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  759) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  760) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  761) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  762) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  763) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  764) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  765) static int test__group3(struct evlist *evlist __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  766) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  767) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  768) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  769) 	TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  770) 	TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  771) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  772) 	/* group1 syscalls:sys_enter_openat:H */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  773) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  774) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_TRACEPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  775) 	TEST_ASSERT_VAL("wrong sample_type",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  776) 		PERF_TP_SAMPLE_TYPE == evsel->core.attr.sample_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  777) 	TEST_ASSERT_VAL("wrong sample_period", 1 == evsel->core.attr.sample_period);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  778) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  779) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  780) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  781) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  782) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  783) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  784) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  785) 	TEST_ASSERT_VAL("wrong group name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  786) 		!strcmp(leader->group_name, "group1"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  787) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  788) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  789) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  790) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  791) 	/* group1 cycles:kppp */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  792) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  793) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  794) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  795) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  796) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  797) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  798) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  799) 	/* use of precise requires exclude_guest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  800) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  801) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  802) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  803) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  804) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  805) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  806) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  807) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  808) 	/* group2 cycles + G modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  809) 	evsel = leader = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  810) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  811) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  812) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  813) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  814) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  815) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  816) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  817) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  818) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  819) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  820) 	TEST_ASSERT_VAL("wrong group name",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  821) 		!strcmp(leader->group_name, "group2"));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  822) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  823) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  824) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  825) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  826) 	/* group2 1:3 + G modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  827) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  828) 	TEST_ASSERT_VAL("wrong type", 1 == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  829) 	TEST_ASSERT_VAL("wrong config", 3 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  830) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  831) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  832) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  833) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  834) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  835) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  836) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  837) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  838) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  839) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  840) 	/* instructions:u */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  841) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  842) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  843) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  844) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  845) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  846) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  847) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  848) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  849) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  850) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  851) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  852) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  853) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  854) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  855) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  856) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  857) static int test__group4(struct evlist *evlist __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  858) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  859) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  860) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  861) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  862) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  863) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  864) 	/* cycles:u + p */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  865) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  866) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  867) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  868) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  869) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  870) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  871) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  872) 	/* use of precise requires exclude_guest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  873) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  874) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  875) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  876) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  877) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  878) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  879) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  880) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  881) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  882) 	/* instructions:kp + p */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  883) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  884) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  885) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  886) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  887) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  888) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  889) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  890) 	/* use of precise requires exclude_guest */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  891) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  892) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  893) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  894) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  895) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  896) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  897) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  898) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  899) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  900) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  901) static int test__group5(struct evlist *evlist __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  902) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  903) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  904) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  905) 	TEST_ASSERT_VAL("wrong number of entries", 5 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  906) 	TEST_ASSERT_VAL("wrong number of groups", 2 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  907) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  908) 	/* cycles + G */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  909) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  910) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  911) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  912) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  913) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  914) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  915) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  916) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  917) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  918) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  919) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  920) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  921) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  922) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  923) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  924) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  925) 	/* instructions + G */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  926) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  927) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  928) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  929) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  930) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  931) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  932) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  933) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  934) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  935) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  936) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  937) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  938) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  939) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  940) 	/* cycles:G */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  941) 	evsel = leader = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  942) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  943) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  944) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  945) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  946) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  947) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  948) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  949) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  950) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  951) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  952) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  953) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  954) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  955) 	TEST_ASSERT_VAL("wrong sample_read", !evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  956) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  957) 	/* instructions:G */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  958) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  959) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  960) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  961) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  962) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  963) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  964) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  965) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  966) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  967) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  968) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  969) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  970) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  971) 	/* cycles */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  972) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  973) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  974) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  975) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  976) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  977) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  978) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  979) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  980) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  981) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  982) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  983) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  984) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  985) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  986) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  987) static int test__group_gh1(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  988) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  989) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  990) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  991) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  992) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  993) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  994) 	/* cycles + :H group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  995) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  996) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  997) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  998) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  999) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1000) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1001) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1002) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1003) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1004) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1005) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1006) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1007) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1008) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1009) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1010) 	/* cache-misses:G + :H group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1011) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1012) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1013) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1014) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1015) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1016) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1017) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1018) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1019) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1020) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1021) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1022) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1023) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1024) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1025) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1026) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1027) static int test__group_gh2(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1028) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1029) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1030) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1031) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1032) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1033) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1034) 	/* cycles + :G group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1035) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1036) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1037) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1038) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1039) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1040) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1041) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1042) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1043) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1044) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1045) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1046) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1047) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1048) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1049) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1050) 	/* cache-misses:H + :G group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1051) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1052) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1053) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1054) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1055) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1056) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1057) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1058) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1059) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1060) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1061) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1062) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1063) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1064) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1065) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1066) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1067) static int test__group_gh3(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1068) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1069) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1070) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1071) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1072) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1073) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1074) 	/* cycles:G + :u group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1075) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1076) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1077) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1078) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1079) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1080) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1081) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1082) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1083) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1084) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1085) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1086) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1087) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1088) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1089) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1090) 	/* cache-misses:H + :u group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1091) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1092) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1093) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1094) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1095) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1096) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1097) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1098) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1099) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1100) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1101) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1102) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1103) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1104) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1105) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1107) static int test__group_gh4(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1109) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1110) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1111) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1112) 	TEST_ASSERT_VAL("wrong number of groups", 1 == evlist->nr_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1114) 	/* cycles:G + :uG group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1115) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1116) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1117) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1118) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1119) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1120) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1121) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1122) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1123) 	TEST_ASSERT_VAL("wrong exclude host", evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1124) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1125) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1126) 	TEST_ASSERT_VAL("wrong leader", evsel__is_group_leader(evsel));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1127) 	TEST_ASSERT_VAL("wrong core.nr_members", evsel->core.nr_members == 2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1128) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1130) 	/* cache-misses:H + :uG group modifier */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1131) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1132) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1133) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1134) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1135) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1136) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1137) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1138) 	TEST_ASSERT_VAL("wrong exclude guest", !evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1139) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1140) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1141) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1142) 	TEST_ASSERT_VAL("wrong group_idx", evsel__group_idx(evsel) == 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1143) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1144) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1147) static int test__leader_sample1(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1148) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1149) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1150) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1151) 	TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1152) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1153) 	/* cycles - sampling group leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1154) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1155) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1156) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1157) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1158) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1159) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1160) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1161) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1162) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1163) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1164) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1165) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1166) 	TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1167) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1168) 	/* cache-misses - not sampling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1169) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1170) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1171) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1172) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1173) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1174) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1175) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1176) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1177) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1178) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1179) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1180) 	TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1182) 	/* branch-misses - not sampling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1183) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1184) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1185) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1186) 			PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1187) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1188) 	TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1189) 	TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1190) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1191) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1192) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1193) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1194) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1195) 	TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1196) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1197) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1198) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1200) static int test__leader_sample2(struct evlist *evlist __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1201) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1202) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1204) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1206) 	/* instructions - sampling group leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1207) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1208) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1209) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1210) 			PERF_COUNT_HW_INSTRUCTIONS == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1211) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1212) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1213) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1214) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1215) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1216) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1217) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1218) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1219) 	TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1221) 	/* branch-misses - not sampling */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1222) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1223) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1224) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1225) 			PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1226) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1227) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1228) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1229) 	TEST_ASSERT_VAL("wrong exclude guest", evsel->core.attr.exclude_guest);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1230) 	TEST_ASSERT_VAL("wrong exclude host", !evsel->core.attr.exclude_host);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1231) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1232) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1233) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1234) 	TEST_ASSERT_VAL("wrong sample_read", evsel->sample_read);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1235) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1236) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1237) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1238) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1239) static int test__checkevent_pinned_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1240) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1241) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1243) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1244) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1245) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1246) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1247) 	TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1249) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1250) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1251) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1252) static int test__pinned_group(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1253) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1254) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1255) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1256) 	TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1257) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1258) 	/* cycles - group leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1259) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1260) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1261) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1262) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1263) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1264) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1265) 	TEST_ASSERT_VAL("wrong pinned", evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1266) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1267) 	/* cache-misses - can not be pinned, but will go on with the leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1268) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1269) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1270) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1271) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1272) 	TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1273) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1274) 	/* branch-misses - ditto */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1275) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1276) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1277) 			PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1278) 	TEST_ASSERT_VAL("wrong pinned", !evsel->core.attr.pinned);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1279) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1280) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1282) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1283) static int test__checkevent_exclusive_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1284) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1285) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1286) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1287) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1288) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1289) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1290) 	TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1291) 	TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1293) 	return test__checkevent_symbolic_name(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1294) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1295) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1296) static int test__exclusive_group(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1297) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1298) 	struct evsel *evsel, *leader;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1299) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1300) 	TEST_ASSERT_VAL("wrong number of entries", 3 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1301) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1302) 	/* cycles - group leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1303) 	evsel = leader = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1304) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1305) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1306) 			PERF_COUNT_HW_CPU_CYCLES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1307) 	TEST_ASSERT_VAL("wrong group name", !evsel->group_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1308) 	TEST_ASSERT_VAL("wrong leader", evsel->leader == leader);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1309) 	TEST_ASSERT_VAL("wrong exclusive", evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1310) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1311) 	/* cache-misses - can not be pinned, but will go on with the leader */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1312) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1313) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_HARDWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1314) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1315) 			PERF_COUNT_HW_CACHE_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1316) 	TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1317) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1318) 	/* branch-misses - ditto */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1319) 	evsel = evsel__next(evsel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1320) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1321) 			PERF_COUNT_HW_BRANCH_MISSES == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1322) 	TEST_ASSERT_VAL("wrong exclusive", !evsel->core.attr.exclusive);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1323) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1324) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1325) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1326) static int test__checkevent_breakpoint_len(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1327) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1328) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1329) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1330) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1331) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1332) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1333) 	TEST_ASSERT_VAL("wrong bp_type", (HW_BREAKPOINT_R | HW_BREAKPOINT_W) ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1334) 					 evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1335) 	TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_1 ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1336) 					evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1337) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1338) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1339) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1340) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1341) static int test__checkevent_breakpoint_len_w(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1342) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1343) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1344) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1345) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1346) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1347) 	TEST_ASSERT_VAL("wrong config", 0 == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1348) 	TEST_ASSERT_VAL("wrong bp_type", HW_BREAKPOINT_W ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1349) 					 evsel->core.attr.bp_type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1350) 	TEST_ASSERT_VAL("wrong bp_len", HW_BREAKPOINT_LEN_2 ==
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1351) 					evsel->core.attr.bp_len);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1352) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1353) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1354) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1355) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1356) static int
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1357) test__checkevent_breakpoint_len_rw_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1358) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1359) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1360) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1361) 	TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1362) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1363) 	TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1364) 	TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1365) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1366) 	return test__checkevent_breakpoint_rw(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1367) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1368) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1369) static int test__checkevent_precise_max_modifier(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1370) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1371) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1372) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1373) 	TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1374) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1375) 	TEST_ASSERT_VAL("wrong config",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1376) 			PERF_COUNT_SW_TASK_CLOCK == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1377) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1378) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1379) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1380) static int test__checkevent_config_symbol(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1381) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1382) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1383) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1384) 	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "insn") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1385) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1386) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1387) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1388) static int test__checkevent_config_raw(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1389) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1390) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1391) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1392) 	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "rawpmu") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1393) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1395) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1396) static int test__checkevent_config_num(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1397) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1398) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1399) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1400) 	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "numpmu") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1401) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1402) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1403) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1404) static int test__checkevent_config_cache(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1405) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1406) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1407) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1408) 	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "cachepmu") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1409) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1410) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1411) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1412) static bool test__intel_pt_valid(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1413) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1414) 	return !!perf_pmu__find("intel_pt");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1415) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1416) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1417) static int test__intel_pt(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1418) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1419) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1420) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1421) 	TEST_ASSERT_VAL("wrong name setting", strcmp(evsel->name, "intel_pt//u") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1422) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1423) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1424) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1425) static int test__checkevent_complex_name(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1426) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1427) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1428) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1429) 	TEST_ASSERT_VAL("wrong complex name parsing", strcmp(evsel->name, "COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks") == 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1430) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1431) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1432) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1433) static int test__checkevent_raw_pmu(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1434) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1435) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1436) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1437) 	TEST_ASSERT_VAL("wrong number of entries", 1 == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1438) 	TEST_ASSERT_VAL("wrong type", PERF_TYPE_SOFTWARE == evsel->core.attr.type);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1439) 	TEST_ASSERT_VAL("wrong config", 0x1a == evsel->core.attr.config);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1440) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1441) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1442) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1443) static int test__sym_event_slash(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1444) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1445) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1446) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1447) 	TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1448) 	TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1449) 	TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1450) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1451) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1452) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1453) static int test__sym_event_dc(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1454) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1455) 	struct evsel *evsel = evlist__first(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1456) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1457) 	TEST_ASSERT_VAL("wrong type", evsel->core.attr.type == PERF_TYPE_HARDWARE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1458) 	TEST_ASSERT_VAL("wrong config", evsel->core.attr.config == PERF_COUNT_HW_CPU_CYCLES);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1459) 	TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1460) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1461) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1462) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1463) static int count_tracepoints(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1464) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1465) 	struct dirent *events_ent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1466) 	DIR *events_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1467) 	int cnt = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1468) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1469) 	events_dir = tracing_events__opendir();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1470) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1471) 	TEST_ASSERT_VAL("Can't open events dir", events_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1472) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1473) 	while ((events_ent = readdir(events_dir))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1474) 		char *sys_path;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1475) 		struct dirent *sys_ent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1476) 		DIR *sys_dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1477) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1478) 		if (!strcmp(events_ent->d_name, ".")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1479) 		    || !strcmp(events_ent->d_name, "..")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1480) 		    || !strcmp(events_ent->d_name, "enable")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1481) 		    || !strcmp(events_ent->d_name, "header_event")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1482) 		    || !strcmp(events_ent->d_name, "header_page"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1483) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1484) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1485) 		sys_path = get_events_file(events_ent->d_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1486) 		TEST_ASSERT_VAL("Can't get sys path", sys_path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1487) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1488) 		sys_dir = opendir(sys_path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1489) 		TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1490) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1491) 		while ((sys_ent = readdir(sys_dir))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1492) 			if (!strcmp(sys_ent->d_name, ".")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1493) 			    || !strcmp(sys_ent->d_name, "..")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1494) 			    || !strcmp(sys_ent->d_name, "enable")
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1495) 			    || !strcmp(sys_ent->d_name, "filter"))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1496) 				continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1497) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1498) 			cnt++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1499) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1500) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1501) 		closedir(sys_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1502) 		put_events_file(sys_path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1503) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1504) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1505) 	closedir(events_dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1506) 	return cnt;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1507) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1508) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1509) static int test__all_tracepoints(struct evlist *evlist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1510) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1511) 	TEST_ASSERT_VAL("wrong events count",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1512) 			count_tracepoints() == evlist->core.nr_entries);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1513) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1514) 	return test__checkevent_tracepoint_multi(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1515) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1516) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1517) struct evlist_test {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1518) 	const char *name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1519) 	__u32 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1520) 	const int id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1521) 	bool (*valid)(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1522) 	int (*check)(struct evlist *evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1523) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1524) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1525) static struct evlist_test test__events[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1526) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1527) 		.name  = "syscalls:sys_enter_openat",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1528) 		.check = test__checkevent_tracepoint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1529) 		.id    = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1530) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1531) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1532) 		.name  = "syscalls:*",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1533) 		.check = test__checkevent_tracepoint_multi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1534) 		.id    = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1535) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1536) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1537) 		.name  = "r1a",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1538) 		.check = test__checkevent_raw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1539) 		.id    = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1540) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1541) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1542) 		.name  = "1:1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1543) 		.check = test__checkevent_numeric,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1544) 		.id    = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1545) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1546) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1547) 		.name  = "instructions",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1548) 		.check = test__checkevent_symbolic_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1549) 		.id    = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1550) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1551) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1552) 		.name  = "cycles/period=100000,config2/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1553) 		.check = test__checkevent_symbolic_name_config,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1554) 		.id    = 5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1555) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1556) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1557) 		.name  = "faults",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1558) 		.check = test__checkevent_symbolic_alias,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1559) 		.id    = 6,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1560) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1561) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1562) 		.name  = "L1-dcache-load-miss",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1563) 		.check = test__checkevent_genhw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1564) 		.id    = 7,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1565) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1566) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1567) 		.name  = "mem:0",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1568) 		.check = test__checkevent_breakpoint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1569) 		.id    = 8,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1570) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1571) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1572) 		.name  = "mem:0:x",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1573) 		.check = test__checkevent_breakpoint_x,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1574) 		.id    = 9,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1575) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1576) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1577) 		.name  = "mem:0:r",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1578) 		.check = test__checkevent_breakpoint_r,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1579) 		.id    = 10,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1580) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1581) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1582) 		.name  = "mem:0:w",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1583) 		.check = test__checkevent_breakpoint_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1584) 		.id    = 11,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1585) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1586) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1587) 		.name  = "syscalls:sys_enter_openat:k",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1588) 		.check = test__checkevent_tracepoint_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1589) 		.id    = 12,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1590) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1591) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1592) 		.name  = "syscalls:*:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1593) 		.check = test__checkevent_tracepoint_multi_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1594) 		.id    = 13,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1595) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1596) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1597) 		.name  = "r1a:kp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1598) 		.check = test__checkevent_raw_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1599) 		.id    = 14,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1600) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1601) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1602) 		.name  = "1:1:hp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1603) 		.check = test__checkevent_numeric_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1604) 		.id    = 15,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1605) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1606) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1607) 		.name  = "instructions:h",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1608) 		.check = test__checkevent_symbolic_name_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1609) 		.id    = 16,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1610) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1611) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1612) 		.name  = "faults:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1613) 		.check = test__checkevent_symbolic_alias_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1614) 		.id    = 17,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1615) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1616) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1617) 		.name  = "L1-dcache-load-miss:kp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1618) 		.check = test__checkevent_genhw_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1619) 		.id    = 18,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1620) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1621) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1622) 		.name  = "mem:0:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1623) 		.check = test__checkevent_breakpoint_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1624) 		.id    = 19,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1625) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1626) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1627) 		.name  = "mem:0:x:k",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1628) 		.check = test__checkevent_breakpoint_x_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1629) 		.id    = 20,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1630) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1631) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1632) 		.name  = "mem:0:r:hp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1633) 		.check = test__checkevent_breakpoint_r_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1634) 		.id    = 21,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1635) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1636) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1637) 		.name  = "mem:0:w:up",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1638) 		.check = test__checkevent_breakpoint_w_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1639) 		.id    = 22,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1640) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1641) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1642) 		.name  = "r1,syscalls:sys_enter_openat:k,1:1:hp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1643) 		.check = test__checkevent_list,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1644) 		.id    = 23,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1645) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1646) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1647) 		.name  = "instructions:G",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1648) 		.check = test__checkevent_exclude_host_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1649) 		.id    = 24,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1650) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1651) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1652) 		.name  = "instructions:H",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1653) 		.check = test__checkevent_exclude_guest_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1654) 		.id    = 25,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1655) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1656) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1657) 		.name  = "mem:0:rw",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1658) 		.check = test__checkevent_breakpoint_rw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1659) 		.id    = 26,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1660) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1661) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1662) 		.name  = "mem:0:rw:kp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1663) 		.check = test__checkevent_breakpoint_rw_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1664) 		.id    = 27,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1665) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1666) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1667) 		.name  = "{instructions:k,cycles:upp}",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1668) 		.check = test__group1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1669) 		.id    = 28,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1670) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1671) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1672) 		.name  = "{faults:k,cache-references}:u,cycles:k",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1673) 		.check = test__group2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1674) 		.id    = 29,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1675) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1676) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1677) 		.name  = "group1{syscalls:sys_enter_openat:H,cycles:kppp},group2{cycles,1:3}:G,instructions:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1678) 		.check = test__group3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1679) 		.id    = 30,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1680) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1681) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1682) 		.name  = "{cycles:u,instructions:kp}:p",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1683) 		.check = test__group4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1684) 		.id    = 31,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1685) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1686) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1687) 		.name  = "{cycles,instructions}:G,{cycles:G,instructions:G},cycles",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1688) 		.check = test__group5,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1689) 		.id    = 32,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1690) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1691) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1692) 		.name  = "*:*",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1693) 		.check = test__all_tracepoints,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1694) 		.id    = 33,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1695) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1696) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1697) 		.name  = "{cycles,cache-misses:G}:H",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1698) 		.check = test__group_gh1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1699) 		.id    = 34,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1700) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1701) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1702) 		.name  = "{cycles,cache-misses:H}:G",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1703) 		.check = test__group_gh2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1704) 		.id    = 35,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1705) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1706) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1707) 		.name  = "{cycles:G,cache-misses:H}:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1708) 		.check = test__group_gh3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1709) 		.id    = 36,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1710) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1711) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1712) 		.name  = "{cycles:G,cache-misses:H}:uG",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1713) 		.check = test__group_gh4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1714) 		.id    = 37,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1715) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1716) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1717) 		.name  = "{cycles,cache-misses,branch-misses}:S",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1718) 		.check = test__leader_sample1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1719) 		.id    = 38,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1720) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1721) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1722) 		.name  = "{instructions,branch-misses}:Su",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1723) 		.check = test__leader_sample2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1724) 		.id    = 39,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1725) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1726) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1727) 		.name  = "instructions:uDp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1728) 		.check = test__checkevent_pinned_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1729) 		.id    = 40,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1730) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1731) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1732) 		.name  = "{cycles,cache-misses,branch-misses}:D",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1733) 		.check = test__pinned_group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1734) 		.id    = 41,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1735) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1736) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1737) 		.name  = "mem:0/1",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1738) 		.check = test__checkevent_breakpoint_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1739) 		.id    = 42,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1740) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1741) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1742) 		.name  = "mem:0/2:w",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1743) 		.check = test__checkevent_breakpoint_len_w,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1744) 		.id    = 43,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1745) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1746) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1747) 		.name  = "mem:0/4:rw:u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1748) 		.check = test__checkevent_breakpoint_len_rw_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1749) 		.id    = 44
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1750) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1751) #if defined(__s390x__)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1752) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1753) 		.name  = "kvm-s390:kvm_s390_create_vm",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1754) 		.check = test__checkevent_tracepoint,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1755) 		.valid = kvm_s390_create_vm_valid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1756) 		.id    = 100,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1757) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1758) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1759) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1760) 		.name  = "instructions:I",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1761) 		.check = test__checkevent_exclude_idle_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1762) 		.id    = 45,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1763) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1764) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1765) 		.name  = "instructions:kIG",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1766) 		.check = test__checkevent_exclude_idle_modifier_1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1767) 		.id    = 46,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1768) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1769) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1770) 		.name  = "task-clock:P,cycles",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1771) 		.check = test__checkevent_precise_max_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1772) 		.id    = 47,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1773) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1774) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1775) 		.name  = "instructions/name=insn/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1776) 		.check = test__checkevent_config_symbol,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1777) 		.id    = 48,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1778) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1779) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1780) 		.name  = "r1234/name=rawpmu/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1781) 		.check = test__checkevent_config_raw,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1782) 		.id    = 49,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1783) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1784) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1785) 		.name  = "4:0x6530160/name=numpmu/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1786) 		.check = test__checkevent_config_num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1787) 		.id    = 50,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1788) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1789) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1790) 		.name  = "L1-dcache-misses/name=cachepmu/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1791) 		.check = test__checkevent_config_cache,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1792) 		.id    = 51,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1793) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1794) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1795) 		.name  = "intel_pt//u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1796) 		.valid = test__intel_pt_valid,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1797) 		.check = test__intel_pt,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1798) 		.id    = 52,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1799) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1800) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1801) 		.name  = "cycles/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks'/Duk",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1802) 		.check = test__checkevent_complex_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1803) 		.id    = 53
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1804) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1805) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1806) 		.name  = "cycles//u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1807) 		.check = test__sym_event_slash,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1808) 		.id    = 54,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1809) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1810) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1811) 		.name  = "cycles:k",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1812) 		.check = test__sym_event_dc,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1813) 		.id    = 55,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1814) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1815) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1816) 		.name  = "instructions:uep",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1817) 		.check = test__checkevent_exclusive_modifier,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1818) 		.id    = 56,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1819) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1820) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1821) 		.name  = "{cycles,cache-misses,branch-misses}:e",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1822) 		.check = test__exclusive_group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1823) 		.id    = 57,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1824) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1825) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1826) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1827) static struct evlist_test test__events_pmu[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1828) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1829) 		.name  = "cpu/config=10,config1,config2=3,period=1000/u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1830) 		.check = test__checkevent_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1831) 		.id    = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1832) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1833) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1834) 		.name  = "cpu/config=1,name=krava/u,cpu/config=2/u",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1835) 		.check = test__checkevent_pmu_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1836) 		.id    = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1837) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1838) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1839) 		.name  = "cpu/config=1,call-graph=fp,time,period=100000/,cpu/config=2,call-graph=no,time=0,period=2000/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1840) 		.check = test__checkevent_pmu_partial_time_callgraph,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1841) 		.id    = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1842) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1843) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1844) 		.name  = "cpu/name='COMPLEX_CYCLES_NAME:orig=cycles,desc=chip-clock-ticks',period=0x1,event=0x2/ukp",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1845) 		.check = test__checkevent_complex_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1846) 		.id    = 3,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1847) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1848) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1849) 		.name  = "software/r1a/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1850) 		.check = test__checkevent_raw_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1851) 		.id    = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1852) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1853) 	{
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1854) 		.name  = "software/r0x1a/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1855) 		.check = test__checkevent_raw_pmu,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1856) 		.id    = 4,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1857) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1858) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1859) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1860) struct terms_test {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1861) 	const char *str;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1862) 	__u32 type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1863) 	int (*check)(struct list_head *terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1864) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1865) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1866) static struct terms_test test__terms[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1867) 	[0] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1868) 		.str   = "config=10,config1,config2=3,umask=1,read,r0xead",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1869) 		.check = test__checkterms_simple,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1870) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1871) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1872) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1873) static int test_event(struct evlist_test *e)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1874) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1875) 	struct parse_events_error err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1876) 	struct evlist *evlist;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1877) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1878) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1879) 	bzero(&err, sizeof(err));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1880) 	if (e->valid && !e->valid()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1881) 		pr_debug("... SKIP");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1882) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1883) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1884) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1885) 	evlist = evlist__new();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1886) 	if (evlist == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1887) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1888) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1889) 	ret = parse_events(evlist, e->name, &err);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1890) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1891) 		pr_debug("failed to parse event '%s', err %d, str '%s'\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1892) 			 e->name, ret, err.str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1893) 		parse_events_print_error(&err, e->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1894) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1895) 		ret = e->check(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1896) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1897) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1898) 	evlist__delete(evlist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1899) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1900) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1901) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1902) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1903) static int test_events(struct evlist_test *events, unsigned cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1904) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1905) 	int ret1, ret2 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1906) 	unsigned i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1907) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1908) 	for (i = 0; i < cnt; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1909) 		struct evlist_test *e = &events[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1910) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1911) 		pr_debug("running test %d '%s'", e->id, e->name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1912) 		ret1 = test_event(e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1913) 		if (ret1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1914) 			ret2 = ret1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1915) 		pr_debug("\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1916) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1917) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1918) 	return ret2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1919) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1920) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1921) static int test_term(struct terms_test *t)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1922) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1923) 	struct list_head terms;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1924) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1925) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1926) 	INIT_LIST_HEAD(&terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1927) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1928) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1929) 	 * The perf_pmu__test_parse_init prepares perf_pmu_events_list
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1930) 	 * which gets freed in parse_events_terms.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1931) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1932) 	if (perf_pmu__test_parse_init())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1933) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1934) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1935) 	ret = parse_events_terms(&terms, t->str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1936) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1937) 		pr_debug("failed to parse terms '%s', err %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1938) 			 t->str , ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1939) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1940) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1941) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1942) 	ret = t->check(&terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1943) 	parse_events_terms__purge(&terms);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1944) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1945) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1946) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1947) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1948) static int test_terms(struct terms_test *terms, unsigned cnt)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1949) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1950) 	int ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1951) 	unsigned i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1952) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1953) 	for (i = 0; i < cnt; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1954) 		struct terms_test *t = &terms[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1955) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1956) 		pr_debug("running test %d '%s'\n", i, t->str);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1957) 		ret = test_term(t);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1958) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1959) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1960) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1961) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1962) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1963) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1964) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1965) static int test_pmu(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1966) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1967) 	struct stat st;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1968) 	char path[PATH_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1969) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1970) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1971) 	snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/format/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1972) 		 sysfs__mountpoint());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1973) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1974) 	ret = stat(path, &st);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1975) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1976) 		pr_debug("omitting PMU cpu tests\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1977) 	return !ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1978) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1979) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1980) static int test_pmu_events(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1981) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1982) 	struct stat st;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1983) 	char path[PATH_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1984) 	struct dirent *ent;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1985) 	DIR *dir;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1986) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1987) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1988) 	snprintf(path, PATH_MAX, "%s/bus/event_source/devices/cpu/events/",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1989) 		 sysfs__mountpoint());
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1990) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1991) 	ret = stat(path, &st);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1992) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1993) 		pr_debug("omitting PMU cpu events tests\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1994) 		return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1995) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1996) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1997) 	dir = opendir(path);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1998) 	if (!dir) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1999) 		pr_debug("can't open pmu event dir");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2000) 		return -1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2001) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2002) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2003) 	while (!ret && (ent = readdir(dir))) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2004) 		struct evlist_test e = { .id = 0, };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2005) 		char name[2 * NAME_MAX + 1 + 12 + 3];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2006) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2007) 		/* Names containing . are special and cannot be used directly */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2008) 		if (strchr(ent->d_name, '.'))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2009) 			continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2010) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2011) 		snprintf(name, sizeof(name), "cpu/event=%s/u", ent->d_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2012) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2013) 		e.name  = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2014) 		e.check = test__checkevent_pmu_events;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2015) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2016) 		ret = test_event(&e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2017) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2018) 			break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2019) 		snprintf(name, sizeof(name), "%s:u,cpu/event=%s/u", ent->d_name, ent->d_name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2020) 		e.name  = name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2021) 		e.check = test__checkevent_pmu_events_mix;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2022) 		ret = test_event(&e);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2023) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2024) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2025) 	closedir(dir);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2026) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2027) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2028) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2029) int test__parse_events(struct test *test __maybe_unused, int subtest __maybe_unused)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2030) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2031) 	int ret1, ret2 = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2032) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2033) #define TEST_EVENTS(tests)				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2034) do {							\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2035) 	ret1 = test_events(tests, ARRAY_SIZE(tests));	\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2036) 	if (!ret2)					\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2037) 		ret2 = ret1;				\
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2038) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2039) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2040) 	TEST_EVENTS(test__events);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2041) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2042) 	if (test_pmu())
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2043) 		TEST_EVENTS(test__events_pmu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2044) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2045) 	if (test_pmu()) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2046) 		int ret = test_pmu_events();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2047) 		if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2048) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2049) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2050) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2051) 	ret1 = test_terms(test__terms, ARRAY_SIZE(test__terms));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2052) 	if (!ret2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2053) 		ret2 = ret1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2054) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2055) 	return ret2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2056) }