[klibc] [klibc:master] Add trivial lseek test

klibc-bot for H. Peter Anvin hpa at zytor.com
Mon May 21 14:47:39 PDT 2012


Commit-ID:  83b7c1b245557bfd86ad5e00f64f1120c443d2a8
Gitweb:     http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=83b7c1b245557bfd86ad5e00f64f1120c443d2a8
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Mon, 21 May 2012 10:36:28 -0700
Committer:  H. Peter Anvin <hpa at zytor.com>
CommitDate: Mon, 21 May 2012 10:40:30 -0700

[klibc] Add trivial lseek test

Add a trivial lseek test which should at least make it possible to
catch parameter marshalling errors when converting to llseek.

Signed-off-by: H. Peter Anvin <hpa at zytor.com>

---
 usr/klibc/tests/Kbuild  |    1 +
 usr/klibc/tests/lseek.c |   15 +++++++++++++++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/usr/klibc/tests/Kbuild b/usr/klibc/tests/Kbuild
index 22b2078..d7f1d51 100644
--- a/usr/klibc/tests/Kbuild
+++ b/usr/klibc/tests/Kbuild
@@ -21,6 +21,7 @@ getoptlong.shared-y	:= getoptlong.o
 getpagesize.shared-y	:= getpagesize.o
 hello.shared-y		:= hello.o
 idtest.shared-y		:= idtest.o
+lseek.shared-y		:= lseek.o
 malloctest.shared-y	:= malloctest.o
 malloctest2.shared-y	:= malloctest2.o
 memstrtest.shared-y	:= memstrtest.o
diff --git a/usr/klibc/tests/lseek.c b/usr/klibc/tests/lseek.c
new file mode 100644
index 0000000..c4e7f54
--- /dev/null
+++ b/usr/klibc/tests/lseek.c
@@ -0,0 +1,15 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+int main(void)
+{
+  int fd = open("test.out", O_RDWR|O_CREAT|O_TRUNC, 0666);
+  off_t rv;
+
+  rv = lseek(fd, 123456789012ULL, SEEK_SET);
+
+  printf("seek to: %lld\n", rv);
+  return 0;
+}


More information about the klibc mailing list