diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-02-06 17:12:45 +0100 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-02-13 09:35:35 +0100 |
commit | ccc4261dc3d369a3463aa1b8ecbc676d69e337b8 (patch) | |
tree | ae2046627349688ae8a2c12538f5443ab16daecf /tests/gem_ctx_bad_destroy.c | |
parent | 09b8211d4136d6f7767652ddf73dfb0b7c1213a2 (diff) |
tests/gem_ctx_*: Use helpers
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'tests/gem_ctx_bad_destroy.c')
-rw-r--r-- | tests/gem_ctx_bad_destroy.c | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/tests/gem_ctx_bad_destroy.c b/tests/gem_ctx_bad_destroy.c index d848265c..368bf95f 100644 --- a/tests/gem_ctx_bad_destroy.c +++ b/tests/gem_ctx_bad_destroy.c @@ -38,18 +38,10 @@ IGT_TEST_DESCRIPTION("Negative test cases for destroy contexts."); -struct local_drm_i915_context_destroy { - __u32 ctx_id; - __u32 pad; -}; - -#define CONTEXT_DESTROY_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2e, struct local_drm_i915_context_destroy) - igt_simple_main { - struct local_drm_i915_context_destroy destroy; uint32_t ctx_id; - int ret, fd; + int fd; igt_skip_on_simulation(); @@ -57,24 +49,17 @@ igt_simple_main ctx_id = gem_context_create(fd); - destroy.ctx_id = ctx_id; /* Make sure a proper destroy works first */ - ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy); - igt_assert(ret == 0); + gem_context_destroy(fd, ctx_id); /* try double destroy */ - ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy); - igt_assert(ret != 0 && errno == ENOENT); + igt_assert(__gem_context_destroy(fd, ctx_id) == -ENOENT); /* destroy something random */ - destroy.ctx_id = 2; - ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy); - igt_assert(ret != 0 && errno == ENOENT); + igt_assert(__gem_context_destroy(fd, 2) == -ENOENT); /* Try to destroy the default context */ - destroy.ctx_id = 0; - ret = drmIoctl(fd, CONTEXT_DESTROY_IOCTL, &destroy); - igt_assert(ret != 0 && errno == ENOENT); + igt_assert(__gem_context_destroy(fd, 0) == -ENOENT); close(fd); } |