summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2008-05-12 15:42:20 -0700
committerEric Anholt <eric@anholt.net>2008-05-12 15:42:20 -0700
commit6e46a3c762919af05fcc6a08542faa7d185487a1 (patch)
treeba73b93a835451b1ddaecdae3c01253021ef53c4
parentf650d7240a5b6eea8e605734f1211c20727c21d7 (diff)
[GEM] Update testcases for new API.
-rw-r--r--tests/gem_basic.c46
-rw-r--r--tests/gem_mmap.c20
-rw-r--r--tests/gem_readwrite.c12
3 files changed, 38 insertions, 40 deletions
diff --git a/tests/gem_basic.c b/tests/gem_basic.c
index 6e1f3ddb..8b8b63d0 100644
--- a/tests/gem_basic.c
+++ b/tests/gem_basic.c
@@ -36,48 +36,48 @@
#include "drm.h"
static void
-test_bad_unref(int fd)
+test_bad_close(int fd)
{
- struct drm_gem_unreference unref;
+ struct drm_gem_close close;
int ret;
- printf("Testing error return on bad unreference ioctl.\n");
+ printf("Testing error return on bad close ioctl.\n");
- unref.handle = 0x10101010;
- ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
+ close.handle = 0x10101010;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
assert(ret == -1 && errno == EINVAL);
}
static void
-test_alloc_unref(int fd)
+test_create_close(int fd)
{
- struct drm_gem_alloc alloc;
- struct drm_gem_unreference unref;
+ struct drm_gem_create create;
+ struct drm_gem_close close;
int ret;
- printf("Testing allocating and unreferencing an object.\n");
+ printf("Testing creating and closing an object.\n");
- memset(&alloc, 0, sizeof(alloc));
- alloc.size = 16 * 1024;
- ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
+ memset(&create, 0, sizeof(create));
+ create.size = 16 * 1024;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create);
assert(ret == 0);
- unref.handle = alloc.handle;
- ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
+ close.handle = create.handle;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &close);
}
static void
-test_alloc_close(int fd)
+test_create_fd_close(int fd)
{
- struct drm_gem_alloc alloc;
+ struct drm_gem_create create;
int ret;
printf("Testing closing with an object allocated.\n");
- memset(&alloc, 0, sizeof(alloc));
- alloc.size = 16 * 1024;
- ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
+ memset(&create, 0, sizeof(create));
+ create.size = 16 * 1024;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create);
assert(ret == 0);
close(fd);
@@ -89,11 +89,9 @@ int main(int argc, char **argv)
fd = drm_open_any();
- test_bad_unref(fd);
- test_alloc_unref(fd);
- test_alloc_close(fd);
-
- close(fd);
+ test_bad_close(fd);
+ test_create_close(fd);
+ test_create_fd_close(fd);
return 0;
}
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index 4a7d6ecc..3f8e27a0 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -71,9 +71,9 @@ int do_write(int fd, int handle, void *buf, int offset, int size)
int main(int argc, char **argv)
{
int fd;
- struct drm_gem_alloc alloc;
+ struct drm_gem_create create;
struct drm_gem_mmap mmap;
- struct drm_gem_unreference unref;
+ struct drm_gem_close unref;
uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE];
uint8_t *addr;
@@ -90,13 +90,13 @@ int main(int argc, char **argv)
ret = ioctl(fd, DRM_IOCTL_GEM_MMAP, &mmap);
assert(ret == -1 && errno == EINVAL);
- memset(&alloc, 0, sizeof(alloc));
- alloc.size = OBJECT_SIZE;
- ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
+ memset(&create, 0, sizeof(create));
+ create.size = OBJECT_SIZE;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create);
assert(ret == 0);
- handle = alloc.handle;
+ handle = create.handle;
- printf("Testing mmaping of newly allocated object.\n");
+ printf("Testing mmaping of newly created object.\n");
mmap.handle = handle;
mmap.offset = 0;
mmap.size = OBJECT_SIZE;
@@ -104,7 +104,7 @@ int main(int argc, char **argv)
assert(ret == 0);
addr = (uint8_t *)(uintptr_t)mmap.addr_ptr;
- printf("Testing contents of newly allocated object.\n");
+ printf("Testing contents of newly created object.\n");
memset(expected, 0, sizeof(expected));
assert(memcmp(addr, expected, sizeof(expected)) == 0);
@@ -116,9 +116,9 @@ int main(int argc, char **argv)
assert(ret == 0);
assert(memcmp(buf, addr, sizeof(buf)) == 0);
- printf("Testing that mapping stays after unreference\n");
+ printf("Testing that mapping stays after close\n");
unref.handle = handle;
- ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
+ ret = ioctl(fd, DRM_IOCTL_GEM_CLOSE, &unref);
assert(ret == 0);
assert(memcmp(buf, addr, sizeof(buf)) == 0);
diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c
index 1cc8a3e2..a48f9847 100644
--- a/tests/gem_readwrite.c
+++ b/tests/gem_readwrite.c
@@ -71,7 +71,7 @@ int do_write(int fd, int handle, void *buf, int offset, int size)
int main(int argc, char **argv)
{
int fd;
- struct drm_gem_alloc alloc;
+ struct drm_gem_create create;
uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE];
int ret;
@@ -79,13 +79,13 @@ int main(int argc, char **argv)
fd = drm_open_any();
- memset(&alloc, 0, sizeof(alloc));
- alloc.size = OBJECT_SIZE;
- ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
+ memset(&create, 0, sizeof(create));
+ create.size = OBJECT_SIZE;
+ ret = ioctl(fd, DRM_IOCTL_GEM_CREATE, &create);
assert(ret == 0);
- handle = alloc.handle;
+ handle = create.handle;
- printf("Testing contents of newly allocated object.\n");
+ printf("Testing contents of newly created object.\n");
ret = do_read(fd, handle, buf, 0, OBJECT_SIZE);
assert(ret == 0);
memset(&expected, 0, sizeof(expected));