[igt-dev] [PATCH i-g-t v2 5/5] i915/gem_ctx_isolation.c - If initialization fails, exit

Dale B Stimson dale.b.stimson at intel.com
Thu Feb 13 01:28:40 UTC 2020


At the start of igt_main, failure of the initial tests for successful
initialization transfer control to the end of an igt_fixture block.
>From there, execution of the main per-engine loop is attempted.
Instead, the test should be caused to exit.

If initialization fails, exit.

Signed-off-by: Dale B Stimson <dale.b.stimson at intel.com>
---
 tests/i915/gem_ctx_isolation.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/i915/gem_ctx_isolation.c b/tests/i915/gem_ctx_isolation.c
index 07ffbb84a..b11158dab 100644
--- a/tests/i915/gem_ctx_isolation.c
+++ b/tests/i915/gem_ctx_isolation.c
@@ -898,10 +898,13 @@ igt_main
 	int fd = -1;
 	struct eng_mmio_base_table_s *mbp = NULL;
 	uint32_t mmio_base = 0;
+	/* igt_fixture block is skipped if --list-subtests, so start with true. */
+	bool init_successful = true;
 
 	igt_fixture {
 		int gen;
 
+		init_successful = false;
 		fd = drm_open_driver(DRIVER_INTEL);
 		igt_require_gem(fd);
 		igt_require(gem_has_contexts(fd));
@@ -916,8 +919,20 @@ igt_main
 		igt_skip_on(gen > LAST_KNOWN_GEN);
 
 		mbp = gem_engine_mmio_base_info_get(fd);
+		init_successful = true;
 	}
 
+	if (!init_successful) {
+		igt_exit_early();
+	}
+
+	/**
+	 * With --list-subtests the above igt_fixture block is skipped and so
+	 * the device is not open.  Because fd < 0, __for_each_physical_engine
+	 * falls back to a static engine list, which will affect the output
+	 * of --list-subtests.
+	 */
+
 	/* __for_each_physical_engine switches context to all engines. */
 	__for_each_physical_engine(fd, e) {
 		igt_subtest_group {
-- 
2.25.0



More information about the igt-dev mailing list