Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/rpc skip the tests if rpcbind is not responding.



details:   https://anonhg.NetBSD.org/src/rev/087f92f5c1f1
branches:  trunk
changeset: 785152:087f92f5c1f1
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Feb 27 18:39:58 2013 +0000

description:
skip the tests if rpcbind is not responding.

diffstat:

 tests/lib/libc/rpc/t_rpc.c |  22 +++++++++++++++++++---
 1 files changed, 19 insertions(+), 3 deletions(-)

diffs (56 lines):

diff -r 7db14da197ab -r 087f92f5c1f1 tests/lib/libc/rpc/t_rpc.c
--- a/tests/lib/libc/rpc/t_rpc.c        Wed Feb 27 17:52:44 2013 +0000
+++ b/tests/lib/libc/rpc/t_rpc.c        Wed Feb 27 18:39:58 2013 +0000
@@ -1,7 +1,7 @@
-/*     $NetBSD: t_rpc.c,v 1.1 2013/02/26 17:06:55 christos Exp $       */
+/*     $NetBSD: t_rpc.c,v 1.2 2013/02/27 18:39:58 christos Exp $       */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_rpc.c,v 1.1 2013/02/26 17:06:55 christos Exp $");
+__RCSID("$NetBSD: t_rpc.c,v 1.2 2013/02/27 18:39:58 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -17,8 +17,15 @@
 #include <atf-c.h>
 
 #define ERRX(ev, msg, ...)     ATF_REQUIRE_MSG(0, msg, __VA_ARGS__)
+
+#define SKIPX(ev, msg, ...)    do {                    \
+       atf_tc_skip(msg, __VA_ARGS__);                  \
+       return;                                         \
+} while(/*CONSTCOND*/0)
+
 #else
 #define ERRX(ev, msg, ...)     errx(ev, msg, __VA_ARGS__)
+#define SKIPX(ev, msg, ...)    errx(ev, msg, __VA_ARGS__)
 #endif
 
 
@@ -40,6 +47,8 @@
        return 0;
 }
 
+extern bool __rpc_control(int, void *);
+
 static void
 onehost(const char *host, const char *transp)
 {
@@ -47,9 +56,16 @@
        struct netbuf   addr;
        struct timeval  tv;
 
+       /*
+        * Magic!
+        */
+       tv.tv_sec = 0;
+       tv.tv_usec = 500000;
+#define CLCR_SET_RPCB_TIMEOUT   2
+       __rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv);
 
        if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL)
-               ERRX(EXIT_FAILURE, "clnt_create (%s)", clnt_spcreateerror(""));
+               SKIPX(EXIT_FAILURE, "clnt_create (%s)", clnt_spcreateerror(""));
 
        tv.tv_sec = 1;
        tv.tv_usec = 0;



Home | Main Index | Thread Index | Old Index