Update mm tests for GEM rename.

main
Eric Anholt 2008-05-01 16:35:12 -07:00
parent d2529d1396
commit c530011aaa
5 changed files with 31 additions and 31 deletions

6
.gitignore vendored
View File

@ -58,9 +58,9 @@ tests/getclient
tests/getstats tests/getstats
tests/getversion tests/getversion
tests/lock tests/lock
tests/mm_basic tests/gem_basic
tests/mm_mmap tests/gem_mmap
tests/mm_readwrite tests/gem_readwrite
tests/openclose tests/openclose
tests/setversion tests/setversion
tests/updatedraw tests/updatedraw

View File

@ -23,9 +23,9 @@ TESTS = auth \
lock \ lock \
setversion \ setversion \
updatedraw \ updatedraw \
mm_basic \ gem_basic \
mm_readwrite \ gem_readwrite \
mm_mmap gem_mmap
EXTRA_PROGRAMS = $(TESTS) EXTRA_PROGRAMS = $(TESTS)
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES)

View File

@ -38,13 +38,13 @@
static void static void
test_bad_unref(int fd) test_bad_unref(int fd)
{ {
struct drm_mm_unreference_args unref; struct drm_gem_unreference unref;
int ret; int ret;
printf("Testing error return on bad unreference ioctl.\n"); printf("Testing error return on bad unreference ioctl.\n");
unref.handle = 0x10101010; unref.handle = 0x10101010;
ret = ioctl(fd, DRM_IOCTL_MM_UNREFERENCE, &unref); ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
assert(ret == -1 && errno == EINVAL); assert(ret == -1 && errno == EINVAL);
} }
@ -52,32 +52,32 @@ test_bad_unref(int fd)
static void static void
test_alloc_unref(int fd) test_alloc_unref(int fd)
{ {
struct drm_mm_alloc_args alloc; struct drm_gem_alloc alloc;
struct drm_mm_unreference_args unref; struct drm_gem_unreference unref;
int ret; int ret;
printf("Testing allocating and unreferencing an object.\n"); printf("Testing allocating and unreferencing an object.\n");
memset(&alloc, 0, sizeof(alloc)); memset(&alloc, 0, sizeof(alloc));
alloc.size = 16 * 1024; alloc.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_MM_ALLOC, &alloc); ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
assert(ret == 0); assert(ret == 0);
unref.handle = alloc.handle; unref.handle = alloc.handle;
ret = ioctl(fd, DRM_IOCTL_MM_UNREFERENCE, &unref); ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
} }
static void static void
test_alloc_close(int fd) test_alloc_close(int fd)
{ {
struct drm_mm_alloc_args alloc; struct drm_gem_alloc alloc;
int ret; int ret;
printf("Testing closing with an object allocated.\n"); printf("Testing closing with an object allocated.\n");
memset(&alloc, 0, sizeof(alloc)); memset(&alloc, 0, sizeof(alloc));
alloc.size = 16 * 1024; alloc.size = 16 * 1024;
ret = ioctl(fd, DRM_IOCTL_MM_ALLOC, &alloc); ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
assert(ret == 0); assert(ret == 0);
close(fd); close(fd);

View File

@ -39,7 +39,7 @@
int do_read(int fd, int handle, void *buf, int offset, int size) int do_read(int fd, int handle, void *buf, int offset, int size)
{ {
struct drm_mm_pread_args read; struct drm_gem_pread read;
/* Ensure that we don't have any convenient data in buf in case /* Ensure that we don't have any convenient data in buf in case
* we fail. * we fail.
@ -52,12 +52,12 @@ int do_read(int fd, int handle, void *buf, int offset, int size)
read.size = size; read.size = size;
read.offset = offset; read.offset = offset;
return ioctl(fd, DRM_IOCTL_MM_PREAD, &read); return ioctl(fd, DRM_IOCTL_GEM_PREAD, &read);
} }
int do_write(int fd, int handle, void *buf, int offset, int size) int do_write(int fd, int handle, void *buf, int offset, int size)
{ {
struct drm_mm_pwrite_args write; struct drm_gem_pwrite write;
memset(&write, 0, sizeof(write)); memset(&write, 0, sizeof(write));
write.handle = handle; write.handle = handle;
@ -65,15 +65,15 @@ int do_write(int fd, int handle, void *buf, int offset, int size)
write.size = size; write.size = size;
write.offset = offset; write.offset = offset;
return ioctl(fd, DRM_IOCTL_MM_PWRITE, &write); return ioctl(fd, DRM_IOCTL_GEM_PWRITE, &write);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int fd; int fd;
struct drm_mm_alloc_args alloc; struct drm_gem_alloc alloc;
struct drm_mm_mmap_args mmap; struct drm_gem_mmap mmap;
struct drm_mm_unreference_args unref; struct drm_gem_unreference unref;
uint8_t expected[OBJECT_SIZE]; uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE]; uint8_t buf[OBJECT_SIZE];
int ret; int ret;
@ -86,12 +86,12 @@ int main(int argc, char **argv)
mmap.offset = 0; mmap.offset = 0;
mmap.size = 4096; mmap.size = 4096;
printf("Testing mmaping of bad object.\n"); printf("Testing mmaping of bad object.\n");
ret = ioctl(fd, DRM_IOCTL_MM_MMAP, &mmap); ret = ioctl(fd, DRM_IOCTL_GEM_MMAP, &mmap);
assert(ret == -1 && errno == EINVAL); assert(ret == -1 && errno == EINVAL);
memset(&alloc, 0, sizeof(alloc)); memset(&alloc, 0, sizeof(alloc));
alloc.size = OBJECT_SIZE; alloc.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_MM_ALLOC, &alloc); ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
assert(ret == 0); assert(ret == 0);
handle = alloc.handle; handle = alloc.handle;
@ -99,7 +99,7 @@ int main(int argc, char **argv)
mmap.handle = handle; mmap.handle = handle;
mmap.offset = 0; mmap.offset = 0;
mmap.size = OBJECT_SIZE; mmap.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_MM_MMAP, &mmap); ret = ioctl(fd, DRM_IOCTL_GEM_MMAP, &mmap);
assert(ret == 0); assert(ret == 0);
printf("Testing contents of newly allocated object.\n"); printf("Testing contents of newly allocated object.\n");
@ -116,7 +116,7 @@ int main(int argc, char **argv)
printf("Testing that mapping stays after unreference\n"); printf("Testing that mapping stays after unreference\n");
unref.handle = handle; unref.handle = handle;
ret = ioctl(fd, DRM_IOCTL_MM_UNREFERENCE, &unref); ret = ioctl(fd, DRM_IOCTL_GEM_UNREFERENCE, &unref);
assert(ret == 0); assert(ret == 0);
assert(memcmp(buf, mmap.addr, sizeof(buf)) == 0); assert(memcmp(buf, mmap.addr, sizeof(buf)) == 0);

View File

@ -39,7 +39,7 @@
int do_read(int fd, int handle, void *buf, int offset, int size) int do_read(int fd, int handle, void *buf, int offset, int size)
{ {
struct drm_mm_pread_args read; struct drm_gem_pread read;
/* Ensure that we don't have any convenient data in buf in case /* Ensure that we don't have any convenient data in buf in case
* we fail. * we fail.
@ -52,12 +52,12 @@ int do_read(int fd, int handle, void *buf, int offset, int size)
read.size = size; read.size = size;
read.offset = offset; read.offset = offset;
return ioctl(fd, DRM_IOCTL_MM_PREAD, &read); return ioctl(fd, DRM_IOCTL_GEM_PREAD, &read);
} }
int do_write(int fd, int handle, void *buf, int offset, int size) int do_write(int fd, int handle, void *buf, int offset, int size)
{ {
struct drm_mm_pwrite_args write; struct drm_gem_pwrite write;
memset(&write, 0, sizeof(write)); memset(&write, 0, sizeof(write));
write.handle = handle; write.handle = handle;
@ -65,13 +65,13 @@ int do_write(int fd, int handle, void *buf, int offset, int size)
write.size = size; write.size = size;
write.offset = offset; write.offset = offset;
return ioctl(fd, DRM_IOCTL_MM_PWRITE, &write); return ioctl(fd, DRM_IOCTL_GEM_PWRITE, &write);
} }
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int fd; int fd;
struct drm_mm_alloc_args alloc; struct drm_gem_alloc alloc;
uint8_t expected[OBJECT_SIZE]; uint8_t expected[OBJECT_SIZE];
uint8_t buf[OBJECT_SIZE]; uint8_t buf[OBJECT_SIZE];
int ret; int ret;
@ -81,7 +81,7 @@ int main(int argc, char **argv)
memset(&alloc, 0, sizeof(alloc)); memset(&alloc, 0, sizeof(alloc));
alloc.size = OBJECT_SIZE; alloc.size = OBJECT_SIZE;
ret = ioctl(fd, DRM_IOCTL_MM_ALLOC, &alloc); ret = ioctl(fd, DRM_IOCTL_GEM_ALLOC, &alloc);
assert(ret == 0); assert(ret == 0);
handle = alloc.handle; handle = alloc.handle;