git » libfiu » commit ab0f706

Add tests for pread() and pread64()

author Alberto Bertogli
2014-01-23 23:20:41 UTC
committer Alberto Bertogli
2014-01-23 23:55:33 UTC
parent 855d84b4b48324bafee37a9136eec98e4aeb5d6e

Add tests for pread() and pread64()

This patch adds simple autogenerated tests for pread() and pread64().

Both functions share the same failure point, and are generated using the
off64_t variant mechanism, so this serves as a test for both the variant code
generation as well as the build environment.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

tests/generated/tests/pread.conf +10 -0
tests/generated/tests/pread64.conf +11 -0

diff --git a/tests/generated/tests/pread.conf b/tests/generated/tests/pread.conf
new file mode 100644
index 0000000..380288d
--- /dev/null
+++ b/tests/generated/tests/pread.conf
@@ -0,0 +1,10 @@
+
+[kill]
+fp: posix/io/rw/pread
+include: unistd.h sys/types.h sys/stat.h fcntl.h
+prep: unsigned char buf[1024]; ssize_t r; int fd = open("/dev/zero", O_RDONLY);
+call: r = pread(fd, buf, 1024, 0);
+success_cond: r != -1
+failure_cond: r == -1
+errno_on_fail: EIO
+
diff --git a/tests/generated/tests/pread64.conf b/tests/generated/tests/pread64.conf
new file mode 100644
index 0000000..11c4b85
--- /dev/null
+++ b/tests/generated/tests/pread64.conf
@@ -0,0 +1,11 @@
+
+[pread64]
+ifdef: __GLIBC__
+fp: posix/io/rw/pread
+include: unistd.h sys/types.h sys/stat.h fcntl.h
+prep: unsigned char buf[1024]; ssize_t r; int fd = open("/dev/zero", O_RDONLY);
+call: r = pread64(fd, buf, 1024, 0);
+success_cond: r != -1
+failure_cond: r == -1
+errno_on_fail: EIO
+