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:
+14
-9
@@ -82,12 +82,14 @@ static const char *bytes_per_sec(char *buf, double v)
|
||||
}
|
||||
|
||||
|
||||
uint32_t *src, dst;
|
||||
int fd;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int object_size = 0;
|
||||
uint32_t buf[20];
|
||||
uint32_t *src, dst;
|
||||
int fd, count;
|
||||
int count;
|
||||
const struct {
|
||||
int level;
|
||||
const char *name;
|
||||
@@ -101,7 +103,6 @@ int main(int argc, char **argv)
|
||||
igt_skip_on_simulation();
|
||||
|
||||
igt_subtest_init(argc, argv);
|
||||
igt_skip_on_simulation();
|
||||
|
||||
if (argc > 1 && atoi(argv[1]))
|
||||
object_size = atoi(argv[1]);
|
||||
@@ -109,10 +110,12 @@ int main(int argc, char **argv)
|
||||
object_size = OBJECT_SIZE;
|
||||
object_size = (object_size + 3) & -4;
|
||||
|
||||
fd = drm_open_any();
|
||||
igt_fixture {
|
||||
fd = drm_open_any();
|
||||
|
||||
dst = gem_create(fd, object_size);
|
||||
src = malloc(object_size);
|
||||
dst = gem_create(fd, object_size);
|
||||
src = malloc(object_size);
|
||||
}
|
||||
|
||||
igt_subtest("normal") {
|
||||
for (count = 1; count <= 1<<17; count <<= 1) {
|
||||
@@ -148,10 +151,12 @@ int main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
free(src);
|
||||
gem_close(fd, dst);
|
||||
igt_fixture {
|
||||
free(src);
|
||||
gem_close(fd, dst);
|
||||
|
||||
close(fd);
|
||||
close(fd);
|
||||
}
|
||||
|
||||
igt_exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user