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:
Daniel Vetter
2013-08-14 18:02:46 +02:00
parent c3dd8a8c85
commit b3880d3a96
27 changed files with 429 additions and 429 deletions
+9 -5
View File
@@ -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();
}