[PATCH i-g-t v2 3/4] tests/intel/xe_configfs: Install exit handler once

Lucas De Marchi lucas.demarchi at intel.com
Mon Aug 25 15:59:45 UTC 2025


All the subtests need to restore the device to a working condition.
Call igt_install_exit_handler() only once, after creating the custom
settings.

Also remove the leftover comment in restore() since that function is
used by other tests too.

Reviewed-by: Riana Tauro <riana.tauro at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 tests/intel/xe_configfs.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git a/tests/intel/xe_configfs.c b/tests/intel/xe_configfs.c
index bed92714f..4f8b873d2 100644
--- a/tests/intel/xe_configfs.c
+++ b/tests/intel/xe_configfs.c
@@ -26,7 +26,6 @@ static char bus_addr[NAME_MAX];
 
 static void restore(int sig)
 {
-	/* Restore after survivability mode */
 	igt_kmod_unbind("xe", bus_addr);
 	igt_kmod_bind("xe", bus_addr);
 }
@@ -147,26 +146,22 @@ igt_main
 		configfs_fd = igt_configfs_open("xe");
 		igt_require(configfs_fd != -1);
 		configfs_device_fd = create_device_configfs_group(configfs_fd);
+		igt_install_exit_handler(restore);
 	}
 
 	igt_describe("Validate survivability mode");
 	igt_subtest("survivability-mode") {
 		igt_require(IS_BATTLEMAGE(devid));
-		igt_install_exit_handler(restore);
 		test_survivability_mode(configfs_device_fd);
 	}
 
 	igt_describe("Validate engines_allowed with invalid options");
-	igt_subtest("engines-allowed-invalid") {
-		igt_install_exit_handler(restore);
+	igt_subtest("engines-allowed-invalid")
 		test_engines_allowed_invalid(configfs_device_fd);
-	}
 
 	igt_describe("Validate engines_allowed");
-	igt_subtest("engines-allowed") {
-		igt_install_exit_handler(restore);
+	igt_subtest("engines-allowed")
 		test_engines_allowed(configfs_device_fd);
-	}
 
 	igt_fixture {
 		igt_fs_remove_dir(configfs_fd, bus_addr);

-- 
2.50.1



More information about the igt-dev mailing list