Module Name:    src
Committed By:   christos
Date:           Wed Feb 27 18:39:58 UTC 2013

Modified Files:
        src/tests/lib/libc/rpc: t_rpc.c

Log Message:
skip the tests if rpcbind is not responding.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/rpc/t_rpc.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libc/rpc/t_rpc.c
diff -u src/tests/lib/libc/rpc/t_rpc.c:1.1 src/tests/lib/libc/rpc/t_rpc.c:1.2
--- src/tests/lib/libc/rpc/t_rpc.c:1.1	Tue Feb 26 12:06:55 2013
+++ src/tests/lib/libc/rpc/t_rpc.c	Wed Feb 27 13:39:58 2013
@@ -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 @@ __RCSID("$NetBSD: t_rpc.c,v 1.1 2013/02/
 #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 @@ reply(caddr_t replyp, struct netbuf * ra
 	return 0;
 }
 
+extern bool __rpc_control(int, void *);
+
 static void
 onehost(const char *host, const char *transp)
 {
@@ -47,9 +56,16 @@ onehost(const char *host, const char *tr
 	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;

Reply via email to