git: 90b5fc95832d - main - lib/libc/tests/rpc: Correctly set timeout

Alex Richardson arichardson at FreeBSD.org
Sat Feb 13 14:12:45 UTC 2021


The branch main has been updated by arichardson:

URL: https://cgit.FreeBSD.org/src/commit/?id=90b5fc95832da64a5f56295e687379732c33718f

commit 90b5fc95832da64a5f56295e687379732c33718f
Author:     Alex Richardson <arichardson at FreeBSD.org>
AuthorDate: 2021-02-13 13:52:59 +0000
Commit:     Alex Richardson <arichardson at FreeBSD.org>
CommitDate: 2021-02-13 13:53:01 +0000

    lib/libc/tests/rpc: Correctly set timeout
    
    The rpc_control() API does not accept the CLCR_SET_RPCB_TIMEOUT command,
    it only accepts RPC_SVC_CONNMAXREC_GET/RPC_SVC_CONNMAXREC_SET, so it was
    not doing anything.
    Instead of incorrectly calling this API, use clnt_create_timed() instead.
    
    I noticed this because the test was timing out after 120s in the CheriBSD CI.
    
    Reviewed By:    ngie
    Differential Revision: https://reviews.freebsd.org/D28478
---
 contrib/netbsd-tests/lib/libc/rpc/t_rpc.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
index 59bcd5590764..3000f6aec98b 100644
--- a/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
+++ b/contrib/netbsd-tests/lib/libc/rpc/t_rpc.c
@@ -72,11 +72,21 @@ onehost(const char *host, const char *transp)
 	 */
 	tv.tv_sec = 0;
 	tv.tv_usec = 500000;
+#ifdef __FreeBSD__
+	/*
+	 * FreeBSD does not allow setting the timeout using __rpc_control,
+	 * but does have clnt_create_timed() that allows passing a timeout.
+	 */
+	if ((clnt = clnt_create_timed(host, RPCBPROG, RPCBVERS, transp,
+	     &tv)) == NULL)
+		SKIPX(, "clnt_create (%s)", clnt_spcreateerror(""));
+#else
 #define CLCR_SET_RPCB_TIMEOUT   2
 	__rpc_control(CLCR_SET_RPCB_TIMEOUT, &tv);
 
 	if ((clnt = clnt_create(host, RPCBPROG, RPCBVERS, transp)) == NULL)
 		SKIPX(, "clnt_create (%s)", clnt_spcreateerror(""));
+#endif
 
 	tv.tv_sec = 1;
 	tv.tv_usec = 0;


More information about the dev-commits-src-main mailing list