[PATCH 1/3] lib: make igt_set_vt_graphics_mode never fail

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All tests agree that this is a letal failure, so no point
to pass it back to callers.

Also add some igt_require calls for the drm_fd where I've
noticed that it's missing.

Signed-off-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
---
 lib/drmtest.c            | 7 +++----
 lib/drmtest.h            | 2 +-
 tests/debugfs_pipe_crc.c | 4 +++-
 tests/kms_cursor_crc.c   | 4 +++-
 tests/kms_flip.c         | 2 +-
 tests/kms_render.c       | 2 +-
 tests/kms_setmode.c      | 2 +-
 tests/pc8.c              | 2 +-
 tests/testdisplay.c      | 2 +-
 9 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/lib/drmtest.c b/lib/drmtest.c
index 576b4ab..5887595 100644
--- a/lib/drmtest.c
+++ b/lib/drmtest.c
@@ -2110,10 +2110,9 @@ static void restore_vt_mode_at_exit(int sig)
  * original mode.
  */
 
-int igt_set_vt_graphics_mode(void)
+void igt_set_vt_graphics_mode(void)
 {
-	if (igt_install_exit_handler(restore_vt_mode_at_exit))
-		return -1;
+	do_or_die(igt_install_exit_handler(restore_vt_mode_at_exit));
 
 	igt_disable_exit_handler();
 	orig_vt_mode = set_vt_mode(KD_GRAPHICS);
@@ -2121,7 +2120,7 @@ int igt_set_vt_graphics_mode(void)
 		orig_vt_mode = -1UL;
 	igt_enable_exit_handler();
 
-	return orig_vt_mode < 0 ? -1 : 0;
+	igt_assert(orig_vt_mode >= 0);
 }
 
 int kmstest_get_connector_default_mode(int drm_fd, drmModeConnector *connector,
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 9807bc7..5b35545 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -404,7 +404,7 @@ void igt_enable_exit_handler(void);
 void igt_disable_exit_handler(void);
 
 /* set vt into graphics mode, required to prevent fbcon from interfering */
-int igt_set_vt_graphics_mode(void);
+void igt_set_vt_graphics_mode(void);
 
 /* prefault disabling, needs the corresponding debugfs interface */
 void igt_disable_prefault(void);
diff --git a/tests/debugfs_pipe_crc.c b/tests/debugfs_pipe_crc.c
index fe14c6c..2096f49 100644
--- a/tests/debugfs_pipe_crc.c
+++ b/tests/debugfs_pipe_crc.c
@@ -218,7 +218,9 @@ int main(int argc, char **argv)
 		const char *cmd = "pipe A none";
 
 		data.drm_fd = drm_open_any();
-		do_or_die(igt_set_vt_graphics_mode());
+		igt_require(data.drm_fd >= 0);
+
+		igt_set_vt_graphics_mode();
 
 		display_init(&data);
 
diff --git a/tests/kms_cursor_crc.c b/tests/kms_cursor_crc.c
index d29b0a6..2c9ca35 100644
--- a/tests/kms_cursor_crc.c
+++ b/tests/kms_cursor_crc.c
@@ -333,7 +333,9 @@ igt_main
 		const char *cmd = "pipe A none";
 
 		data.drm_fd = drm_open_any();
-		do_or_die(igt_set_vt_graphics_mode());
+		igt_require(data.drm_fd >= 0);
+
+		igt_set_vt_graphics_mode();
 
 		igt_debugfs_init(&data.debugfs);
 		data.ctl = igt_debugfs_fopen(&data.debugfs,
diff --git a/tests/kms_flip.c b/tests/kms_flip.c
index 58185ef..e8d3e22 100644
--- a/tests/kms_flip.c
+++ b/tests/kms_flip.c
@@ -1493,7 +1493,7 @@ int main(int argc, char **argv)
 	igt_fixture {
 		drm_fd = drm_open_any();
 
-		do_or_die(igt_set_vt_graphics_mode());
+		igt_set_vt_graphics_mode();
 		do_or_die(igt_install_exit_handler(kms_flip_exit_handler));
 		get_timestamp_format();
 
diff --git a/tests/kms_render.c b/tests/kms_render.c
index 6a41055..26ca8dc 100644
--- a/tests/kms_render.c
+++ b/tests/kms_render.c
@@ -242,7 +242,7 @@ int main(int argc, char **argv)
 		devid = intel_get_drm_devid(drm_fd);
 		batch = intel_batchbuffer_alloc(bufmgr, devid);
 
-		do_or_die(igt_set_vt_graphics_mode());
+		igt_set_vt_graphics_mode();
 	}
 
 	for (i = 0; i < ARRAY_SIZE(tests); i++) {
diff --git a/tests/kms_setmode.c b/tests/kms_setmode.c
index 7b22225..6bc7db1 100644
--- a/tests/kms_setmode.c
+++ b/tests/kms_setmode.c
@@ -702,7 +702,7 @@ int main(int argc, char **argv)
 	igt_fixture {
 		drm_fd = drm_open_any();
 		if (!dry_run)
-			do_or_die(igt_set_vt_graphics_mode());
+			igt_set_vt_graphics_mode();
 
 		drm_resources = drmModeGetResources(drm_fd);
 		assert(drm_resources);
diff --git a/tests/pc8.c b/tests/pc8.c
index e3d6e33..0ec011e 100644
--- a/tests/pc8.c
+++ b/tests/pc8.c
@@ -292,7 +292,7 @@ static void init_mode_set_data(struct mode_set_data *data)
 	data->bufmgr = drm_intel_bufmgr_gem_init(drm_fd, 4096);
 	data->devid = intel_get_drm_devid(drm_fd);
 
-	do_or_die(igt_set_vt_graphics_mode());
+	igt_set_vt_graphics_mode();
 	drm_intel_bufmgr_gem_enable_reuse(data->bufmgr);
 }
 
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index a0f43e9..fd172f3 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -801,7 +801,7 @@ int main(int argc, char **argv)
 		goto out_close;
 	}
 
-	do_or_die(igt_set_vt_graphics_mode());
+	igt_set_vt_graphics_mode();
 
 	mainloop = g_main_loop_new(NULL, FALSE);
 	if (!mainloop) {
-- 
1.8.4.rc3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux