Source-Changes-HG archive

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

[src/trunk]: src/regress/lib/libc More tests have been atf-ified



details:   https://anonhg.NetBSD.org/src/rev/ecd32f1de578
branches:  trunk
changeset: 760228:ecd32f1de578
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Fri Dec 31 14:37:37 2010 +0000

description:
More tests have been atf-ified

diffstat:

 regress/lib/libc/Makefile                         |    7 +-
 regress/lib/libc/clone/Makefile                   |   17 -
 regress/lib/libc/clone/clonetest.c                |  194 -------------------
 regress/lib/libc/context/Makefile                 |   14 -
 regress/lib/libc/context/context.c                |   53 -----
 regress/lib/libc/hsearch/Makefile                 |   10 -
 regress/lib/libc/hsearch/hsearchtest.c            |  128 -------------
 regress/lib/libc/inet/Makefile                    |    5 -
 regress/lib/libc/inet/Makefile.inc                |    4 -
 regress/lib/libc/inet/inet_network/Makefile       |   10 -
 regress/lib/libc/inet/inet_network/inet_network.c |  215 ----------------------
 regress/lib/libc/inet/inet_network/inwtest        |   58 -----
 regress/lib/libc/pty/Makefile                     |    5 -
 regress/lib/libc/pty/Makefile.inc                 |    4 -
 regress/lib/libc/pty/ptm/Makefile                 |   10 -
 regress/lib/libc/pty/ptm/ptm.c                    |  105 ----------
 regress/lib/libc/pty/ptmx/Makefile                |   10 -
 regress/lib/libc/pty/ptmx/ptmx.c                  |  105 ----------
 regress/lib/libc/strptime/Makefile                |   17 -
 regress/lib/libc/strptime/strptimetest.c          |  199 --------------------
 20 files changed, 3 insertions(+), 1167 deletions(-)

diffs (truncated from 1254 to 300 lines):

diff -r 7f0e7f4630fc -r ecd32f1de578 regress/lib/libc/Makefile
--- a/regress/lib/libc/Makefile Fri Dec 31 14:36:10 2010 +0000
+++ b/regress/lib/libc/Makefile Fri Dec 31 14:37:37 2010 +0000
@@ -1,8 +1,7 @@
-#      $NetBSD: Makefile,v 1.67 2010/12/31 04:10:41 pgoyette Exp $
+#      $NetBSD: Makefile,v 1.68 2010/12/31 14:37:37 pgoyette Exp $
 
-SUBDIR+= atexit citrus clone context db \
-       divrem getaddrinfo hsearch inet int_fmtio locale md5sha \
-       nsdispatch pty regex rpc servent stdlib strptime sys time
+SUBDIR+= atexit citrus db divrem getaddrinfo int_fmtio locale md5sha \
+       nsdispatch regex rpc servent stdlib sys time
 
 .include <bsd.own.mk>
 .include <bsd.sys.mk>
diff -r 7f0e7f4630fc -r ecd32f1de578 regress/lib/libc/clone/Makefile
--- a/regress/lib/libc/clone/Makefile   Fri Dec 31 14:36:10 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-#      $NetBSD: Makefile,v 1.4 2002/09/18 05:41:37 lukem Exp $
-
-NOMAN=         # defined
-
-PROG=          clonetest
-COPTS+=                -g
-WARNS?=                1
-
-regress: ${PROG}
-       @if ./clonetest; then \
-               echo PASSED; \
-       else \
-               echo FAILED; \
-               exit 1; \
-       fi
-
-.include <bsd.prog.mk>
diff -r 7f0e7f4630fc -r ecd32f1de578 regress/lib/libc/clone/clonetest.c
--- a/regress/lib/libc/clone/clonetest.c        Fri Dec 31 14:36:10 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,194 +0,0 @@
-/*     $NetBSD: clonetest.c,v 1.10 2005/12/24 21:22:46 perry Exp $     */
-
-/*
- * This file placed in the public domain.
- * Jason R. Thorpe, July 16, 2001.
- */
-
-#include <sys/types.h>
-#include <sys/mman.h>
-#include <sys/wait.h>
-#include <sys/resource.h>
-#include <err.h>
-#include <sched.h>
-#include <signal.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <errno.h>
-
-static int     newclone(void *);
-static int     stackdir(void *);
-static void    test1(void);
-static void    test2(void);
-static void    test3(void);
-
-int    main(int, char *[]);
-
-
-#define        STACKSIZE       (8 * 1024)
-
-#define        FROBVAL         41973
-#define        CHILDEXIT       0xa5
-
-int
-main(int argc, char *argv[])
-{
-       test1();
-       test2();
-       test3();
-       return 0;
-}
-
-static void
-test1()
-{
-       sigset_t mask;
-       void *allocstack, *stack;
-       pid_t pid;
-       volatile long frobme[2];
-       int stat;
-
-       allocstack = mmap(NULL, STACKSIZE, PROT_READ|PROT_WRITE|PROT_EXEC,
-           MAP_PRIVATE|MAP_ANON, -1, (off_t) 0);
-
-       if (allocstack == MAP_FAILED)
-               err(1, "mmap stack");
-
-       stack = (caddr_t) allocstack + STACKSIZE * stackdir(&stat);
-
-       printf("parent: stack = %p, frobme = %p\n", stack, frobme);
-       fflush(stdout);
-
-       frobme[0] = (long)getpid();
-       frobme[1] = (long)stack;
-
-       sigemptyset(&mask);
-       sigaddset(&mask, SIGUSR1);
-
-       if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
-               err(1, "sigprocmask (SIGUSR1)");
-
-       switch (pid = __clone(newclone, stack,
-           CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGUSR1,
-           (void *)frobme)) {
-       case 0:
-               errx(1, "clone returned 0");
-               /*NOTREACHED*/
-       case -1:
-               err(1, "clone");
-               /*NOTREACHED*/
-       default:
-               while (waitpid(pid, &stat, __WCLONE) != pid)
-                       continue;
-       }
-
-       if (WIFEXITED(stat) == 0)
-               errx(1, "child didn't exit");
-
-       printf("parent: childexit = 0x%x, frobme = %ld\n",
-           WEXITSTATUS(stat), frobme[1]);
-
-       if (WEXITSTATUS(stat) != CHILDEXIT || frobme[1] != FROBVAL)
-               exit(1);
-
-       if (munmap(allocstack, STACKSIZE) == -1)
-               err(1, "munmap stack");
-
-       printf("test1: PASS\n");
-}
-
-static void
-test2()
-{
-       void *allocstack, *stack;
-       int rv, stat;
-
-       allocstack = mmap(NULL, STACKSIZE, PROT_READ|PROT_WRITE|PROT_EXEC,
-           MAP_PRIVATE|MAP_ANON, -1, (off_t) 0);
-
-       if (allocstack == MAP_FAILED)
-               err(1, "mmap stack");
-
-       stack = (caddr_t) allocstack + STACKSIZE * stackdir(&stat);
-
-       errno = 0;
-       rv = __clone(0, stack,
-           CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD, NULL);
-       if (rv != -1 || errno != EINVAL)
-               errx(1, "clone did not return EINVAL on NULL function pointer: "
-                    "rv %d errno %d", rv, errno);
-       rv = __clone(newclone, NULL,
-           CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD,
-           NULL);
-       if (rv != -1 || errno != EINVAL)
-               errx(1, "clone did not return EINVAL on NULL stack pointer: "
-                    "rv %d errno %d", rv, errno);
-
-       if (munmap(allocstack, STACKSIZE) == -1)
-               err(1, "munmap stack");
-
-       printf("test2: PASS\n");
-}
-
-static void
-test3()
-{
-       struct rlimit rl;
-
-       /* Can't enforce resource limit on root */
-       if (geteuid() == 0)
-               return;
-
-       if (getrlimit(RLIMIT_NPROC, &rl) == -1)
-               err(1, "getrlimit");
-       rl.rlim_cur = 0;
-       rl.rlim_max = 0;
-       if (setrlimit(RLIMIT_NPROC, &rl) == -1)
-               err(1, "setrlimit");
-       if (__clone(newclone, malloc(10240),
-           CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|SIGCHLD,
-           (void *)&rl) != -1 || errno != EAGAIN)
-               errx(1, "clone did not return EAGAIN running out of procs");
-
-       printf("test3: PASS\n");
-}
-
-static int
-newclone(void *arg)
-{
-       long *frobp = arg, diff;
-
-       printf("child: stack ~= %p, frobme = %p\n", &frobp, frobp);
-       fflush(stdout);
-
-       if (frobp[0] != getppid())
-               errx(1, "argument does not contain parent's pid");
-
-       if (frobp[0] == getpid())
-               errx(1, "called in parent's pid");
-
-       if (frobp[1] > (long)&frobp)
-               diff = frobp[1] - (long)&frobp;
-       else
-               diff = (long)&frobp - frobp[1];
-
-       if (diff > 1024)
-               errx(1, "called with bad stack");
-
-       frobp[1] = FROBVAL;
-
-       return (CHILDEXIT);
-}
-
-/*
- * return 1 if the stack grows down, 0 if it grows up.
- */
-static int
-stackdir(void *p)
-{
-       int val;
-       void *q = &val;
-
-       return p < q ? 0 : 1;
-}
diff -r 7f0e7f4630fc -r ecd32f1de578 regress/lib/libc/context/Makefile
--- a/regress/lib/libc/context/Makefile Fri Dec 31 14:36:10 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-#      $NetBSD: Makefile,v 1.1 2004/02/28 16:55:05 drochner Exp $
-
-NOMAN= # defined
-
-PROG=  context
-
-regress: ${PROG}
-       @if ./${PROG}; then \
-               echo "PASSED"; \
-       else \
-               echo "FAILED"; \
-       fi
-
-.include <bsd.prog.mk>
diff -r 7f0e7f4630fc -r ecd32f1de578 regress/lib/libc/context/context.c
--- a/regress/lib/libc/context/context.c        Fri Dec 31 14:36:10 2010 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/* $NetBSD: context.c,v 1.3 2004/07/19 06:36:27 chs Exp $ */
-
-#include <malloc.h>
-#include <ucontext.h>
-#include <stdarg.h>
-#include <err.h>
-
-#define STACKSZ (10*1024)
-#define DEPTH 3
-
-int calls;
-
-void
-run(int n, ...)
-{
-       va_list va;
-       int i, ia;
-
-       if (n != DEPTH - calls - 1)
-               exit (1);
-
-       va_start(va, n);
-       for (i = 0; i < 9; i++) {
-               ia = va_arg(va, int);
-               if (ia != i)
-                       errx(2, "arg[%d]=%d", i, ia);
-       }
-       va_end(va);
-       calls++;
-}
-
-main()
-{
-       ucontext_t uc[DEPTH];
-       int i, res;
-
-       for (i = 0; i < DEPTH; i++) {
-               res = getcontext(&uc[i]);
-               if (res)
-                       err(1, "getcontext");
-               uc[i].uc_stack.ss_sp = malloc(STACKSZ);
-               uc[i].uc_stack.ss_size = STACKSZ;
-               if (i > 0)
-                       uc[i].uc_link = &uc[i - 1];



Home | Main Index | Thread Index | Old Index