]> granicus.if.org Git - strace/commitdiff
tests: fix uio building w/out preadv/pwritev
authorMike Frysinger <vapier@gentoo.org>
Mon, 11 Aug 2014 06:52:08 +0000 (02:52 -0400)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 11 Aug 2014 17:30:01 +0000 (17:30 +0000)
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
tests/uio.c
tests/uio.test

index 9aeb3a695b7efe19054b5440efbca3f7b4a71fed..054f85be5167535f4c268d1cb996b39f2ac993e5 100644 (file)
@@ -214,7 +214,9 @@ AC_CHECK_FUNCS(m4_normalize([
        if_indextoname
        inet_ntop
        prctl
+       preadv
        process_vm_readv
+       pwritev
        sendmsg
        sigaction
        stpcpy
index ca731e030c702862d3c1d967a3788ed78a51663b..aac123a63f4e93d1ea5c355c1236188f30bf3f23 100644 (file)
@@ -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
 }
index 25f82cb8d047eec6df9149d1ce893b5e134751b1..313761f5019feb0dbae95bfa0fffe2cc13c9ed0d 100755 (executable)
@@ -7,8 +7,13 @@
 check_prog grep
 check_prog rm
 
-./uio ||
-       fail_ 'uio failed'
+./uio || {
+       if [ $? -eq 77 ]; then
+               framework_skip_ 'preadv/pwritev syscalls are not available'
+       else
+               fail_ 'uio failed'
+       fi
+}
 
 args="-edesc ./uio"
 $STRACE $args > $LOG 2>&1 || {