tests/gem_wait_render_timeout: Drop local structs
PATCH 1/3 tests/gem_wait_render_timeout: Drop local structs
We're long past the point where libdrm has these.
Signed-off-by Daniel Vetter <[email protected]>
--- tests/gem_wait_render_timeout.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-)
tests/gem_wait_render_timeout.c +2 -13
@@ -69,21 +69,10 @@ do_time_diff(struct timespec *end, struct timespec *start)return ret; } -/* to avoid stupid depencies on libdrm, copy&paste */ -struct local_drm_i915_gem_wait { -/** Handle of BO we shall wait on */ -__u32 bo_handle; -__u32 flags; -/** Number of nanoseconds to wait, Returns time remaining. */ -__u64 timeout_ns; -}; - -# define WAIT_IOCTL DRM_IOWR(DRM_COMMAND_BASE + 0x2c, struct local_drm_i915_gem_wait) -static int gem_bo_wait_timeout (int fd,uint32_t handle,uint64_t *timeout_ns) { -struct local_drm_i915_gem_wait wait; +struct drm_i915_gem_wait wait;int ret;igt_assert (timeout_ns);
@@ -91,7 +80,7 @@ gem_bo_wait_timeout(int fd, uint32_t handle, uint64_t *timeout_ns) wait.bo_handle = handle; wait.timeout_ns = *timeout_ns; wait.flags =0 ; - ret =drmIoctl (fd,WAIT_IOCTL , &wait); + ret =drmIoctl (fd,DRM_IOCTL_I915_GEM_WAIT , &wait); *timeout_ns = wait.timeout_ns;return ret ? -errno :0 ;
Signature · 1 line
1.9.3
PATCH 2/3 tests/gem_wait_render_timeout: Convert to subtests
I want to add a bunch of api tests besides the functional "render-timeout" testcase.
Signed-off-by Daniel Vetter <[email protected]>
--- tests/.gitignore | 2 +- tests/Makefile.sources | 2 +- tests/gem_wait.c | 232 ++++++++++++++++++++++++++++++++++++++++ tests/gem_wait_render_timeout.c | 219 ------------------------------------- 4 files changed, 234 insertions(+), 221 deletions(-) create mode 100644 tests/gem_wait.c delete mode 100644 tests/gem_wait_render_timeout.c
tests/.gitignore +1 -1
@@ -104,7 +104,7 @@ gem_tiling_max_stride gem_unfence_active_buffers gem_unref_active_buffers gem_userptr_blits -gem_wait_render_timeout +gem_wait gem_write_read_ring_switch gem_workarounds gen3_mixed_blits
tests/Makefile.sources +1 -1
@@ -136,7 +136,7 @@ TESTS_progs = \ gem_tiling_max_stride \ gem_unfence_active_buffers \ gem_unref_active_buffers \ - gem_wait_render_timeout \ + gem_wait \ gem_workarounds \ gen3_mixed_blits \ gen3_render_linear_blits \
tests/gem_wait.c new file +232 -0
232 lines not on this page · raw message
tests/gem_wait_render_timeout.c deleted +0 -219
219 lines not on this page · raw message
Signature · 6 lines
1.9.3 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/3 tests/gem_wait: argument validation tests
In reply to Daniel VetterShockingly we don't check for 0 flags!
Signed-off-by Daniel Vetter <[email protected]>
--- tests/gem_wait.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
tests/gem_wait.c +36 -0
@@ -216,6 +216,37 @@ static void render_timeout(int fd)close (fd); } +static void invalid_flags (int fd) +{ +struct drm_i915_gem_wait wait; +int ret; +uint32_t handle; + + handle =gem_create (fd,4096 ); + + wait.bo_handle = handle; + wait.timeout_ns =1 ; + wait.flags =0xffffffff ; + ret =drmIoctl (fd,DRM_IOCTL_I915_GEM_WAIT , &wait); + +igt_assert (ret !=0 && errno ==EINVAL ); + +gem_close (fd, handle); +} + +static void invalid_buf (int fd) +{ +struct drm_i915_gem_wait wait; +int ret; + + wait.bo_handle =0 ; + wait.timeout_ns =1 ; + wait.flags =0 ; + ret =drmIoctl (fd,DRM_IOCTL_I915_GEM_WAIT , &wait); + +igt_assert (ret !=0 && errno ==ENOENT ); +} +int drm_fd; igt_main
@@ -226,6 +257,11 @@ igt_main igt_subtest("render_timeout")render_timeout (drm_fd); + igt_subtest("invalid-flags") +invalid_flags (drm_fd); + + igt_subtest("invalid-buf") +invalid_buf (drm_fd);igt_fixture close (drm_fd );
Signature · 1 line
1.9.3