Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Lucas De Marchi <lucas.demarchi@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH i-g-t v2 2/2] tests/intel/xe_configfs: Test engines_allowed
Date: Mon,  2 Jun 2025 09:24:45 -0700	[thread overview]
Message-ID: <20250602-engines-allowed-v2-2-52bffe717766@intel.com> (raw)
In-Reply-To: <20250602-engines-allowed-v2-0-52bffe717766@intel.com>

Add tests for the parsing of engines_allowed configfs. This doesn't try
to bind the driver and ensure only those engines are available. That's
because the engine uapi instance doesn't necessarily match what is used
for configfs configuration. Maybe we will need an engine map in debugfs
for covering that.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 tests/intel/xe_configfs.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)

diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index 074cd04d9..e4fffd0b9 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -10,6 +10,7 @@
 #include "igt_fs.h"
 #include "igt_kmod.h"
 #include "igt_sysfs.h"
+#include "xe/xe_query.h"
 
 /**
  * TEST: Check configfs userspace API
@@ -54,6 +55,49 @@ static void test_survivability_mode(int configfs_device_fd)
 	close(fd);
 }
 
+/**
+ * SUBTEST: engines-allowed-invalid
+ * Description: Validate engines_allowed attribute for invalid values
+ */
+static void test_engines_allowed_invalid(int configfs_device_fd)
+{
+	static const char *values[] = {
+		"xcs0",
+		"abcsdcs0",
+		"rcs0,abcsdcs0",
+		"rcs9",
+		"rcs10",
+		"rcs0asdf",
+	};
+
+	for (size_t i = 0; i < ARRAY_SIZE(values); i++) {
+		const char *v = values[i];
+
+		igt_debug("Writing '%s' to engines_allowed\n", v);
+		igt_assert(!igt_sysfs_set(configfs_device_fd, "engines_allowed", v));
+	}
+}
+
+/**
+ * SUBTEST: engines-allowed
+ * Description: Validate engines_allowed attribute
+ */
+static void test_engines_allowed(int configfs_device_fd)
+{
+	static const char *values[] = {
+		"rcs0", "rcs*", "rcs0,bcs0", "bcs0,rcs0",
+		"bcs0\nrcs0", "bcs0\nrcs0\n",
+		"rcs000",
+	};
+
+	for (size_t i = 0; i < ARRAY_SIZE(values); i++) {
+		const char *v = values[i];
+
+		igt_debug("Writing '%s' to engines_allowed\n", v);
+		igt_assert(igt_sysfs_set(configfs_device_fd, "engines_allowed", v));
+	}
+}
+
 static int create_device_configfs_group(int configfs_fd, int fd)
 {
 	int configfs_device_fd;
@@ -88,6 +132,18 @@ igt_main
 		test_survivability_mode(configfs_device_fd);
 	}
 
+	igt_describe("Validate engines_allowed with invalid options");
+	igt_subtest("engines-allowed-invalid") {
+		igt_install_exit_handler(restore);
+		test_engines_allowed_invalid(configfs_device_fd);
+	}
+
+	igt_describe("Validate engines_allowed");
+	igt_subtest("engines-allowed") {
+		igt_install_exit_handler(restore);
+		test_engines_allowed(configfs_device_fd);
+	}
+
 	igt_fixture {
 		igt_fs_remove_dir(configfs_fd, bus_addr);
 		close(configfs_device_fd);

-- 
2.49.0


  parent reply	other threads:[~2025-06-02 16:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-02 16:24 [PATCH i-g-t v2 0/2] xe: Add test for engines_allowed in configfs Lucas De Marchi
2025-06-02 16:24 ` [PATCH i-g-t v2 1/2] tests/intel/xe_configfs: Use openat to simplify check Lucas De Marchi
2025-06-03  6:15   ` Riana Tauro
2025-06-03  6:37     ` Lucas De Marchi
2025-06-02 16:24 ` Lucas De Marchi [this message]
2025-06-06 11:16   ` [PATCH i-g-t v2 2/2] tests/intel/xe_configfs: Test engines_allowed Riana Tauro
2025-06-09 22:42   ` Umesh Nerlige Ramappa
2025-06-12 21:27     ` Lucas De Marchi
2025-06-02 21:19 ` ✓ i915.CI.BAT: success for xe: Add test for engines_allowed in configfs Patchwork
2025-06-02 21:21 ` ✓ Xe.CI.BAT: " Patchwork
2025-06-03  1:01 ` ✓ i915.CI.Full: " Patchwork
2025-06-03 20:17 ` ✗ Xe.CI.Full: failure " Patchwork

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=20250602-engines-allowed-v2-2-52bffe717766@intel.com \
    --to=lucas.demarchi@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /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