Source-Changes-HG archive

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

[src/trunk]: src/tests/lib/libc Move the servent and protoent tests to src/te...



details:   https://anonhg.NetBSD.org/src/rev/15d6f4057b22
branches:  trunk
changeset: 760747:15d6f4057b22
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Wed Jan 12 17:32:27 2011 +0000

description:
Move the servent and protoent tests to src/tests/lib/libc/net/ (where
they should have gone initially).

diffstat:

 tests/lib/libc/Makefile          |    6 +-
 tests/lib/libc/h_protoent.c      |  100 -------------------------------------
 tests/lib/libc/h_servent.c       |  103 ---------------------------------------
 tests/lib/libc/net/Makefile      |   12 ++++-
 tests/lib/libc/net/h_protoent.c  |  100 +++++++++++++++++++++++++++++++++++++
 tests/lib/libc/net/h_servent.c   |  103 +++++++++++++++++++++++++++++++++++++++
 tests/lib/libc/net/t_protoent.sh |   92 ++++++++++++++++++++++++++++++++++
 tests/lib/libc/net/t_servent.sh  |   93 +++++++++++++++++++++++++++++++++++
 tests/lib/libc/t_protoent.sh     |   92 ----------------------------------
 tests/lib/libc/t_servent.sh      |   93 -----------------------------------
 10 files changed, 400 insertions(+), 394 deletions(-)

diffs (truncated from 858 to 300 lines):

diff -r d8994f18df4c -r 15d6f4057b22 tests/lib/libc/Makefile
--- a/tests/lib/libc/Makefile   Wed Jan 12 17:20:54 2011 +0000
+++ b/tests/lib/libc/Makefile   Wed Jan 12 17:32:27 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.29 2011/01/12 02:58:40 pgoyette Exp $
+# $NetBSD: Makefile,v 1.30 2011/01/12 17:32:27 pgoyette Exp $
 
 .include <bsd.own.mk>
 .include <bsd.sys.mk>
@@ -26,16 +26,12 @@
 
 TESTS_SH+=     t_atexit
 TESTS_SH+=     t_nsdispatch
-TESTS_SH+=     t_protoent
-TESTS_SH+=     t_servent
 
 BINDIR=                ${TESTSDIR}
 MKMAN=         no
 
 PROGS+=                h_atexit
 PROGS+=                h_nsd_recurse
-PROGS+=                h_protoent
-PROGS+=                h_servent
 
 LDADD.h_nsd_recurse+=  -lpthread
 LDADD.t_mktime+=       -lpthread
diff -r d8994f18df4c -r 15d6f4057b22 tests/lib/libc/h_protoent.c
--- a/tests/lib/libc/h_protoent.c       Wed Jan 12 17:20:54 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/* $NetBSD: h_protoent.c,v 1.1 2011/01/02 22:03:25 pgoyette Exp $ */
-
-/*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by 
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <netdb.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <sys/types.h>
-#include <stdio.h>
-
-static void
-pserv(const struct protoent *prp)
-{
-       char **pp;
-
-       printf("name=%s, proto=%d, aliases=",
-           prp->p_name, prp->p_proto);
-       for (pp = prp->p_aliases; *pp; pp++)
-               printf("%s ", *pp);
-       printf("\n");
-}
-
-static void
-usage(void)
-{
-       (void)fprintf(stderr, "Usage: %s\n"
-           "\t%s -p <proto>\n"
-           "\t%s -n <name>\n", getprogname(), getprogname(),
-           getprogname());
-       exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
-       struct protoent *prp;
-       const char *proto = NULL, *name = NULL;
-       int c;
-
-       while ((c = getopt(argc, argv, "p:n:")) != -1) {
-               switch (c) {
-               case 'n':
-                       name = optarg;
-                       break;
-               case 'p':
-                       proto = optarg;
-                       break;
-               default:
-                       usage();
-               }
-       }
-
-       if (proto && name)
-               usage();
-       if (proto) {
-               if ((prp = getprotobynumber(atoi(proto))) != NULL)
-                       pserv(prp);
-               return 0;
-       }
-       if (name) {
-               if ((prp = getprotobyname(name)) != NULL)
-                       pserv(prp);
-               return 0;
-       }
-
-       setprotoent(0);
-       while ((prp = getprotoent()) != NULL)
-               pserv(prp);
-       endprotoent();
-       return 0;
-}
diff -r d8994f18df4c -r 15d6f4057b22 tests/lib/libc/h_servent.c
--- a/tests/lib/libc/h_servent.c        Wed Jan 12 17:20:54 2011 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/* $NetBSD: h_servent.c,v 1.1 2011/01/02 22:03:25 pgoyette Exp $ */
-
-/*-
- * Copyright (c) 2011 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by 
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
- * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
- * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <netdb.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <netinet/in.h>
-#include <sys/types.h>
-#include <stdio.h>
-
-static void
-pserv(const struct servent *svp)
-{
-       char **pp;
-
-       printf("name=%s, port=%d, proto=%s, aliases=",
-           svp->s_name, ntohs((uint16_t)svp->s_port), svp->s_proto);
-       for (pp = svp->s_aliases; *pp; pp++)
-               printf("%s ", *pp);
-       printf("\n");
-}
-
-static void
-usage(void)
-{
-       (void)fprintf(stderr, "Usage: %s\n"
-           "\t%s -p <port> [-P <proto>]\n"
-           "\t%s -n <name> [-P <proto>]\n", getprogname(), getprogname(),
-           getprogname());
-       exit(1);
-}
-
-int
-main(int argc, char *argv[])
-{
-       struct servent *svp;
-       const char *port = NULL, *proto = NULL, *name = NULL;
-       int c;
-
-       while ((c = getopt(argc, argv, "p:n:P:")) != -1) {
-               switch (c) {
-               case 'n':
-                       name = optarg;
-                       break;
-               case 'p':
-                       port = optarg;
-                       break;
-               case 'P':
-                       proto = optarg;
-                       break;
-               default:
-                       usage();
-               }
-       }
-
-       if (port && name)
-               usage();
-       if (port) {
-               if ((svp = getservbyport(htons(atoi(port)), proto)) != NULL)
-                       pserv(svp);
-               return 0;
-       }
-       if (name) {
-               if ((svp = getservbyname(name, proto)) != NULL)
-                       pserv(svp);
-               return 0;
-       }
-
-       setservent(0);
-       while ((svp = getservent()) != NULL)
-               pserv(svp);
-       endservent();
-       return 0;
-}
diff -r d8994f18df4c -r 15d6f4057b22 tests/lib/libc/net/Makefile
--- a/tests/lib/libc/net/Makefile       Wed Jan 12 17:20:54 2011 +0000
+++ b/tests/lib/libc/net/Makefile       Wed Jan 12 17:32:27 2011 +0000
@@ -1,9 +1,19 @@
-# $NetBSD: Makefile,v 1.1 2011/01/12 02:58:40 pgoyette Exp $
+# $NetBSD: Makefile,v 1.2 2011/01/12 17:32:27 pgoyette Exp $
 
 .include <bsd.own.mk>
 
+MKMAN= no
+
 TESTS_SUBDIRS+=        getaddrinfo
 
 TESTSDIR=      ${TESTSBASE}/lib/libc/net
 
+TESTS_SH+=     t_protoent
+TESTS_SH+=     t_servent
+
+BINDIR=                ${TESTSDIR}
+
+PROGS+=                h_protoent
+PROGS+=                h_servent
+
 .include <bsd.test.mk>
diff -r d8994f18df4c -r 15d6f4057b22 tests/lib/libc/net/h_protoent.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lib/libc/net/h_protoent.c   Wed Jan 12 17:32:27 2011 +0000
@@ -0,0 +1,100 @@
+/* $NetBSD: h_protoent.c,v 1.1 2011/01/12 17:32:27 pgoyette Exp $ */
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <netdb.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <unistd.h>



Home | Main Index | Thread Index | Old Index