File 0009-qa-perfevent-Test-hv_24x7-events-on-multinode.patch of Package pcp
From ebe289d9e7a56db41acfb767ebe154c4f885c885 Mon Sep 17 00:00:00 2001
From: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Date: Fri, 18 Oct 2019 13:15:16 +0530
Subject: [PATCH] qa/perfevent:Test hv_24x7 events on multinode
Patch-mainline: 5.0.1
Git-commit: ebe289d9e7a56db41acfb767ebe154c4f885c885
Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
---
.../config/test_hv_24x7_events_multinode.txt | 9 +++++
qa/perfevent/fakefs.tar.gz | Bin 8136 -> 8921 bytes
qa/perfevent/perf_event_test.c | 36 ++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 qa/perfevent/config/test_hv_24x7_events_multinode.txt
diff --git a/qa/perfevent/config/test_hv_24x7_events_multinode.txt b/qa/perfevent/config/test_hv_24x7_events_multinode.txt
new file mode 100644
index 000000000000..b17ce96eb96e
--- /dev/null
+++ b/qa/perfevent/config/test_hv_24x7_events_multinode.txt
@@ -0,0 +1,9 @@
+[pmuname ]
+INSTRUCTIONS_RETIRED cpu
+UNHALTED_REFERENCE_CYCLES cpu_rr
+
+[dynamic]
+pmu1.bar chip:0
+pmu1.bar chip:1
+pmu1.foo chip:0
+pmu1.foo chip:1
diff --git a/qa/perfevent/perf_event_test.c b/qa/perfevent/perf_event_test.c
index 4b054e0d9fed..90c21547c351 100644
--- a/qa/perfevent/perf_event_test.c
+++ b/qa/perfevent/perf_event_test.c
@@ -1091,6 +1091,39 @@ void test_parse_raw_events(void)
printf("event = %s raw code = 0x%lx\n", pmctmp->name, pmctmp->rawcode);
}
+/*
+ * This is the case where there are no PMUs exposed, it should only
+ * detect the software events.
+ */
+void test_hv_24x7_events_on_multinode_system(void)
+{
+ struct pmu *pmu_list = NULL, *tmp;
+ struct pmu_event *event;
+ int ev_count = 0;
+ const char *configfile = "config/test_hv_24x7_events_multinode.txt";
+ configuration_t *config;
+
+ config = parse_configfile(configfile);
+ assert(config != NULL);
+
+ printf( " ===== %s ==== \n", __FUNCTION__) ;
+
+ setenv("SYSFS_PREFIX", "./fakefs/syspmu_multinode", 1);
+ init_dynamic_events(&pmu_list, config->dynamicpmc->dynamicSettingList);
+ for (tmp = pmu_list; tmp; tmp = tmp->next) {
+ printf("PMU name: %s \n", tmp->name);
+ for (event = tmp->ev; event; event = event->next) {
+ if (strcmp(tmp->name, "pmu1") == 0)
+ assert(strstr(event->name, "chip"));
+ ev_count++;
+ printf(" event name: %s\n", event->name);
+ }
+ }
+
+ printf("%d events found\n", ev_count);
+ /* software events will be initialized in any case */
+ assert(ev_count == (4 + 9));
+}
int runtest(int n)
{
init_mock();
@@ -1200,6 +1233,9 @@ int runtest(int n)
case 33:
test_parse_raw_events();
break;
+ case 34:
+ test_hv_24x7_events_on_multinode_system();
+ break;
default:
ret = -1;
}
--
2.23.0