[PATCH i-g-t 5/6] tests/intel/xe_oa: Reduce test_non_zero_reason execution time

Ashutosh Dixit ashutosh.dixit at intel.com
Tue Apr 22 19:34:57 UTC 2025


Only check a single report from a random location to reduce
test_non_zero_reason execution time.

Before:
	Starting subtest: non-zero-reason
	Starting dynamic subtest: rcs-0
	Dynamic subtest rcs-0: SUCCESS (11.108s)
	Subtest non-zero-reason: SUCCESS (11.108s)

With this patch:
	Starting subtest: non-zero-reason
	Starting dynamic subtest: rcs-0
	Dynamic subtest rcs-0: SUCCESS (1.200s)
	Subtest non-zero-reason: SUCCESS (1.200s)

v2: Check one report at a random location (Umesh)

Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
---
 tests/intel/xe_oa.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tests/intel/xe_oa.c b/tests/intel/xe_oa.c
index 83495bbacf..c01adbad34 100644
--- a/tests/intel/xe_oa.c
+++ b/tests/intel/xe_oa.c
@@ -2616,7 +2616,7 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_b
 	uint8_t *buf = malloc(buf_size);
 	uint32_t total_len = 0;
 	const uint32_t *last_report;
-	int len;
+	int len, check_idx;
 	u32 oa_status;
 
 	igt_assert(buf);
@@ -2651,6 +2651,9 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_b
 
 	igt_debug("Got %u bytes\n", total_len);
 
+	check_idx = random() % (total_len / report_size);
+	check_idx = check_idx ?: 1;
+
 	last_report = NULL;
 	for (uint32_t offset = 0; offset < total_len; offset += report_size) {
 		const uint32_t *report = (void *) (buf + offset);
@@ -2660,9 +2663,10 @@ test_non_zero_reason(const struct drm_xe_engine_class_instance *hwe, size_t oa_b
 
 		/*
 		 * Only check for default OA buffer size, since non-default
-		 * sizes can drop reports due to buffer overrun.
+		 * sizes can drop reports due to buffer overrun. Also, only
+		 * check one random report to reduce test execution time.
 		 */
-		if (!oa_buffer_size && last_report) {
+		if (!oa_buffer_size && last_report && (offset / report_size == check_idx)) {
 			sanity_check_reports(last_report, report, fmt);
 			pec_sanity_check_reports(last_report, report, metric_set(hwe));
 		}
-- 
2.48.1



More information about the igt-dev mailing list