[PATCH i-g-t] tests/device_reset: move later skips into subtests

Kamil Konieczny kamil.konieczny at linux.intel.com
Thu Apr 4 15:41:34 UTC 2024


It is safe to use skips just after igt_main() for skipping all
subtests but later on they produce logs and even if CI will
ignore that, such logs can mislead developers reading them.

Move a skip from middle of igt_main() code block into subtests
which needed them.

Cc: Mauro Carvalho Chehab <mauro.chehab at linux.intel.com>
Cc: Sai Gowtham Ch <sai.gowtham.ch at intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
---
 tests/device_reset.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/tests/device_reset.c b/tests/device_reset.c
index 583a59039..9b3b8ee6c 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -424,22 +424,25 @@ igt_main
 		healthcheck(&dev);
 	}
 
-	igt_subtest_group {
-		igt_fixture {
-			igt_skip_on_f(dev.fds.slot_dir < 0, "Gfx Card does not support any "
-				      "pcie slot for cold reset\n");
-			igt_skip_on(!is_sysfs_cold_reset_supported(dev.fds.slot_dir));
-		}
+#define SKIP_IF_NO_COLD_RESET(slot_dir) \
+	do { \
+		igt_skip_on_f(slot_dir < 0, "Gfx Card does not support any " \
+			      "pcie slot for cold reset\n"); \
+		igt_skip_on(!is_sysfs_cold_reset_supported(slot_dir)); \
+	} while(0)
 
+	igt_subtest_group {
 		igt_describe("Unbinds driver from device, initiates cold reset"
 			     " then rebinds driver to device");
 		igt_subtest("unbind-cold-reset-rebind") {
+			SKIP_IF_NO_COLD_RESET(dev.fds.slot_dir);
 			unbind_reset_rebind(&dev, COLD_RESET);
 			healthcheck(&dev);
 		}
 
 		igt_describe("Cold Resets device with bound driver");
 		igt_subtest("cold-reset-bound") {
+			SKIP_IF_NO_COLD_RESET(dev.fds.slot_dir);
 			initiate_device_reset(&dev, COLD_RESET);
 			/*
 			 * Cold reset will initiate card boot sequence again,
-- 
2.42.0



More information about the igt-dev mailing list