Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>,
	Jakub Kolakowski <jakub1.kolakowski@intel.com>,
	Nakshtra Goyal <nakshtra.goyal@intel.com>
Subject: [PATCH i-g-t] tests/xe_fault_injection: Skip OA test if Xe OA interface is not available
Date: Wed, 23 Apr 2025 14:52:10 +0200	[thread overview]
Message-ID: <20250423125210.1385220-1-marcin.bernatowicz@linux.intel.com> (raw)

Handle the case where the Xe OA interface is not available by checking
for ENODEV and skipping the test gracefully. This avoids test failures
on platforms where the OA feature is not supported.

No functional change to platforms where the interface is present.

Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Jakub Kolakowski <jakub1.kolakowski@intel.com>
Cc: Nakshtra Goyal <nakshtra.goyal@intel.com>
Signed-off-by: Marcin Bernatowicz <marcin.bernatowicz@linux.intel.com>
---
 tests/intel/xe_fault_injection.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/intel/xe_fault_injection.c b/tests/intel/xe_fault_injection.c
index 24d3df572..42b467e73 100644
--- a/tests/intel/xe_fault_injection.c
+++ b/tests/intel/xe_fault_injection.c
@@ -349,6 +349,7 @@ oa_add_config_fail(int fd, int sysfs, int devid, const char function_name[])
 	uint32_t mux_regs[] = { SAMPLE_MUX_REG, 0x0 };
 	struct drm_xe_oa_config config;
 	const char *uuid = "01234567-0123-0123-0123-0123456789ab";
+	int ret;
 
 	snprintf(path, sizeof(path), "metrics/%s/id", uuid);
 	/* Destroy previous configuration if present */
@@ -361,7 +362,10 @@ oa_add_config_fail(int fd, int sysfs, int devid, const char function_name[])
 	config.n_regs = 1;
 	config.regs_ptr = to_user_pointer(mux_regs);
 
-	igt_assert_lt(0, intel_xe_perf_ioctl(fd, DRM_XE_OBSERVATION_OP_ADD_CONFIG, &config));
+	ret = intel_xe_perf_ioctl(fd, DRM_XE_OBSERVATION_OP_ADD_CONFIG, &config);
+	igt_skip_on_f(ret == -1 && errno == ENODEV, "Xe OA interface not available\n");
+
+	igt_assert_lt(0, ret);
 	igt_assert(igt_sysfs_scanf(sysfs, path, "%" PRIu64, &config_id) == 1);
 	igt_assert_eq(intel_xe_perf_ioctl(fd, DRM_XE_OBSERVATION_OP_REMOVE_CONFIG, &config_id), 0);
 
-- 
2.31.1


             reply	other threads:[~2025-04-23 12:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-23 12:52 Marcin Bernatowicz [this message]
2025-04-23 22:28 ` ✓ i915.CI.BAT: success for tests/xe_fault_injection: Skip OA test if Xe OA interface is not available Patchwork
2025-04-24  2:42 ` ✓ i915.CI.Full: " Patchwork
2025-04-24  4:45 ` ✓ Xe.CI.BAT: " Patchwork
2025-04-24 10:03 ` [PATCH i-g-t] " Goyal, Nakshtra
2025-04-24 19:51 ` ✗ Xe.CI.Full: failure for " Patchwork
2025-04-25  9:56   ` Bernatowicz, Marcin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250423125210.1385220-1-marcin.bernatowicz@linux.intel.com \
    --to=marcin.bernatowicz@linux.intel.com \
    --cc=ashutosh.dixit@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=jakub1.kolakowski@intel.com \
    --cc=nakshtra.goyal@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox