summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2009-03-27 16:04:25 -0700
committerEric Anholt <eric@anholt.net>2009-03-27 16:04:25 -0700
commit0581738c7a02d45518d60924bd8cafa5446d4019 (patch)
tree90c4dcbf1289855ae3ad877db6a01a0bd0379c55
parent1eabfa9a142a314adeaba7a691e9cf85e026f79c (diff)
tests/: warning fixes
-rw-r--r--tests/gem_basic.c3
-rw-r--r--tests/gem_flink.c2
-rw-r--r--tests/gem_mmap.c25
-rw-r--r--tests/gem_readwrite.c10
-rw-r--r--tests/getstats.c1
5 files changed, 19 insertions, 22 deletions
diff --git a/tests/gem_basic.c b/tests/gem_basic.c
index b2176fba4..d52cca5c0 100644
--- a/tests/gem_basic.c
+++ b/tests/gem_basic.c
@@ -25,6 +25,7 @@
*
*/
+#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,8 +34,10 @@
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include "drm.h"
#include "i915_drm.h"
+#include "drmtest.h"
static void
test_bad_close(int fd)
diff --git a/tests/gem_flink.c b/tests/gem_flink.c
index d2e062fd1..4ec98d6d9 100644
--- a/tests/gem_flink.c
+++ b/tests/gem_flink.c
@@ -33,8 +33,10 @@
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include "drm.h"
#include "i915_drm.h"
+#include "drmtest.h"
static void
test_flink(int fd)
diff --git a/tests/gem_mmap.c b/tests/gem_mmap.c
index b5c154635..571891455 100644
--- a/tests/gem_mmap.c
+++ b/tests/gem_mmap.c
@@ -25,6 +25,7 @@
*
*/
+#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,30 +34,16 @@
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
#include "drm.h"
#include "i915_drm.h"
+#include "drmtest.h"
#define OBJECT_SIZE 16384
-int do_read(int fd, int handle, void *buf, int offset, int size)
-{
- struct drm_i915_gem_pread read;
-
- /* Ensure that we don't have any convenient data in buf in case
- * we fail.
- */
- memset(buf, 0xd0, size);
-
- memset(&read, 0, sizeof(read));
- read.handle = handle;
- read.data_ptr = (uintptr_t)buf;
- read.size = size;
- read.offset = offset;
-
- return ioctl(fd, DRM_IOCTL_I915_GEM_PREAD, &read);
-}
-
-int do_write(int fd, int handle, void *buf, int offset, int size)
+static int
+do_write(int fd, int handle, void *buf, int offset, int size)
{
struct drm_i915_gem_pwrite write;
diff --git a/tests/gem_readwrite.c b/tests/gem_readwrite.c
index bd1d232bb..26498fb4f 100644
--- a/tests/gem_readwrite.c
+++ b/tests/gem_readwrite.c
@@ -25,6 +25,7 @@
*
*/
+#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,12 +34,15 @@
#include <inttypes.h>
#include <errno.h>
#include <sys/stat.h>
+#include <sys/ioctl.h>
#include "drm.h"
#include "i915_drm.h"
+#include "drmtest.h"
#define OBJECT_SIZE 16384
-int do_read(int fd, int handle, void *buf, int offset, int size)
+static int
+do_read(int fd, int handle, void *buf, int offset, int size)
{
struct drm_i915_gem_pread read;
@@ -56,7 +60,8 @@ int do_read(int fd, int handle, void *buf, int offset, int size)
return ioctl(fd, DRM_IOCTL_I915_GEM_PREAD, &read);
}
-int do_write(int fd, int handle, void *buf, int offset, int size)
+static int
+do_write(int fd, int handle, void *buf, int offset, int size)
{
struct drm_i915_gem_pwrite write;
@@ -94,7 +99,6 @@ int main(int argc, char **argv)
printf("Testing read beyond end of buffer.\n");
ret = do_read(fd, handle, buf, OBJECT_SIZE / 2, OBJECT_SIZE);
- printf("%d %d\n", ret, errno);
assert(ret == -1 && errno == EINVAL);
printf("Testing full write of buffer\n");
diff --git a/tests/getstats.c b/tests/getstats.c
index bd55b12e7..8d40d0b36 100644
--- a/tests/getstats.c
+++ b/tests/getstats.c
@@ -26,6 +26,7 @@
*/
#include <limits.h>
+#include <sys/ioctl.h>
#include "drmtest.h"
/**