summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2017-03-08 12:22:58 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2017-03-08 12:23:55 +0000
commit8fcca1967c539b33c8d69dc834ca564c0fa907fd (patch)
treecee22b1bc7292816eb9c57bf92c09af979148439
parent28a2f14956f7672e303fed1f9ec85cade7bd7a56 (diff)
igt/gem_madvise: Correct expected results
Trying to execbuf with a purged object is meant to fail. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--lib/ioctl_wrappers.c2
-rw-r--r--lib/ioctl_wrappers.h1
-rw-r--r--tests/gem_madvise.c18
3 files changed, 8 insertions, 13 deletions
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 7370543f..32cb0f36 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -338,7 +338,7 @@ void gem_close(int fd, uint32_t handle)
do_ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close_bo);
}
-static int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length)
+int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length)
{
struct drm_i915_gem_pwrite gem_pwrite;
int err;
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index ef92b5bc..af061ef3 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -62,6 +62,7 @@ uint32_t gem_get_caching(int fd, uint32_t handle);
uint32_t gem_flink(int fd, uint32_t handle);
uint32_t gem_open(int fd, uint32_t name);
void gem_close(int fd, uint32_t handle);
+int __gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length);
void gem_write(int fd, uint32_t handle, uint64_t offset, const void *buf, uint64_t length);
void gem_read(int fd, uint32_t handle, uint64_t offset, void *buf, uint64_t length);
void gem_set_domain(int fd, uint32_t handle,
diff --git a/tests/gem_madvise.c b/tests/gem_madvise.c
index d44a60af..729a4d33 100644
--- a/tests/gem_madvise.c
+++ b/tests/gem_madvise.c
@@ -113,19 +113,14 @@ static void
dontneed_before_pwrite(void)
{
int fd = drm_open_driver(DRIVER_INTEL);
- uint32_t buf[] = { MI_BATCH_BUFFER_END, 0 };
- struct drm_i915_gem_pwrite gem_pwrite;
+ uint32_t bbe = MI_BATCH_BUFFER_END;
+ uint32_t handle;
- gem_pwrite.handle = gem_create(fd, OBJECT_SIZE);
- gem_pwrite.offset = 0;
- gem_pwrite.size = sizeof(buf);
- gem_pwrite.data_ptr = to_user_pointer(buf);
- gem_madvise(fd, gem_pwrite.handle, I915_MADV_DONTNEED);
+ handle = gem_create(fd, OBJECT_SIZE);
+ gem_madvise(fd, handle, I915_MADV_DONTNEED);
- igt_assert(drmIoctl(fd, DRM_IOCTL_I915_GEM_PWRITE, &gem_pwrite));
- igt_assert(errno == EFAULT);
+ igt_assert_eq(__gem_write(fd, handle, 0, &bbe, sizeof(bbe)), -EFAULT);
- gem_close(fd, gem_pwrite.handle);
close(fd);
}
@@ -147,9 +142,8 @@ dontneed_before_exec(void)
execbuf.buffers_ptr = to_user_pointer(&exec);
execbuf.buffer_count = 1;
execbuf.batch_len = sizeof(buf);
- gem_execbuf(fd, &execbuf);
+ igt_assert_eq(__gem_execbuf(fd, &execbuf), -EFAULT);
- gem_close(fd, exec.handle);
close(fd);
}