[4/6] sunrpc: Remove obsolete tst-getmyaddr and thrsvc xtests

Message ID 20260709174957.670741-5-adhemerval.zanella@linaro.org (mailing list archive)
State New
Headers
Series Move some xtests to make check |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Adhemerval Zanella Netto July 9, 2026, 5:48 p.m. UTC
  These exercise the deprecated Sun RPC interfaces and require network
access.  Remove them along with their xtests entries.
---
 sunrpc/Makefile        |   6 ---
 sunrpc/thrsvc.c        | 109 -----------------------------------------
 sunrpc/tst-getmyaddr.c |  24 ---------
 3 files changed, 139 deletions(-)
 delete mode 100644 sunrpc/thrsvc.c
 delete mode 100644 sunrpc/tst-getmyaddr.c
  

Comments

Sam James July 9, 2026, 5:57 p.m. UTC | #1
Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:

> These exercise the deprecated Sun RPC interfaces and require network
> access.  Remove them along with their xtests entries.

I don't think we should remove tests until the functionality is gone.

> ---
>  sunrpc/Makefile        |   6 ---
>  sunrpc/thrsvc.c        | 109 -----------------------------------------
>  sunrpc/tst-getmyaddr.c |  24 ---------
>  3 files changed, 139 deletions(-)
>  delete mode 100644 sunrpc/thrsvc.c
>  delete mode 100644 sunrpc/tst-getmyaddr.c
>
> diff --git a/sunrpc/Makefile b/sunrpc/Makefile
> index 63c90874581..36babe303d9 100644
> --- a/sunrpc/Makefile
> +++ b/sunrpc/Makefile
> @@ -74,10 +74,7 @@ tests = \
>    tst-xdrmem2
>  # tests
>  
> -xtests := tst-getmyaddr
> -
>  ifeq ($(have-thread-library),yes)
> -xtests += thrsvc
>  tests += tst-udp-garbage tst-svc_register
>  endif
>  
> @@ -104,15 +101,12 @@ CFLAGS-pmap_rmt.c += -fexceptions
>  CFLAGS-clnt_perr.c += -fexceptions
>  CFLAGS-openchild.c += -fexceptions
>  
> -$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-svc_register: \
>    $(common-objpfx)linkobj/libc.so $(shared-thread-library)
>  
> -$(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
> -
>  $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
>  $(objpfx)tst-udp-garbage: \
> diff --git a/sunrpc/thrsvc.c b/sunrpc/thrsvc.c
> deleted file mode 100644
> index 63cfbf9810d..00000000000
> --- a/sunrpc/thrsvc.c
> +++ /dev/null
> @@ -1,109 +0,0 @@
> -#include <pthread.h>
> -#include <stdio.h>
> -#include <string.h>
> -#include <unistd.h>
> -#include <rpc/rpc.h>
> -#include <arpa/inet.h>
> -
> -#define PROGNUM 1234
> -#define VERSNUM 1
> -#define PROCNUM 1
> -#define PROCQUIT 2
> -
> -static int exitcode;
> -
> -struct rpc_arg
> -{
> -  CLIENT *client;
> -  u_long proc;
> -};
> -
> -static void
> -dispatch(struct svc_req *request, SVCXPRT *xprt)
> -{
> -  svc_sendreply(xprt, (xdrproc_t)xdr_void, 0);
> -  if (request->rq_proc == PROCQUIT)
> -    exit (0);
> -}
> -
> -static void
> -test_one_call (struct rpc_arg *a)
> -{
> -  struct timeval tout = { 60, 0 };
> -  enum clnt_stat result;
> -
> -  printf ("test_one_call: ");
> -  result = clnt_call (a->client, a->proc,
> -		      (xdrproc_t) xdr_void, 0,
> -		      (xdrproc_t) xdr_void, 0, tout);
> -  if (result == RPC_SUCCESS)
> -    puts ("success");
> -  else
> -    {
> -      clnt_perrno (result);
> -      putchar ('\n');
> -      exitcode = 1;
> -    }
> -}
> -
> -static void *
> -thread_wrapper (void *arg)
> -{
> -  struct rpc_arg a;
> -
> -  a.client = (CLIENT *)arg;
> -  a.proc = PROCNUM;
> -  test_one_call (&a);
> -  a.client = (CLIENT *)arg;
> -  a.proc = PROCQUIT;
> -  test_one_call (&a);
> -  return 0;
> -}
> -
> -int
> -main (void)
> -{
> -  pthread_t tid;
> -  pid_t pid;
> -  int err;
> -  SVCXPRT *svx;
> -  CLIENT *clnt;
> -  struct sockaddr_in sin;
> -  struct timeval wait = { 5, 0 };
> -  int sock = RPC_ANYSOCK;
> -  struct rpc_arg a;
> -
> -  svx = svcudp_create (RPC_ANYSOCK);
> -  svc_register (svx, PROGNUM, VERSNUM, dispatch, 0);
> -
> -  pid = fork ();
> -  if (pid == -1)
> -    {
> -      perror ("fork");
> -      return 1;
> -    }
> -  if (pid == 0)
> -    svc_run ();
> -
> -  inet_aton ("127.0.0.1", &sin.sin_addr);
> -  sin.sin_port = htons (svx->xp_port);
> -  sin.sin_family = AF_INET;
> -
> -  clnt = clntudp_create (&sin, PROGNUM, VERSNUM, wait, &sock);
> -
> -  a.client = clnt;
> -  a.proc = PROCNUM;
> -
> -  /* Test in this thread */
> -  test_one_call (&a);
> -
> -  /* Test in a child thread */
> -  err = pthread_create (&tid, 0, thread_wrapper, (void *) clnt);
> -  if (err)
> -    fprintf (stderr, "pthread_create: %s\n", strerror (err));
> -  err = pthread_join (tid, 0);
> -  if (err)
> -    fprintf (stderr, "pthread_join: %s\n", strerror (err));
> -
> -  return exitcode;
> -}
> diff --git a/sunrpc/tst-getmyaddr.c b/sunrpc/tst-getmyaddr.c
> deleted file mode 100644
> index 1eaf9b22caf..00000000000
> --- a/sunrpc/tst-getmyaddr.c
> +++ /dev/null
> @@ -1,24 +0,0 @@
> -#include <stdio.h>
> -#include <string.h>
> -#include <arpa/inet.h>
> -#include <netinet/in.h>
> -#include <rpc/clnt.h>
> -
> -
> -static int
> -do_test (void)
> -{
> -  struct sockaddr_in ad;
> -  struct sockaddr_in ad2;
> -  memset (&ad, '\0', sizeof (ad));
> -  memset (&ad2, '\0', sizeof (ad2));
> -
> -  get_myaddress (&ad);
> -
> -  printf ("addr = %s:%d\n", inet_ntoa (ad.sin_addr), ad.sin_port);
> -
> -  return memcmp (&ad, &ad2, sizeof (ad)) == 0;
> -}
> -
> -#define TEST_FUNCTION do_test ()
> -#include "../test-skeleton.c"
  
Adhemerval Zanella Netto July 9, 2026, 6:28 p.m. UTC | #2
On 09/07/26 14:57, Sam James wrote:
> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
> 
>> These exercise the deprecated Sun RPC interfaces and require network
>> access.  Remove them along with their xtests entries.
> 
> I don't think we should remove tests until the functionality is gone.
Right, we might move them to default tests but I think they would require some
adjustments (at least adjust to use libsupport). The tst-getmyaddr also requires a 
non-loopback address (which should be feasible on most environments).

But I think neither tests actually add much, they aim for a deprecated interface
and are quite limited.
  
Florian Weimer July 10, 2026, 9:19 a.m. UTC | #3
* Sam James:

> Adhemerval Zanella <adhemerval.zanella@linaro.org> writes:
>
>> These exercise the deprecated Sun RPC interfaces and require network
>> access.  Remove them along with their xtests entries.
>
> I don't think we should remove tests until the functionality is gone.

Agreed.  Unless this blocks removal of the xtests infrastructure (is
this planned?), this should stay.

Thanks,
Florian
  

Patch

diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 63c90874581..36babe303d9 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -74,10 +74,7 @@  tests = \
   tst-xdrmem2
 # tests
 
-xtests := tst-getmyaddr
-
 ifeq ($(have-thread-library),yes)
-xtests += thrsvc
 tests += tst-udp-garbage tst-svc_register
 endif
 
@@ -104,15 +101,12 @@  CFLAGS-pmap_rmt.c += -fexceptions
 CFLAGS-clnt_perr.c += -fexceptions
 CFLAGS-openchild.c += -fexceptions
 
-$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-svc_register: \
   $(common-objpfx)linkobj/libc.so $(shared-thread-library)
 
-$(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
-
 $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-garbage: \
diff --git a/sunrpc/thrsvc.c b/sunrpc/thrsvc.c
deleted file mode 100644
index 63cfbf9810d..00000000000
--- a/sunrpc/thrsvc.c
+++ /dev/null
@@ -1,109 +0,0 @@ 
-#include <pthread.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <rpc/rpc.h>
-#include <arpa/inet.h>
-
-#define PROGNUM 1234
-#define VERSNUM 1
-#define PROCNUM 1
-#define PROCQUIT 2
-
-static int exitcode;
-
-struct rpc_arg
-{
-  CLIENT *client;
-  u_long proc;
-};
-
-static void
-dispatch(struct svc_req *request, SVCXPRT *xprt)
-{
-  svc_sendreply(xprt, (xdrproc_t)xdr_void, 0);
-  if (request->rq_proc == PROCQUIT)
-    exit (0);
-}
-
-static void
-test_one_call (struct rpc_arg *a)
-{
-  struct timeval tout = { 60, 0 };
-  enum clnt_stat result;
-
-  printf ("test_one_call: ");
-  result = clnt_call (a->client, a->proc,
-		      (xdrproc_t) xdr_void, 0,
-		      (xdrproc_t) xdr_void, 0, tout);
-  if (result == RPC_SUCCESS)
-    puts ("success");
-  else
-    {
-      clnt_perrno (result);
-      putchar ('\n');
-      exitcode = 1;
-    }
-}
-
-static void *
-thread_wrapper (void *arg)
-{
-  struct rpc_arg a;
-
-  a.client = (CLIENT *)arg;
-  a.proc = PROCNUM;
-  test_one_call (&a);
-  a.client = (CLIENT *)arg;
-  a.proc = PROCQUIT;
-  test_one_call (&a);
-  return 0;
-}
-
-int
-main (void)
-{
-  pthread_t tid;
-  pid_t pid;
-  int err;
-  SVCXPRT *svx;
-  CLIENT *clnt;
-  struct sockaddr_in sin;
-  struct timeval wait = { 5, 0 };
-  int sock = RPC_ANYSOCK;
-  struct rpc_arg a;
-
-  svx = svcudp_create (RPC_ANYSOCK);
-  svc_register (svx, PROGNUM, VERSNUM, dispatch, 0);
-
-  pid = fork ();
-  if (pid == -1)
-    {
-      perror ("fork");
-      return 1;
-    }
-  if (pid == 0)
-    svc_run ();
-
-  inet_aton ("127.0.0.1", &sin.sin_addr);
-  sin.sin_port = htons (svx->xp_port);
-  sin.sin_family = AF_INET;
-
-  clnt = clntudp_create (&sin, PROGNUM, VERSNUM, wait, &sock);
-
-  a.client = clnt;
-  a.proc = PROCNUM;
-
-  /* Test in this thread */
-  test_one_call (&a);
-
-  /* Test in a child thread */
-  err = pthread_create (&tid, 0, thread_wrapper, (void *) clnt);
-  if (err)
-    fprintf (stderr, "pthread_create: %s\n", strerror (err));
-  err = pthread_join (tid, 0);
-  if (err)
-    fprintf (stderr, "pthread_join: %s\n", strerror (err));
-
-  return exitcode;
-}
diff --git a/sunrpc/tst-getmyaddr.c b/sunrpc/tst-getmyaddr.c
deleted file mode 100644
index 1eaf9b22caf..00000000000
--- a/sunrpc/tst-getmyaddr.c
+++ /dev/null
@@ -1,24 +0,0 @@ 
-#include <stdio.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <rpc/clnt.h>
-
-
-static int
-do_test (void)
-{
-  struct sockaddr_in ad;
-  struct sockaddr_in ad2;
-  memset (&ad, '\0', sizeof (ad));
-  memset (&ad2, '\0', sizeof (ad2));
-
-  get_myaddress (&ad);
-
-  printf ("addr = %s:%d\n", inet_ntoa (ad.sin_addr), ad.sin_port);
-
-  return memcmp (&ad, &ad2, sizeof (ad)) == 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"