mirror of
https://github.com/tiagovignatti/intel-gpu-tools.git
synced 2026-08-20 21:02:59 +00:00
tests: roll out igt_fixture
Also sprinkle igt_assert and igt_require over the setup code to clean up code while at it. To avoid gcc getting upset about unitialized variables just move them out of main as global data (where they always get initialized to 0) - gcc can't see through our igt_fixture and igt_subtest maze properly. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
@@ -73,20 +73,23 @@ do_write(int fd, int handle, void *buf, int offset, int size)
|
||||
return ioctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite);
|
||||
}
|
||||
|
||||
int fd;
|
||||
uint32_t handle;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int fd;
|
||||
uint8_t expected[OBJECT_SIZE];
|
||||
uint8_t buf[OBJECT_SIZE];
|
||||
int ret;
|
||||
int handle;
|
||||
|
||||
igt_skip_on_simulation();
|
||||
igt_subtest_init(argc, argv);
|
||||
|
||||
fd = drm_open_any();
|
||||
igt_fixture {
|
||||
fd = drm_open_any();
|
||||
|
||||
handle = gem_create(fd, OBJECT_SIZE);
|
||||
handle = gem_create(fd, OBJECT_SIZE);
|
||||
}
|
||||
|
||||
igt_subtest("new-obj") {
|
||||
printf("Testing contents of newly created object.\n");
|
||||
@@ -140,7 +143,8 @@ int main(int argc, char **argv)
|
||||
igt_assert(ret == -1 && errno == ENOENT);
|
||||
}
|
||||
|
||||
close(fd);
|
||||
igt_fixture
|
||||
close(fd);
|
||||
|
||||
igt_exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user