diff options
| author | bluhm <> | 2019-11-19 19:57:04 +0000 |
|---|---|---|
| committer | bluhm <> | 2019-11-19 19:57:04 +0000 |
| commit | 9185f840eda265016178aeb0dcdba964f8f6f3e2 (patch) | |
| tree | da100b3712514c566fe948116f7926ad7f725401 /src/regress/lib/libc/sys/Makefile | |
| parent | 6a6fe688152b422f3d65c970dad56e7d9d28b1ee (diff) | |
| download | openbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.tar.gz openbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.tar.bz2 openbsd-9185f840eda265016178aeb0dcdba964f8f6f3e2.zip | |
Import NetBSD system call regression tests. They were written with
ATF (Automated Testing Framework), so we use a small wrapper to map
it to our bsd.regress.mk framework. Only half of the 80 NetBSD
tests have been taken, the others need more work to adapt. Of them
34 syscall tests pass.
Moritz Buhl ported the tests to OpenBSD.
Diffstat (limited to 'src/regress/lib/libc/sys/Makefile')
| -rw-r--r-- | src/regress/lib/libc/sys/Makefile | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/regress/lib/libc/sys/Makefile b/src/regress/lib/libc/sys/Makefile new file mode 100644 index 0000000000..e8c06d0fb2 --- /dev/null +++ b/src/regress/lib/libc/sys/Makefile | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.1.1.1 2019/11/19 19:57:03 bluhm Exp $ | ||
| 2 | |||
| 3 | # Copyright (c) 2019 Moritz Buhl <openbsd@moritzbuhl.de> | ||
| 4 | # Copyright (c) 2019 Alexander Bluhm <bluhm@openbsd.org> | ||
| 5 | # | ||
| 6 | # Permission to use, copy, modify, and distribute this software for any | ||
| 7 | # purpose with or without fee is hereby granted, provided that the above | ||
| 8 | # copyright notice and this permission notice appear in all copies. | ||
| 9 | # | ||
| 10 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 11 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 12 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 13 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 14 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 15 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 16 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 17 | |||
| 18 | # Each test program in PROGS may define several numbered subtests. | ||
| 19 | # In a first step compile all programs and extract their parameters. | ||
| 20 | # For each PROG define new regression subtests based on the test number. | ||
| 21 | |||
| 22 | .if defined(NUMBERS) | ||
| 23 | REGRESS_TARGETS = ${NUMBERS:S/^/run-${PROG}-/} | ||
| 24 | .else | ||
| 25 | REGRESS_TARGETS = ${PROGS:S/^/run-/} | ||
| 26 | .endif | ||
| 27 | |||
| 28 | PROGS = | ||
| 29 | PROGS += t_access t_bind t_chroot t_clock_gettime t_dup t_fsync | ||
| 30 | PROGS += t_getgroups t_getitimer t_getlogin t_getpid t_getrusage | ||
| 31 | PROGS += t_getsid t_getsockname t_gettimeofday t_kill t_link t_listen | ||
| 32 | PROGS += t_mkdir t_mknod t_msgctl t_msgget t_msgsnd t_msync t_pipe | ||
| 33 | PROGS += t_poll t_revoke t_select t_sendrecv t_setuid t_socketpair | ||
| 34 | PROGS += t_sigaction t_truncate t_umask t_write | ||
| 35 | |||
| 36 | # failing tests | ||
| 37 | .if 0 | ||
| 38 | PROGS += t_mkfifo | ||
| 39 | PROGS += t_mlock | ||
| 40 | PROGS += t_mmap | ||
| 41 | PROGS += t_msgrcv | ||
| 42 | PROGS += t_pipe2 | ||
| 43 | PROGS += t_ptrace | ||
| 44 | PROGS += t_stat | ||
| 45 | PROGS += t_syscall | ||
| 46 | PROGS += t_unlink | ||
| 47 | .endif | ||
| 48 | |||
| 49 | . for p in ${PROGS} | ||
| 50 | SRCS_$p = $p.c atf-c.c | ||
| 51 | . endfor | ||
| 52 | |||
| 53 | LDADD_t_getpid = -lpthread | ||
| 54 | |||
| 55 | run-t_truncate: setup-t_truncate | ||
| 56 | setup-t_truncate: | ||
| 57 | ${SUDO} touch truncate_test.root_owned | ||
| 58 | ${SUDO} chown root:wheel truncate_test.root_owned | ||
| 59 | |||
| 60 | run-t_chroot: cleanup-t_chroot | ||
| 61 | cleanup-t_chroot: | ||
| 62 | ${SUDO} rm -rf dir | ||
| 63 | |||
| 64 | CLEANFILES = access dummy mmap truncate_test.root_owned | ||
| 65 | |||
| 66 | .for p in ${PROGS} | ||
| 67 | run-$p: $p | ||
| 68 | @echo "\n======== $@ ========" | ||
| 69 | ntests="`./$p -n`" && \ | ||
| 70 | echo "1..$$ntests" && \ | ||
| 71 | tnumbers="`jot -ns' ' - 1 $$ntests`" && \ | ||
| 72 | ${.MAKE} -C ${.CURDIR} PROG=$p NUMBERS="$$tnumbers" regress | ||
| 73 | .endfor | ||
| 74 | |||
| 75 | .if defined(NUMBERS) | ||
| 76 | CUR_USER != id -g | ||
| 77 | |||
| 78 | . for n in ${NUMBERS} | ||
| 79 | DESCR_$n != eval `./${PROG} -i $n` && echo $$DESCR | ||
| 80 | REQ_USER_$n != eval `./${PROG} -i $n` && echo $$REQ_USER | ||
| 81 | |||
| 82 | . if ${REQ_USER_$n} == "root" | ||
| 83 | REGRESS_ROOT_TARGETS += run-${PROG}-$n | ||
| 84 | . endif | ||
| 85 | |||
| 86 | run-${PROG}-$n: | ||
| 87 | @echo "$n ${DESCR_$n}" | ||
| 88 | . if ${REQ_USER_$n} == "root" | ||
| 89 | ${SUDO} ./${PROG} -r $n | ||
| 90 | . elif ${REQ_USER_$n} == "unprivileged" && ${CUR_USER} == 0 | ||
| 91 | ${SUDO} su ${BUILDUSER} -c exec ./${PROG} -r $n | ||
| 92 | . elif ${REQ_USER_$n} == "unprivileged" || ${REQ_USER_$n} == "" | ||
| 93 | ./${PROG} -r $n | ||
| 94 | . else | ||
| 95 | # bad REQ_USER: ${REQ_USER_$n} | ||
| 96 | false | ||
| 97 | . endif | ||
| 98 | |||
| 99 | . endfor | ||
| 100 | .endif | ||
| 101 | |||
| 102 | .include <bsd.regress.mk> | ||
| 103 | |||
| 104 | clean: cleanup-t_chroot | ||
