[PATCH] tests: fix uio building w/out preadv/pwritev

Mike Frysinger vapier at gentoo.org
Mon Aug 11 06:52:08 UTC 2014


The preadv/pwritev symbols weren't added to glibc until the 2.10 release,
so trying to build the uio test leads to link failures.  Add configure
tests and update uio.test to handle this.

* configure.ac (AC_CHECK_FUNCS): Add preadv/pwritev.
* tests/uio.c: Include config.h.
(main): Check for HAVE_PREADV and HAVE_PWRITEV.
* tests/uio.test: Check exit status of uio helper.
---
 configure.ac   | 2 ++
 tests/uio.c    | 7 +++++++
 tests/uio.test | 9 +++++++--
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9aeb3a6..054f85b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -214,7 +214,9 @@ AC_CHECK_FUNCS(m4_normalize([
 	if_indextoname
 	inet_ntop
 	prctl
+	preadv
 	process_vm_readv
+	pwritev
 	sendmsg
 	sigaction
 	stpcpy
diff --git a/tests/uio.c b/tests/uio.c
index ca731e0..aac123a 100644
--- a/tests/uio.c
+++ b/tests/uio.c
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 #include <fcntl.h>
 #include <unistd.h>
 #include <sys/uio.h>
@@ -6,6 +9,7 @@
 int
 main(void)
 {
+#if defined(HAVE_PREADV) && defined(HAVE_PWRITEV)
 	const off_t offset = 0xdefaceddeadbeefLL;
 	int fd;
 	char buf[4];
@@ -22,4 +26,7 @@ main(void)
 	assert(!close(fd));
 
 	return 0;
+#else
+	return 77;
+#endif
 }
diff --git a/tests/uio.test b/tests/uio.test
index 25f82cb..67abd8b 100755
--- a/tests/uio.test
+++ b/tests/uio.test
@@ -7,8 +7,13 @@
 check_prog grep
 check_prog rm
 
-./uio ||
-	fail_ 'uio failed'
+./uio || {
+	if [ $? -eq 77 ]; then
+		framework_skip_
+	else
+		fail_ 'uio failed'
+	fi
+}
 
 args="-edesc ./uio"
 $STRACE $args > $LOG 2>&1 || {
-- 
2.0.0





More information about the Strace-devel mailing list