tests: add a test for pread/pwrite and preadv/pwritev offset decoding
* tests/uio.c: New file.
* tests/uio.test: New test.
* tests/Makefile.am (check_PROGRAMS): Add uio.
(uio_CFLAGS): Define.
(TESTS): Add uio.test.
diff --git a/tests/uio.c b/tests/uio.c
new file mode 100644
index 0000000..ca731e0
--- /dev/null
+++ b/tests/uio.c
@@ -0,0 +1,25 @@
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/uio.h>
+#include <assert.h>
+
+int
+main(void)
+{
+ const off_t offset = 0xdefaceddeadbeefLL;
+ int fd;
+ char buf[4];
+ struct iovec iov = { buf, sizeof buf };
+
+ assert((fd = open("/dev/zero", O_RDONLY)) >= 0);
+ assert(pread(fd, buf, sizeof buf, offset) == 4);
+ assert(preadv(fd, &iov, 1, offset) == 4);
+ assert(!close(fd));
+
+ assert((fd = open("/dev/null", O_WRONLY)) >= 0);
+ assert(pwrite(fd, buf, sizeof buf, offset) == 4);
+ assert(pwritev(fd, &iov, 1, offset) == 4);
+ assert(!close(fd));
+
+ return 0;
+}