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

Sam James <[email protected]>
Newsgroups gmane.comp.lib.glibc.alpha
Organization Gentoo
Message-ID <[email protected]>
Adhemerval Zanella <[email protected]> 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"
signature.asc (application/pgp-signature, 418 B)
-----BEGIN PGP SIGNATURE-----

iQEBBAEWCgCpFiEEJaa7iN2bdkxrVUHCc4QJ9SDfkZAFAmpP4QcbFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25z
Lm9wZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXQyNUE2QkI4OEREOUI3NjRDNkI1NTQx
QzI3Mzg0MDlGNTIwREY5MTkwDxxzYW1AZ2VudG9vLm9yZwAKCRBzhAn1IN+RkK5e
AQCKVOYPgYy4VtN0Mpa59DIa8O+YSeKT/TJ/VObK8LWDvgEAwYTawBru/T/fNny+
krpsviCtj9WxphCETGVkKd8reQU=
=Ut7l
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.