[Intel-gfx] [PATCH 2/7] tests/gem_close_race: Properly wrap init code in fixtures

Daniel Vetter daniel.vetter at ffwll.ch
Wed Feb 12 00:07:26 CET 2014


Blows up otherwise if there's no intel gpu around.

Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 tests/gem_close_race.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/gem_close_race.c b/tests/gem_close_race.c
index 4485db21180b..2087fed6080d 100644
--- a/tests/gem_close_race.c
+++ b/tests/gem_close_race.c
@@ -223,9 +223,12 @@ igt_main
 {
 	igt_skip_on_simulation();
 
-	sprintf(device, "/dev/dri/card%d", drm_get_card());
-	{
-		int fd = open(device, O_RDWR);
+	igt_fixture {
+		int fd;
+
+		sprintf(device, "/dev/dri/card%d", drm_get_card());
+		fd = open(device, O_RDWR);
+
 		igt_assert(fd != -1);
 		devid = intel_get_drm_devid(fd);
 		has_64bit_relocations = intel_gen(devid) >= 8;
-- 
1.8.5.2




More information about the Intel-gfx mailing list