diff options
163 files changed, 595 insertions, 473 deletions
@@ -112,7 +112,7 @@ .else TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ - check check-old check-old-dirs check-old-files check-old-libs \ + check-old check-old-dirs check-old-files check-old-libs \ checkdpadd clean cleandepend cleandir cleanworld \ delete-old delete-old-dirs delete-old-files delete-old-libs \ depend distribute distributekernel distributekernel.debug \ @@ -121,7 +121,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \ installkernel.debug packagekernel packageworld \ reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries lint maninstall \ - obj objlink rerelease showconfig tags toolchain update \ + obj objlink regress rerelease showconfig tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _cross-tools _includes _libraries _depend \ build32 builddtb distribute32 install32 xdev xdev-build xdev-install \ diff --git a/etc/mtree/BSD.tests.dist b/etc/mtree/BSD.tests.dist index 9ec59be..ea10412 100644 --- a/etc/mtree/BSD.tests.dist +++ b/etc/mtree/BSD.tests.dist @@ -340,18 +340,6 @@ .. devd .. - geom - core - ConfCmp - .. - Data - .. - MdLoad - .. - Ref - .. - .. - .. growfs .. ifconfig diff --git a/sbin/geom/Makefile b/sbin/geom/Makefile index 070e3bc..19a5636 100644 --- a/sbin/geom/Makefile +++ b/sbin/geom/Makefile @@ -20,14 +20,8 @@ LIBADD= geom util .else -.include <src.opts.mk> - SUBDIR= core class -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif - .include <bsd.subdir.mk> .endif diff --git a/sbin/geom/class/Makefile b/sbin/geom/class/Makefile index 8ea22ff..a7ed1b9 100644 --- a/sbin/geom/class/Makefile +++ b/sbin/geom/class/Makefile @@ -21,8 +21,4 @@ SUBDIR+=shsec SUBDIR+=stripe SUBDIR+=virstor -.if ${MK_TESTS} != "no" -SUBDIR+= tests -.endif - .include <bsd.subdir.mk> diff --git a/sbin/geom/core/tests/ConfCmp/Makefile b/sbin/geom/core/tests/ConfCmp/Makefile deleted file mode 100644 index ffd814e..0000000 --- a/sbin/geom/core/tests/ConfCmp/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# $FreeBSD$ - -BINDIR= ${TESTSBASE}/sbin/geom/core/ConfCmp - -PROG= ConfCmp -SRCS+= ConfCmp.c -SRCS+= subr_sbuf.c - -.PATH: ${SRCTOP}/sys/kern - -# Uncomment for ElectricFence -#LDADD+= -lefence -L/usr/local/lib - -DPADD+= ${LIBBSDXML} -LDADD+= -lbsdxml - -LDFLAGS+= -static - -MAN= -CLEANFILES+= _* - -# XXX: this should be in a test script -check: .PHONY -check: ${PROG} - cd ${.CURDIR} && env PATH="$$PATH:${.OBJDIR}" ${MAKE} _check - -_check: .PHONY -_check: ${PROG} - rm -f _* *.core - cd ${.CURDIR}; ${PROG} a1.conf a1.conf - cd ${.CURDIR}; ${PROG} a1.conf a1a.conf - cd ${.CURDIR}; if ${PROG} a1.conf a1b.conf > /dev/null 2>&1 ; then exit 1 ; fi - cd ${.CURDIR}; if ${PROG} a1.conf a1c.conf > /dev/null 2>&1 ; then exit 1 ; fi - cd ${.CURDIR}; if ${PROG} a1.conf a1d.conf > /dev/null 2>&1 ; then exit 1 ; fi - cd ${.CURDIR}; ${PROG} a2.conf a2.conf - cd ${.CURDIR}; ${PROG} a2.conf a2a.conf - cd ${.CURDIR}; if ${PROG} a2.conf a2b.conf > /dev/null 2>&1 ; then exit 1 ; fi - cd ${.CURDIR}; if ${PROG} a2.conf a2c.conf > /dev/null 2>&1 ; then exit 1 ; fi - cd ${.CURDIR}; if ${PROG} a2.conf a2d.conf > /dev/null 2>&1 ; then exit 1 ; fi - -WARNS?= 5 - -.include <bsd.prog.mk> diff --git a/sbin/geom/core/tests/Data/Makefile b/sbin/geom/core/tests/Data/Makefile deleted file mode 100644 index 33d7aa6..0000000 --- a/sbin/geom/core/tests/Data/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ - -FILES+= disk.alpha.da0.xml -FILES+= disk.alpha2.da0.xml -FILES+= disk.apple.xml -FILES+= disk.beast.da0.xml -FILES+= disk.critter.ad0.xml -FILES+= disk.empty.flp.xml -FILES+= disk.far.ad0.xml -FILES+= disk.flat.da1.xml -FILES+= disk.kern.flp.xml -FILES+= disk.msdos.ext.xml -FILES+= disk.msdos.flp.xml -FILES+= disk.pc98.wdc0.xml -FILES+= disk.sun.da0.xml -FILES+= disk.sun.da1.xml -FILES+= disk.typo.ad0.xml - -FILESDIR= ${TESTSBASE}/sbin/geom/core/Data - -.include <bsd.prog.mk> diff --git a/sbin/geom/core/tests/Makefile b/sbin/geom/core/tests/Makefile deleted file mode 100644 index eaaa997..0000000 --- a/sbin/geom/core/tests/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $FreeBSD$ - -TESTSDIR= ${TESTSBASE}/sbin/geom/core - -TAP_TESTS_SH+= run_test - -SUBDIR+= ConfCmp -SUBDIR+= Data -SUBDIR+= MdLoad -SUBDIR+= Ref - -.include <bsd.test.mk> diff --git a/sbin/geom/core/tests/MdLoad/Makefile b/sbin/geom/core/tests/MdLoad/Makefile deleted file mode 100644 index 27cf94b..0000000 --- a/sbin/geom/core/tests/MdLoad/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ - -BINDIR= ${TESTSBASE}/sbin/geom/core/MdLoad - -PROG= MdLoad - -DPADD= ${LIBSBUF} ${LIBBSDXML} -LDADD= -lsbuf -lbsdxml - -MAN= - -WARNS?= 4 - -check: .PHONY -check: ${PROG} - ./${PROG} md34 ../Data/disk.critter.ad0.xml - -.include <bsd.prog.mk> diff --git a/sbin/geom/core/tests/Ref/Makefile b/sbin/geom/core/tests/Ref/Makefile deleted file mode 100644 index 582ea33..0000000 --- a/sbin/geom/core/tests/Ref/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $FreeBSD$ - -FILES+= disk.alpha.da0.xml -FILES+= disk.alpha2.da0.xml -FILES+= disk.apple.xml -FILES+= disk.beast.da0.xml -FILES+= disk.critter.ad0.xml -FILES+= disk.empty.flp.xml -FILES+= disk.far.ad0.xml -FILES+= disk.flat.da1.xml -FILES+= disk.kern.flp.xml -FILES+= disk.msdos.ext.xml -FILES+= disk.msdos.flp.xml -FILES+= disk.pc98.wdc0.xml -FILES+= disk.sun.da0.xml -FILES+= disk.sun.da1.xml -FILES+= disk.typo.ad0.xml - -FILESDIR= ${TESTSBASE}/sbin/geom/core/Ref - -.include <bsd.prog.mk> diff --git a/sbin/geom/core/tests/Ref/disk.alpha.da0.xml b/sbin/geom/core/tests/Ref/disk.alpha.da0.xml deleted file mode 100644 index d2fcacb..0000000 --- a/sbin/geom/core/tests/Ref/disk.alpha.da0.xml +++ /dev/null @@ -1,6 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5120 10 0 0 -/dev/md34a 512 251658240 491520 0 0 -/dev/md34b 512 1086291968 2121664 0 0 -/dev/md34e 512 20971520 40960 0 0 -/dev/md34f 512 16951073792 33107566 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.alpha2.da0.xml b/sbin/geom/core/tests/Ref/disk.alpha2.da0.xml deleted file mode 100644 index 0323eee..0000000 --- a/sbin/geom/core/tests/Ref/disk.alpha2.da0.xml +++ /dev/null @@ -1,4 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5120 10 0 0 -/dev/md34a 512 24675840 48195 0 0 -/dev/md34b 512 4178442240 8161020 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.apple.xml b/sbin/geom/core/tests/Ref/disk.apple.xml deleted file mode 100644 index bec8403..0000000 --- a/sbin/geom/core/tests/Ref/disk.apple.xml +++ /dev/null @@ -1,5 +0,0 @@ -$FreeBSD$ -/dev/md34 512 366530560 715880 0 0 -/dev/md34s1 512 366481408 715784 0 0 -/dev/md34s2 512 32256 63 0 0 -/dev/md34s3 512 16384 32 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.beast.da0.xml b/sbin/geom/core/tests/Ref/disk.beast.da0.xml deleted file mode 100644 index a6c922c..0000000 --- a/sbin/geom/core/tests/Ref/disk.beast.da0.xml +++ /dev/null @@ -1,4 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5120 10 0 0 -/dev/md34a 512 4064280576 7938048 0 0 -/dev/md34b 512 270925824 529152 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.critter.ad0.xml b/sbin/geom/core/tests/Ref/disk.critter.ad0.xml deleted file mode 100644 index 7d83981..0000000 --- a/sbin/geom/core/tests/Ref/disk.critter.ad0.xml +++ /dev/null @@ -1,10 +0,0 @@ -$FreeBSD$ -/dev/md34 512 2671841280 5218440 0 0 -/dev/md34s1 512 20003848704 39070017 0 0 -/dev/md34s1a 512 1073741824 2097152 0 0 -/dev/md34s1b 512 1073741824 2097152 0 0 -/dev/md34s1d 512 4447175168 8685889 0 0 -/dev/md34s1e 512 524288000 1024000 0 0 -/dev/md34s1f 512 4294967296 8388608 0 0 -/dev/md34s1g 512 3221225472 6291456 0 0 -/dev/md34s1h 512 5368709120 10485760 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.empty.flp.xml b/sbin/geom/core/tests/Ref/disk.empty.flp.xml deleted file mode 100644 index d0a1b49..0000000 --- a/sbin/geom/core/tests/Ref/disk.empty.flp.xml +++ /dev/null @@ -1,2 +0,0 @@ -$FreeBSD$ -/dev/md34 512 1474560 2880 0 0 80 2 18 diff --git a/sbin/geom/core/tests/Ref/disk.far.ad0.xml b/sbin/geom/core/tests/Ref/disk.far.ad0.xml deleted file mode 100644 index c929d48..0000000 --- a/sbin/geom/core/tests/Ref/disk.far.ad0.xml +++ /dev/null @@ -1,4 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5632 11 0 0 -/dev/md34s1 512 296821760 579730 0 0 -/dev/md34s2 512 4564740096 8915508 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.flat.da1.xml b/sbin/geom/core/tests/Ref/disk.flat.da1.xml deleted file mode 100644 index 4a02fec..0000000 --- a/sbin/geom/core/tests/Ref/disk.flat.da1.xml +++ /dev/null @@ -1,10 +0,0 @@ -$FreeBSD$ -/dev/md34 512 37888 74 0 0 -/dev/md34a 512 37748736 73728 0 0 -/dev/md34b 512 268435456 524288 0 0 -/dev/md34h 512 8115978240 15851520 0 0 -/dev/md34s1 512 18367017984 35873082 0 0 -/dev/md34s1b 512 419430400 819200 0 0 -/dev/md34s1e 512 419430400 819200 0 0 -/dev/md34s1f 512 1073741824 2097152 0 0 -/dev/md34s1g 512 16454415360 32137530 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.kern.flp.xml b/sbin/geom/core/tests/Ref/disk.kern.flp.xml deleted file mode 100644 index d62c963..0000000 --- a/sbin/geom/core/tests/Ref/disk.kern.flp.xml +++ /dev/null @@ -1,4 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5632 11 0 0 -/dev/md34a 512 1474560 2880 0 0 -/dev/md34b 512 1474560 2880 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.msdos.ext.xml b/sbin/geom/core/tests/Ref/disk.msdos.ext.xml deleted file mode 100644 index 2820c46..0000000 --- a/sbin/geom/core/tests/Ref/disk.msdos.ext.xml +++ /dev/null @@ -1,27 +0,0 @@ -$FreeBSD$ -/dev/md34 512 2327759360 4546405 0 0 -/dev/md34s1 512 2146765824 4192902 0 0 -/dev/md34s10 512 8193024 16002 0 0 -/dev/md34s11 512 8193024 16002 0 0 -/dev/md34s12 512 8193024 16002 0 0 -/dev/md34s13 512 8193024 16002 0 0 -/dev/md34s14 512 8193024 16002 0 0 -/dev/md34s15 512 8193024 16002 0 0 -/dev/md34s16 512 8193024 16002 0 0 -/dev/md34s17 512 8193024 16002 0 0 -/dev/md34s18 512 8193024 16002 0 0 -/dev/md34s19 512 8193024 16002 0 0 -/dev/md34s2 512 427714560 835380 0 0 -/dev/md34s20 512 8193024 16002 0 0 -/dev/md34s21 512 8193024 16002 0 0 -/dev/md34s22 512 8193024 16002 0 0 -/dev/md34s23 512 8193024 16002 0 0 -/dev/md34s24 512 8193024 16002 0 0 -/dev/md34s25 512 8193024 16002 0 0 -/dev/md34s26 512 8193024 16002 0 0 -/dev/md34s27 512 8193024 16002 0 0 -/dev/md34s5 512 8193024 16002 0 0 -/dev/md34s6 512 8193024 16002 0 0 -/dev/md34s7 512 8193024 16002 0 0 -/dev/md34s8 512 8193024 16002 0 0 -/dev/md34s9 512 8193024 16002 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.msdos.flp.xml b/sbin/geom/core/tests/Ref/disk.msdos.flp.xml deleted file mode 100644 index 2b2b63e..0000000 --- a/sbin/geom/core/tests/Ref/disk.msdos.flp.xml +++ /dev/null @@ -1,2 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5632 11 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.pc98.wdc0.xml b/sbin/geom/core/tests/Ref/disk.pc98.wdc0.xml deleted file mode 100644 index ea89ed2..0000000 --- a/sbin/geom/core/tests/Ref/disk.pc98.wdc0.xml +++ /dev/null @@ -1,7 +0,0 @@ -$FreeBSD$ -/dev/md34 512 75264 147 0 0 1 8 17 -/dev/md34s1 512 1626603520 3176960 23360 0 0 8 17 -/dev/md34s1a 512 78643200 153600 1129 0 0 8 17 -/dev/md34s1b 512 104857600 204800 1505 0 0 8 17 -/dev/md34s1e 512 52428800 102400 752 0 0 8 17 -/dev/md34s1f 512 1390673920 2716160 19971 0 0 8 17 diff --git a/sbin/geom/core/tests/Ref/disk.sun.da0.xml b/sbin/geom/core/tests/Ref/disk.sun.da0.xml deleted file mode 100644 index da6c0aa..0000000 --- a/sbin/geom/core/tests/Ref/disk.sun.da0.xml +++ /dev/null @@ -1,5 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5120 10 0 0 -/dev/md34a 512 1529708544 2987712 0 0 -/dev/md34b 512 539320320 1053360 0 0 -/dev/md34h 512 34629267456 67635288 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.sun.da1.xml b/sbin/geom/core/tests/Ref/disk.sun.da1.xml deleted file mode 100644 index b1fe169..0000000 --- a/sbin/geom/core/tests/Ref/disk.sun.da1.xml +++ /dev/null @@ -1,8 +0,0 @@ -$FreeBSD$ -/dev/md34 512 5120 10 0 0 -/dev/md34a 512 262967296 513608 0 0 -/dev/md34b 512 1075994624 2101552 0 0 -/dev/md34d 512 11124240384 21727032 0 0 -/dev/md34f 512 2149576704 4198392 0 0 -/dev/md34g 512 2149576704 4198392 0 0 -/dev/md34h 512 1343787008 2624584 0 0 diff --git a/sbin/geom/core/tests/Ref/disk.typo.ad0.xml b/sbin/geom/core/tests/Ref/disk.typo.ad0.xml deleted file mode 100644 index 0ff1773..0000000 --- a/sbin/geom/core/tests/Ref/disk.typo.ad0.xml +++ /dev/null @@ -1,11 +0,0 @@ -$FreeBSD$ -/dev/md34 512 8585262592 16768091 0 0 -/dev/md34s1 512 3220406784 6289857 0 0 -/dev/md34s1a 512 104857600 204800 0 0 -/dev/md34s1b 512 524288000 1024000 0 0 -/dev/md34s1e 512 524288000 1024000 0 0 -/dev/md34s1f 512 2066973184 4037057 0 0 -/dev/md34s2 512 5364817920 10478160 0 0 -/dev/md34s3 512 8585256960 16768080 0 0 -/dev/md34s3a 512 2097152000 4096000 0 0 -/dev/md34s3d 512 6488104960 12672080 0 0 diff --git a/sbin/geom/core/tests/run_test.sh b/sbin/geom/core/tests/run_test.sh deleted file mode 100644 index bc640e5..0000000 --- a/sbin/geom/core/tests/run_test.sh +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/sh -# $FreeBSD$ - -MD=34 -: ${TMPDIR=/tmp} -TMP=$TMPDIR/$$ - -# The testcases seem to have been broken when the geom_sim provider was removed -echo "# these tests need to be rewritten; they were broken in r113434" -echo "1..0 # SKIP" -exit 0 - -set -e - -# Start from the right directory so we can find all our data files. -testsdir=$(realpath $(dirname $0)) - -# Print the test header -set -- $testsdir/Data/disk.*.xml -echo "1..$#" -data_files="$@" - -trap "rm -f $TMP; mdconfig -d -u $MD" EXIT INT TERM - -set +e - -refdir=$(realpath $(mktemp -d Ref.XXXXXX)) -for f in $data_files; do - b=`basename $f` - mdconfig -d -u $MD - - i=0 - while [ $i -lt 2 -a -c /dev/md$MD ]; do - sleep 1 - : $(( i += 1 )) - done - if [ -c /dev/md$MD ] ; then - echo "Bail out!" - echo "/dev/md$MD is busy" - exit 1 - fi - if ! $testsdir/MdLoad/MdLoad md${MD} $f; then - echo "not ok - $b # MdLoad failed" - continue - fi - if [ ! -f $refdir/$b ]; then - if [ -f $testsdir/Ref/$b ] ; then - grep -v '\$FreeBSD.*\$' $testsdir/Ref/$b > $refdir/$b - else - diskinfo /dev/md${MD}* > $refdir/$b - continue - fi - fi - diskinfo /dev/md${MD}* | diff -u $refdir/$b - > $TMP - if [ $? -eq 0 ]; then - echo "ok - $b" - else - echo "not ok - $b" - sed 's/^/# /' $TMP - fi -done diff --git a/sbin/ggate/ggated/Makefile b/sbin/ggate/ggated/Makefile index 83516c6..af5c9bd 100644 --- a/sbin/ggate/ggated/Makefile +++ b/sbin/ggate/ggated/Makefile @@ -6,7 +6,7 @@ PROG= ggated MAN= ggated.8 SRCS= ggated.c ggate.c -LIBADD= pthread util +LIBADD= pthread CFLAGS+= -I${.CURDIR}/../shared diff --git a/sbin/ggate/ggated/ggated.8 b/sbin/ggate/ggated/ggated.8 index 15b1792..dd6109a 100644 --- a/sbin/ggate/ggated/ggated.8 +++ b/sbin/ggate/ggated/ggated.8 @@ -37,7 +37,6 @@ .Op Fl v .Op Fl a Ar address .Op Fl p Ar port -.Op Fl F Ar pidfile .Op Fl R Ar rcvbuf .Op Fl S Ar sndbuf .Op Ar "exports file" @@ -68,10 +67,6 @@ Port on which .Nm listens for connections. Default is 3080. -.It Fl F Ar pidfile -PID file that -.Nm -uses. .It Fl R Ar rcvbuf Size of receive buffer to use. Default is 131072 (128kB). @@ -91,14 +86,6 @@ The format of an exports file is as follows: 1.2.3.0/24 RW /tmp/test.img hostname WO /tmp/image .Ed -.El -.Sh FILES -.Bl -tag -width ".Pa /var/run/ggated.pid" -compact -.It Pa /var/run/ggated.pid -The default location of the -.Nm -PID file. -.El .Sh EXIT STATUS Exit status is 0 on success, or 1 if the command fails. To get details about the failure, diff --git a/sbin/ggate/ggated/ggated.c b/sbin/ggate/ggated/ggated.c index e234cb5..a340f01 100644 --- a/sbin/ggate/ggated/ggated.c +++ b/sbin/ggate/ggated/ggated.c @@ -26,34 +26,32 @@ * $FreeBSD$ */ +#include <stdio.h> +#include <stdlib.h> +#include <stdint.h> +#include <unistd.h> +#include <fcntl.h> +#include <pthread.h> #include <sys/param.h> -#include <sys/bio.h> -#include <sys/disk.h> -#include <sys/endian.h> -#include <sys/ioctl.h> #include <sys/queue.h> +#include <sys/endian.h> #include <sys/socket.h> +#include <sys/ioctl.h> #include <sys/stat.h> #include <sys/time.h> -#include <arpa/inet.h> +#include <sys/disk.h> +#include <sys/bio.h> #include <netinet/in.h> #include <netinet/tcp.h> +#include <arpa/inet.h> +#include <signal.h> #include <assert.h> #include <err.h> #include <errno.h> -#include <fcntl.h> -#include <libgen.h> -#include <libutil.h> -#include <paths.h> -#include <pthread.h> -#include <signal.h> -#include <stdarg.h> -#include <stdio.h> -#include <stdlib.h> -#include <stdint.h> #include <string.h> +#include <libgen.h> #include <syslog.h> -#include <unistd.h> +#include <stdarg.h> #include "ggate.h" @@ -112,8 +110,8 @@ static void usage(void) { - fprintf(stderr, "usage: %s [-nv] [-a address] [-F pidfile] [-p port] " - "[-R rcvbuf] [-S sndbuf] [exports file]\n", getprogname()); + fprintf(stderr, "usage: %s [-nv] [-a address] [-p port] [-R rcvbuf] " + "[-S sndbuf] [exports file]\n", getprogname()); exit(EXIT_FAILURE); } @@ -948,18 +946,20 @@ huphandler(int sig __unused) int main(int argc, char *argv[]) { - const char *ggated_pidfile = _PATH_VARRUN "/ggated.pid"; - struct pidfh *pfh; struct sockaddr_in serv; struct sockaddr from; socklen_t fromlen; - pid_t otherpid; - int ch, sfd, tmpsfd; + int sfd, tmpsfd; unsigned port; bindaddr = htonl(INADDR_ANY); port = G_GATE_PORT; - while ((ch = getopt(argc, argv, "a:hnp:F:R:S:v")) != -1) { + for (;;) { + int ch; + + ch = getopt(argc, argv, "a:hnp:R:S:v"); + if (ch == -1) + break; switch (ch) { case 'a': bindaddr = g_gate_str2ip(optarg); @@ -968,9 +968,6 @@ main(int argc, char *argv[]) "Invalid IP/host name to bind to."); } break; - case 'F': - ggated_pidfile = optarg; - break; case 'n': nagle = 0; break; @@ -1007,23 +1004,12 @@ main(int argc, char *argv[]) exports_file = argv[0]; exports_get(); - pfh = pidfile_open(ggated_pidfile, 0600, &otherpid); - if (pfh == NULL) { - if (errno == EEXIST) { - errx(EXIT_FAILURE, "Daemon already running, pid: %jd.", - (intmax_t)otherpid); - } - err(EXIT_FAILURE, "Cannot open/create pidfile"); - } - if (!g_gate_verbose) { /* Run in daemon mode. */ if (daemon(0, 0) == -1) g_gate_xlog("Cannot daemonize: %s", strerror(errno)); } - pidfile_write(pfh); - signal(SIGCHLD, SIG_IGN); sfd = socket(AF_INET, SOCK_STREAM, 0); @@ -1060,6 +1046,5 @@ main(int argc, char *argv[]) close(tmpsfd); } close(sfd); - pidfile_remove(pfh); exit(EXIT_SUCCESS); } diff --git a/share/mk/bsd.README b/share/mk/bsd.README index 3e3dcd3..b1a68e8 100644 --- a/share/mk/bsd.README +++ b/share/mk/bsd.README @@ -448,12 +448,6 @@ It has seven targets: all: build the test programs. - check: - runs the test programs from the object directory; if the - Makefile does not itself define the target test, the - targets beforecheck and aftercheck may also be used to - cause actions immediately before and after the test - target is executed. clean: remove the test programs and any object files. cleandir: @@ -472,6 +466,12 @@ It has seven targets: run lint on the source files. tags: create a tags file for the source files. + test: + runs the test programs from the object directory; if the + Makefile does not itself define the target test, the + targets beforetest and aftertest may also be used to + cause actions immediately before and after the test + target is executed. It sets/uses the following variables, among many others: diff --git a/share/mk/bsd.subdir.mk b/share/mk/bsd.subdir.mk index bbc2d19..aacd1b3 100644 --- a/share/mk/bsd.subdir.mk +++ b/share/mk/bsd.subdir.mk @@ -37,10 +37,10 @@ __<bsd.subdir.mk>__: ALL_SUBDIR_TARGETS= all all-man buildconfig buildfiles buildincludes \ - check checkdpadd clean cleandepend cleandir cleanilinks \ + checkdpadd clean cleandepend cleandir cleanilinks \ cleanobj depend distribute files includes installconfig \ installfiles installincludes realinstall lint maninstall \ - manlint obj objlink tags \ + manlint obj objlink regress tags \ ${SUBDIR_TARGETS} # Described above. diff --git a/share/mk/bsd.sys.mk b/share/mk/bsd.sys.mk index 8091826..de62195 100644 --- a/share/mk/bsd.sys.mk +++ b/share/mk/bsd.sys.mk @@ -177,11 +177,11 @@ CXXFLAGS+= ${CXXFLAGS.${COMPILER_TYPE}} # or expect to ever be up-to-date. PHONY_NOTMAIN = afterdepend afterinstall all beforedepend beforeinstall \ beforelinking build build-tools buildconfig buildfiles \ - buildincludes check checkdpadd clean cleandepend cleandir \ - cleanobj configure depend dependall distclean distribute exe \ + buildincludes checkdpadd clean cleandepend cleandir cleanobj \ + configure depend dependall distclean distribute exe \ files html includes install installconfig installfiles \ installincludes lint obj objlink objs objwarn realall \ - realdepend realinstall subdir-all subdir-depend \ + realdepend realinstall regress subdir-all subdir-depend \ subdir-install tags whereobj # we don't want ${PROG} to be PHONY diff --git a/share/mk/bsd.test.mk b/share/mk/bsd.test.mk index 6e68d9e..9c59619 100644 --- a/share/mk/bsd.test.mk +++ b/share/mk/bsd.test.mk @@ -79,14 +79,19 @@ PROGS_TARGETS+= install .include <suite.test.mk> .endif -.if !target(realcheck) -realcheck: .PHONY +.if !target(realtest) +realtest: .PHONY @echo "$@ not defined; skipping" .endif -beforecheck realcheck aftercheck check: .PHONY -.ORDER: beforecheck realcheck aftercheck -check: beforecheck realcheck aftercheck +test: .PHONY +.ORDER: beforetest realtest +test: beforetest realtest + +.if target(aftertest) +.ORDER: realtest aftertest +test: aftertest +.endif .ifdef PROG # we came here via bsd.progs.mk below diff --git a/share/mk/suite.test.mk b/share/mk/suite.test.mk index 606514b..2b87d7f 100644 --- a/share/mk/suite.test.mk +++ b/share/mk/suite.test.mk @@ -79,10 +79,8 @@ Kyuafile: Makefile .endif KYUA= ${LOCALBASE}/bin/kyua - -realcheck: .PHONY .if exists(${KYUA}) -# Definition of the "make check" target and supporting variables. +# Definition of the "make test" target and supporting variables. # # This target, by necessity, can only work for native builds (i.e. a FreeBSD # host building a release for the same system). The target runs Kyua, which is @@ -91,5 +89,35 @@ realcheck: .PHONY # Due to the dependencies of the binaries built by the source tree and how they # are used by tests, it is highly possible for a execution of "make test" to # report bogus results unless the new binaries are put in place. - @${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile +realtest: .PHONY + @echo "*** WARNING: make test is experimental" + @echo "***" + @echo "*** Using this test does not preclude you from running the tests" + @echo "*** installed in ${TESTSBASE}. This test run may raise false" + @echo "*** positives and/or false negatives." + @echo + @${KYUA} test -k ${DESTDIR}${TESTSDIR}/Kyuafile; \ + result=0; \ + echo; \ + echo "*** Once again, note that "make test" is unsupported."; \ + test $${result} -eq 0 +.endif + +beforetest: .PHONY +.if defined(TESTSDIR) +.if ${TESTSDIR} == ${TESTSBASE} +# Forbid running from ${TESTSBASE}. It can cause false positives/negatives and +# it does not cover all the tests (e.g. it misses testing software in external). + @echo "*** Sorry, you cannot use make test from src/tests. Install the" + @echo "*** tests into their final location and run them from ${TESTSBASE}" + @false +.else + @echo "*** Using this test does not preclude you from running the tests" + @echo "*** installed in ${TESTSBASE}. This test run may raise false" + @echo "*** positives and/or false negatives." +.endif +.else + @echo "*** No TESTSDIR defined; nothing to do." + @false .endif + @echo diff --git a/sys/dev/sfxge/common/efx.h b/sys/dev/sfxge/common/efx.h index b9d2061..0483c9a 100644 --- a/sys/dev/sfxge/common/efx.h +++ b/sys/dev/sfxge/common/efx.h @@ -2235,14 +2235,14 @@ efx_filter_supported_filters( extern void efx_filter_spec_init_rx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, __in efx_filter_flag_t flags, __in efx_rxq_t *erp); extern void efx_filter_spec_init_tx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_txq_t *etp); extern __checkReturn efx_rc_t diff --git a/sys/dev/sfxge/common/efx_filter.c b/sys/dev/sfxge/common/efx_filter.c index e2763ae..a4b59cc 100644 --- a/sys/dev/sfxge/common/efx_filter.c +++ b/sys/dev/sfxge/common/efx_filter.c @@ -292,7 +292,7 @@ fail1: void efx_filter_spec_init_rx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_filter_priority_t priority, __in efx_filter_flag_t flags, __in efx_rxq_t *erp) @@ -311,7 +311,7 @@ efx_filter_spec_init_rx( void efx_filter_spec_init_tx( - __inout efx_filter_spec_t *spec, + __out efx_filter_spec_t *spec, __in efx_txq_t *etp) { EFSYS_ASSERT3P(spec, !=, NULL); diff --git a/sys/dev/sfxge/common/efx_impl.h b/sys/dev/sfxge/common/efx_impl.h index 16c0898..5397ffe 100644 --- a/sys/dev/sfxge/common/efx_impl.h +++ b/sys/dev/sfxge/common/efx_impl.h @@ -1120,7 +1120,7 @@ efx_vpd_hunk_next( __in size_t size, __out efx_vpd_tag_t *tagp, __out efx_vpd_keyword_t *keyword, - __out_bcount_opt(*paylenp) unsigned int *payloadp, + __out_opt unsigned int *payloadp, __out_opt uint8_t *paylenp, __inout unsigned int *contp); diff --git a/sys/dev/sfxge/common/efx_mcdi.h b/sys/dev/sfxge/common/efx_mcdi.h index d100775..36b3d8d 100644 --- a/sys/dev/sfxge/common/efx_mcdi.h +++ b/sys/dev/sfxge/common/efx_mcdi.h @@ -54,7 +54,7 @@ struct efx_mcdi_req_s { uint8_t *emr_in_buf; size_t emr_in_length; /* Outputs: retcode, buffer, length, and length used*/ - int emr_rc; + efx_rc_t emr_rc; uint8_t *emr_out_buf; size_t emr_out_length; size_t emr_out_length_used; diff --git a/sys/dev/sfxge/common/efx_types.h b/sys/dev/sfxge/common/efx_types.h index f112a4c..ae4c6d9 100644 --- a/sys/dev/sfxge/common/efx_types.h +++ b/sys/dev/sfxge/common/efx_types.h @@ -536,7 +536,7 @@ extern int fix_lint; (_oword).eo_u32[3]) == ~((uint32_t)0)) #define EFX_QWORD_IS_SET64(_qword) \ - (((_qword).eq_u64[0]) == ~((uint32_t)0)) + (((_qword).eq_u64[0]) == ~((uint64_t)0)) #define EFX_QWORD_IS_SET32(_qword) \ (((_qword).eq_u32[0] & \ diff --git a/sys/dev/sfxge/common/hunt_impl.h b/sys/dev/sfxge/common/hunt_impl.h index ab5857f..f8c3b5e 100644 --- a/sys/dev/sfxge/common/hunt_impl.h +++ b/sys/dev/sfxge/common/hunt_impl.h @@ -289,10 +289,10 @@ ef10_mcdi_poll_response( extern void ef10_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length); + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length); extern void ef10_mcdi_request_copyout( diff --git a/sys/dev/sfxge/common/hunt_mcdi.c b/sys/dev/sfxge/common/hunt_mcdi.c index 5b32150..1cccb23 100644 --- a/sys/dev/sfxge/common/hunt_mcdi.c +++ b/sys/dev/sfxge/common/hunt_mcdi.c @@ -307,10 +307,10 @@ ef10_mcdi_poll_response( void ef10_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length) + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length) { const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp; efsys_mem_t *esmp = emtp->emt_dma_mem; diff --git a/sys/dev/sfxge/common/hunt_nvram.c b/sys/dev/sfxge/common/hunt_nvram.c index 324c0d8..cbead9b 100644 --- a/sys/dev/sfxge/common/hunt_nvram.c +++ b/sys/dev/sfxge/common/hunt_nvram.c @@ -240,7 +240,7 @@ fail1: static efx_rc_t tlv_init_cursor( - __in tlv_cursor_t *cursor, + __out tlv_cursor_t *cursor, __in uint32_t *block, __in uint32_t *limit) { @@ -255,7 +255,7 @@ tlv_init_cursor( static efx_rc_t tlv_init_cursor_from_size( - __in tlv_cursor_t *cursor, + __out tlv_cursor_t *cursor, __in uint8_t *block, __in size_t size) { @@ -1103,7 +1103,7 @@ ef10_nvram_segment_write_tlv( __in boolean_t write) { efx_rc_t rc; - int status; + efx_rc_t status; size_t original_segment_size; size_t modified_segment_size; diff --git a/sys/dev/sfxge/common/siena_impl.h b/sys/dev/sfxge/common/siena_impl.h index effa113..639ac6b 100644 --- a/sys/dev/sfxge/common/siena_impl.h +++ b/sys/dev/sfxge/common/siena_impl.h @@ -127,10 +127,10 @@ siena_mcdi_poll_response( extern void siena_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length); + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length); extern void siena_mcdi_request_copyout( diff --git a/sys/dev/sfxge/common/siena_mcdi.c b/sys/dev/sfxge/common/siena_mcdi.c index b6d6fcb..f3af2bf6f 100644 --- a/sys/dev/sfxge/common/siena_mcdi.c +++ b/sys/dev/sfxge/common/siena_mcdi.c @@ -216,10 +216,10 @@ siena_mcdi_poll_response( void siena_mcdi_read_response( - __in efx_nic_t *enp, - __out void *bufferp, - __in size_t offset, - __in size_t length) + __in efx_nic_t *enp, + __out_bcount(length) void *bufferp, + __in size_t offset, + __in size_t length) { efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip); unsigned int pdur; diff --git a/tests/sys/Makefile b/tests/sys/Makefile index a1f1ad6..18a24a4 100644 --- a/tests/sys/Makefile +++ b/tests/sys/Makefile @@ -15,11 +15,13 @@ TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= netinet TESTS_SUBDIRS+= opencrypto -TESTS_SUBDIRS+= pjdfstest TESTS_SUBDIRS+= posixshm TESTS_SUBDIRS+= vfs TESTS_SUBDIRS+= vm +# Items not integrated into kyua runs by default +SUBDIR+= pjdfstest + SUBDIR_PARALLEL= .include <bsd.test.mk> diff --git a/tests/sys/geom/class/Makefile.inc b/tests/sys/geom/class/Makefile.inc deleted file mode 100644 index 17e59b0..0000000 --- a/tests/sys/geom/class/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $FreeBSD$ - -GEOM_CLASS= ${.CURDIR:T} - -TESTSDIR= ${TESTSBASE}/sys/geom/class/${GEOM_CLASS} diff --git a/tests/sys/geom/class/concat/1_test.sh b/tests/sys/geom/class/concat/1_test.sh index ef80a61..ef80a61 100755..100644 --- a/tests/sys/geom/class/concat/1_test.sh +++ b/tests/sys/geom/class/concat/1_test.sh diff --git a/tests/sys/geom/class/concat/2_test.sh b/tests/sys/geom/class/concat/2_test.sh index 95636be..95636be 100755..100644 --- a/tests/sys/geom/class/concat/2_test.sh +++ b/tests/sys/geom/class/concat/2_test.sh diff --git a/tests/sys/geom/class/concat/Makefile b/tests/sys/geom/class/concat/Makefile index 81a4e99..5659b5d 100644 --- a/tests/sys/geom/class/concat/Makefile +++ b/tests/sys/geom/class/concat/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test @@ -7,4 +9,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/concat/conf.sh b/tests/sys/geom/class/concat/conf.sh index 374ed12..374ed12 100755..100644 --- a/tests/sys/geom/class/concat/conf.sh +++ b/tests/sys/geom/class/concat/conf.sh diff --git a/tests/sys/geom/class/eli/Makefile b/tests/sys/geom/class/eli/Makefile index 1846ed6..8f4ca60 100644 --- a/tests/sys/geom/class/eli/Makefile +++ b/tests/sys/geom/class/eli/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= attach_d_test TAP_TESTS_SH+= configure_b_B_test TAP_TESTS_SH+= delkey_test @@ -33,4 +35,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/eli/attach_d_test.sh b/tests/sys/geom/class/eli/attach_d_test.sh index 5d700b3..5d700b3 100755..100644 --- a/tests/sys/geom/class/eli/attach_d_test.sh +++ b/tests/sys/geom/class/eli/attach_d_test.sh diff --git a/tests/sys/geom/class/eli/conf.sh b/tests/sys/geom/class/eli/conf.sh index 080fa61..0646e83 100755 --- a/tests/sys/geom/class/eli/conf.sh +++ b/tests/sys/geom/class/eli/conf.sh @@ -4,6 +4,8 @@ class="eli" base=`basename $0` +# We need to use linear probing in order to detect the first available md(4) +# device instead of using mdconfig -a -t, because geli(8) attachs md(4) devices no=0 while [ -c /dev/md$no ]; do : $(( no += 1 )) diff --git a/tests/sys/geom/class/eli/configure_b_B_test.sh b/tests/sys/geom/class/eli/configure_b_B_test.sh index b6cdf4f..b6cdf4f 100755..100644 --- a/tests/sys/geom/class/eli/configure_b_B_test.sh +++ b/tests/sys/geom/class/eli/configure_b_B_test.sh diff --git a/tests/sys/geom/class/eli/delkey_test.sh b/tests/sys/geom/class/eli/delkey_test.sh index 67b253e..67b253e 100755..100644 --- a/tests/sys/geom/class/eli/delkey_test.sh +++ b/tests/sys/geom/class/eli/delkey_test.sh diff --git a/tests/sys/geom/class/eli/detach_l_test.sh b/tests/sys/geom/class/eli/detach_l_test.sh index 605ae94..605ae94 100755..100644 --- a/tests/sys/geom/class/eli/detach_l_test.sh +++ b/tests/sys/geom/class/eli/detach_l_test.sh diff --git a/tests/sys/geom/class/eli/init_B_test.sh b/tests/sys/geom/class/eli/init_B_test.sh index 3ba743c..3ba743c 100755..100644 --- a/tests/sys/geom/class/eli/init_B_test.sh +++ b/tests/sys/geom/class/eli/init_B_test.sh diff --git a/tests/sys/geom/class/eli/init_J_test.sh b/tests/sys/geom/class/eli/init_J_test.sh index 266a3d5..266a3d5 100755..100644 --- a/tests/sys/geom/class/eli/init_J_test.sh +++ b/tests/sys/geom/class/eli/init_J_test.sh diff --git a/tests/sys/geom/class/eli/init_a_test.sh b/tests/sys/geom/class/eli/init_a_test.sh index dbb24fe..dbb24fe 100755..100644 --- a/tests/sys/geom/class/eli/init_a_test.sh +++ b/tests/sys/geom/class/eli/init_a_test.sh diff --git a/tests/sys/geom/class/eli/init_i_P_test.sh b/tests/sys/geom/class/eli/init_i_P_test.sh index 1c59a97..1c59a97 100755..100644 --- a/tests/sys/geom/class/eli/init_i_P_test.sh +++ b/tests/sys/geom/class/eli/init_i_P_test.sh diff --git a/tests/sys/geom/class/eli/init_test.sh b/tests/sys/geom/class/eli/init_test.sh index 71dd6e2..71dd6e2 100755..100644 --- a/tests/sys/geom/class/eli/init_test.sh +++ b/tests/sys/geom/class/eli/init_test.sh diff --git a/tests/sys/geom/class/eli/integrity_copy_test.sh b/tests/sys/geom/class/eli/integrity_copy_test.sh index 4c8efd3..4c8efd3 100755..100644 --- a/tests/sys/geom/class/eli/integrity_copy_test.sh +++ b/tests/sys/geom/class/eli/integrity_copy_test.sh diff --git a/tests/sys/geom/class/eli/integrity_data_test.sh b/tests/sys/geom/class/eli/integrity_data_test.sh index 7ea7c96b..7ea7c96b 100755..100644 --- a/tests/sys/geom/class/eli/integrity_data_test.sh +++ b/tests/sys/geom/class/eli/integrity_data_test.sh diff --git a/tests/sys/geom/class/eli/integrity_hmac_test.sh b/tests/sys/geom/class/eli/integrity_hmac_test.sh index 243eac9..243eac9 100755..100644 --- a/tests/sys/geom/class/eli/integrity_hmac_test.sh +++ b/tests/sys/geom/class/eli/integrity_hmac_test.sh diff --git a/tests/sys/geom/class/eli/kill_test.sh b/tests/sys/geom/class/eli/kill_test.sh index ccced9f..ccced9f 100755..100644 --- a/tests/sys/geom/class/eli/kill_test.sh +++ b/tests/sys/geom/class/eli/kill_test.sh diff --git a/tests/sys/geom/class/eli/nokey_test.sh b/tests/sys/geom/class/eli/nokey_test.sh index f32e1a4..f32e1a4 100755..100644 --- a/tests/sys/geom/class/eli/nokey_test.sh +++ b/tests/sys/geom/class/eli/nokey_test.sh diff --git a/tests/sys/geom/class/eli/onetime_a_test.sh b/tests/sys/geom/class/eli/onetime_a_test.sh index 4e26dfb..4e26dfb 100755..100644 --- a/tests/sys/geom/class/eli/onetime_a_test.sh +++ b/tests/sys/geom/class/eli/onetime_a_test.sh diff --git a/tests/sys/geom/class/eli/onetime_d_test.sh b/tests/sys/geom/class/eli/onetime_d_test.sh index 51a6abb..51a6abb 100755..100644 --- a/tests/sys/geom/class/eli/onetime_d_test.sh +++ b/tests/sys/geom/class/eli/onetime_d_test.sh diff --git a/tests/sys/geom/class/eli/onetime_test.sh b/tests/sys/geom/class/eli/onetime_test.sh index 17061d0..17061d0 100755..100644 --- a/tests/sys/geom/class/eli/onetime_test.sh +++ b/tests/sys/geom/class/eli/onetime_test.sh diff --git a/tests/sys/geom/class/eli/readonly_test.sh b/tests/sys/geom/class/eli/readonly_test.sh index 721ad62..721ad62 100755..100644 --- a/tests/sys/geom/class/eli/readonly_test.sh +++ b/tests/sys/geom/class/eli/readonly_test.sh diff --git a/tests/sys/geom/class/eli/resize_test.sh b/tests/sys/geom/class/eli/resize_test.sh index 67d6291..67d6291 100755..100644 --- a/tests/sys/geom/class/eli/resize_test.sh +++ b/tests/sys/geom/class/eli/resize_test.sh diff --git a/tests/sys/geom/class/eli/setkey_test.sh b/tests/sys/geom/class/eli/setkey_test.sh index 458100c..458100c 100755..100644 --- a/tests/sys/geom/class/eli/setkey_test.sh +++ b/tests/sys/geom/class/eli/setkey_test.sh diff --git a/tests/sys/geom/class/gate/1_test.sh b/tests/sys/geom/class/gate/1_test.sh index fb6fd62..83f6096 100755..100644 --- a/tests/sys/geom/class/gate/1_test.sh +++ b/tests/sys/geom/class/gate/1_test.sh @@ -3,13 +3,15 @@ . `dirname $0`/conf.sh +echo '1..2' + base=`basename $0` us=0 while [ -c /dev/ggate${us} ]; do : $(( us += 1 )) done conf=`mktemp $base.XXXXXX` || exit 1 -pidfile=ggated.pid +pidfile=/var/run/ggated.pid port=33080 work=$(attach_md -t malloc -s 1M) @@ -29,11 +31,12 @@ src_checksum=$(md5 -q /dev/$src) echo "127.0.0.1 RW /dev/$work" > $conf -if ! ggated -F $pidfile -p $port $conf; then +if ! ggated -p $port $conf; then echo 'ggated failed to start' echo 'Bail out!' exit 1 fi +sleep 1 if ! ggatec create -p $port -u $us 127.0.0.1 /dev/$work; then echo 'ggatec create failed' echo 'Bail out!' @@ -43,8 +46,6 @@ fi dd if=/dev/${src} of=/dev/ggate${us} bs=1m count=1 sleep 1 -echo '1..2' - work_checksum=$(md5 -q /dev/$work) if [ "$work_checksum" != "$src_checksum" ]; then echo "not ok 1 - md5 checksums didn't match ($work_checksum != $src_checksum)" diff --git a/tests/sys/geom/class/gate/2_test.sh b/tests/sys/geom/class/gate/2_test.sh index be89acc..be89acc 100755..100644 --- a/tests/sys/geom/class/gate/2_test.sh +++ b/tests/sys/geom/class/gate/2_test.sh diff --git a/tests/sys/geom/class/gate/3_test.sh b/tests/sys/geom/class/gate/3_test.sh index 8901aca..8901aca 100755..100644 --- a/tests/sys/geom/class/gate/3_test.sh +++ b/tests/sys/geom/class/gate/3_test.sh diff --git a/tests/sys/geom/class/gate/Makefile b/tests/sys/geom/class/gate/Makefile index 985d98f..11ceb94 100644 --- a/tests/sys/geom/class/gate/Makefile +++ b/tests/sys/geom/class/gate/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test TAP_TESTS_SH+= 3_test @@ -8,4 +10,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/geom_subr.sh b/tests/sys/geom/class/geom_subr.sh index 0ffb8c8..b437183 100644 --- a/tests/sys/geom/class/geom_subr.sh +++ b/tests/sys/geom/class/geom_subr.sh @@ -1,13 +1,6 @@ #!/bin/sh # $FreeBSD$ -if [ $(id -u) -ne 0 ]; then - echo 'Tests must be run as root' - echo 'Bail out!' - exit 1 -fi -kldstat -q -m g_${class} || geom ${class} load || exit 1 - devwait() { while :; do @@ -18,13 +11,6 @@ devwait() done } -# Need to keep track of the test md devices to avoid the scenario where a test -# failing will cause the other tests to bomb out, or a test failing will leave -# a large number of md(4) devices lingering around -: ${TMPDIR=/tmp} -export TMPDIR -TEST_MDS_FILE=${TMPDIR}/test_mds - attach_md() { local test_md @@ -38,11 +24,37 @@ geom_test_cleanup() { local test_md - if [ -f $TEST_MDS_FILE ]; then + if [ -f "$TEST_MDS_FILE" ]; then while read test_md; do # The "#" tells the TAP parser this is a comment echo "# Removing test memory disk: $test_md" mdconfig -d -u $test_md done < $TEST_MDS_FILE fi + rm -f "$TEST_MDS_FILE" } + +if [ $(id -u) -ne 0 ]; then + echo 'Tests must be run as root' + echo 'Bail out!' + exit 1 +fi +# If the geom class isn't already loaded, try loading it. +if ! kldstat -q -m g_${class}; then + if ! geom ${class} load; then + echo "Could not load module for geom class=${class}" + echo 'Bail out!' + exit 1 + fi +fi + +# Need to keep track of the test md devices to avoid the scenario where a test +# failing will cause the other tests to bomb out, or a test failing will leave +# a large number of md(4) devices lingering around +: ${TMPDIR=/tmp} +export TMPDIR +if ! TEST_MDS_FILE=$(mktemp ${TMPDIR}/test_mds.XXXXXX); then + echo 'Failed to create temporary file for tracking the test md(4) devices' + echo 'Bail out!' + exit 1 +fi diff --git a/tests/sys/geom/class/gpt/Makefile b/tests/sys/geom/class/gpt/Makefile deleted file mode 100644 index be11f0a..0000000 --- a/tests/sys/geom/class/gpt/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $FreeBSD$ - -BINDIR= ${TESTSDIR} - -TAP_TESTS_PERL+= gctl_test - -PROGS+= gctl -MAN= - -DPADD.gctl+= ${LIBGEOM} -LDADD.gctl+= -lgeom - -.include <bsd.test.mk> diff --git a/tests/sys/geom/class/mirror/1_test.sh b/tests/sys/geom/class/mirror/1_test.sh index af82a14..af82a14 100755..100644 --- a/tests/sys/geom/class/mirror/1_test.sh +++ b/tests/sys/geom/class/mirror/1_test.sh diff --git a/tests/sys/geom/class/mirror/2_test.sh b/tests/sys/geom/class/mirror/2_test.sh index 5605c44..5605c44 100755..100644 --- a/tests/sys/geom/class/mirror/2_test.sh +++ b/tests/sys/geom/class/mirror/2_test.sh diff --git a/tests/sys/geom/class/mirror/3_test.sh b/tests/sys/geom/class/mirror/3_test.sh index b7f8525..b7f8525 100755..100644 --- a/tests/sys/geom/class/mirror/3_test.sh +++ b/tests/sys/geom/class/mirror/3_test.sh diff --git a/tests/sys/geom/class/mirror/4_test.sh b/tests/sys/geom/class/mirror/4_test.sh index 6efcc02..6efcc02 100755..100644 --- a/tests/sys/geom/class/mirror/4_test.sh +++ b/tests/sys/geom/class/mirror/4_test.sh diff --git a/tests/sys/geom/class/mirror/5_test.sh b/tests/sys/geom/class/mirror/5_test.sh index 3a176b5..3a176b5 100755..100644 --- a/tests/sys/geom/class/mirror/5_test.sh +++ b/tests/sys/geom/class/mirror/5_test.sh diff --git a/tests/sys/geom/class/mirror/6_test.sh b/tests/sys/geom/class/mirror/6_test.sh index 68036e9..68036e9 100755..100644 --- a/tests/sys/geom/class/mirror/6_test.sh +++ b/tests/sys/geom/class/mirror/6_test.sh diff --git a/tests/sys/geom/class/mirror/7_test.sh b/tests/sys/geom/class/mirror/7_test.sh index f5bf71a..f5bf71a 100755..100644 --- a/tests/sys/geom/class/mirror/7_test.sh +++ b/tests/sys/geom/class/mirror/7_test.sh diff --git a/tests/sys/geom/class/mirror/Makefile b/tests/sys/geom/class/mirror/Makefile index cf3784f..931f7d0 100644 --- a/tests/sys/geom/class/mirror/Makefile +++ b/tests/sys/geom/class/mirror/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test TAP_TESTS_SH+= 3_test @@ -12,4 +14,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/mirror/conf.sh b/tests/sys/geom/class/mirror/conf.sh index d8595f1..d8595f1 100755..100644 --- a/tests/sys/geom/class/mirror/conf.sh +++ b/tests/sys/geom/class/mirror/conf.sh diff --git a/tests/sys/geom/class/nop/1_test.sh b/tests/sys/geom/class/nop/1_test.sh index 4d6b65d..4d6b65d 100755..100644 --- a/tests/sys/geom/class/nop/1_test.sh +++ b/tests/sys/geom/class/nop/1_test.sh diff --git a/tests/sys/geom/class/nop/2_test.sh b/tests/sys/geom/class/nop/2_test.sh index 7422345..7422345 100755..100644 --- a/tests/sys/geom/class/nop/2_test.sh +++ b/tests/sys/geom/class/nop/2_test.sh diff --git a/tests/sys/geom/class/nop/Makefile b/tests/sys/geom/class/nop/Makefile index 81a4e99..5659b5d 100644 --- a/tests/sys/geom/class/nop/Makefile +++ b/tests/sys/geom/class/nop/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test @@ -7,4 +9,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/nop/conf.sh b/tests/sys/geom/class/nop/conf.sh index e38e10c..e38e10c 100755..100644 --- a/tests/sys/geom/class/nop/conf.sh +++ b/tests/sys/geom/class/nop/conf.sh diff --git a/tests/sys/geom/class/raid3/10_test.sh b/tests/sys/geom/class/raid3/10_test.sh index edd827d..edd827d 100755..100644 --- a/tests/sys/geom/class/raid3/10_test.sh +++ b/tests/sys/geom/class/raid3/10_test.sh diff --git a/tests/sys/geom/class/raid3/11_test.sh b/tests/sys/geom/class/raid3/11_test.sh index 0407261..0407261 100755..100644 --- a/tests/sys/geom/class/raid3/11_test.sh +++ b/tests/sys/geom/class/raid3/11_test.sh diff --git a/tests/sys/geom/class/raid3/12_test.sh b/tests/sys/geom/class/raid3/12_test.sh index 10533c6..10533c6 100755..100644 --- a/tests/sys/geom/class/raid3/12_test.sh +++ b/tests/sys/geom/class/raid3/12_test.sh diff --git a/tests/sys/geom/class/raid3/1_test.sh b/tests/sys/geom/class/raid3/1_test.sh index 4c0b4a2..4c0b4a2 100755..100644 --- a/tests/sys/geom/class/raid3/1_test.sh +++ b/tests/sys/geom/class/raid3/1_test.sh diff --git a/tests/sys/geom/class/raid3/2_test.sh b/tests/sys/geom/class/raid3/2_test.sh index 22ebd38..22ebd38 100755..100644 --- a/tests/sys/geom/class/raid3/2_test.sh +++ b/tests/sys/geom/class/raid3/2_test.sh diff --git a/tests/sys/geom/class/raid3/3_test.sh b/tests/sys/geom/class/raid3/3_test.sh index f068b06..f068b06 100755..100644 --- a/tests/sys/geom/class/raid3/3_test.sh +++ b/tests/sys/geom/class/raid3/3_test.sh diff --git a/tests/sys/geom/class/raid3/4_test.sh b/tests/sys/geom/class/raid3/4_test.sh index 810f13d..810f13d 100755..100644 --- a/tests/sys/geom/class/raid3/4_test.sh +++ b/tests/sys/geom/class/raid3/4_test.sh diff --git a/tests/sys/geom/class/raid3/5_test.sh b/tests/sys/geom/class/raid3/5_test.sh index 7bc8d42..7bc8d42 100755..100644 --- a/tests/sys/geom/class/raid3/5_test.sh +++ b/tests/sys/geom/class/raid3/5_test.sh diff --git a/tests/sys/geom/class/raid3/6_test.sh b/tests/sys/geom/class/raid3/6_test.sh index 20bf192..20bf192 100755..100644 --- a/tests/sys/geom/class/raid3/6_test.sh +++ b/tests/sys/geom/class/raid3/6_test.sh diff --git a/tests/sys/geom/class/raid3/7_test.sh b/tests/sys/geom/class/raid3/7_test.sh index 23666f8..23666f8 100755..100644 --- a/tests/sys/geom/class/raid3/7_test.sh +++ b/tests/sys/geom/class/raid3/7_test.sh diff --git a/tests/sys/geom/class/raid3/8_test.sh b/tests/sys/geom/class/raid3/8_test.sh index 2eb9b1a..2eb9b1a 100755..100644 --- a/tests/sys/geom/class/raid3/8_test.sh +++ b/tests/sys/geom/class/raid3/8_test.sh diff --git a/tests/sys/geom/class/raid3/9_test.sh b/tests/sys/geom/class/raid3/9_test.sh index 0ef010a..0ef010a 100755..100644 --- a/tests/sys/geom/class/raid3/9_test.sh +++ b/tests/sys/geom/class/raid3/9_test.sh diff --git a/tests/sys/geom/class/raid3/Makefile b/tests/sys/geom/class/raid3/Makefile index c1c95f1..526c175 100644 --- a/tests/sys/geom/class/raid3/Makefile +++ b/tests/sys/geom/class/raid3/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test TAP_TESTS_SH+= 3_test @@ -17,4 +19,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/raid3/conf.sh b/tests/sys/geom/class/raid3/conf.sh index f1b270a..f1b270a 100755..100644 --- a/tests/sys/geom/class/raid3/conf.sh +++ b/tests/sys/geom/class/raid3/conf.sh diff --git a/tests/sys/geom/class/shsec/1_test.sh b/tests/sys/geom/class/shsec/1_test.sh index ab0bb37..ab0bb37 100755..100644 --- a/tests/sys/geom/class/shsec/1_test.sh +++ b/tests/sys/geom/class/shsec/1_test.sh diff --git a/tests/sys/geom/class/shsec/2_test.sh b/tests/sys/geom/class/shsec/2_test.sh index 9dfe36a..9dfe36a 100755..100644 --- a/tests/sys/geom/class/shsec/2_test.sh +++ b/tests/sys/geom/class/shsec/2_test.sh diff --git a/tests/sys/geom/class/shsec/Makefile b/tests/sys/geom/class/shsec/Makefile index 81a4e99..5659b5d 100644 --- a/tests/sys/geom/class/shsec/Makefile +++ b/tests/sys/geom/class/shsec/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test @@ -7,4 +9,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/shsec/conf.sh b/tests/sys/geom/class/shsec/conf.sh index 7800eb7..7800eb7 100755..100644 --- a/tests/sys/geom/class/shsec/conf.sh +++ b/tests/sys/geom/class/shsec/conf.sh diff --git a/tests/sys/geom/class/stripe/1_test.sh b/tests/sys/geom/class/stripe/1_test.sh index 7923763..7923763 100755..100644 --- a/tests/sys/geom/class/stripe/1_test.sh +++ b/tests/sys/geom/class/stripe/1_test.sh diff --git a/tests/sys/geom/class/stripe/2_test.sh b/tests/sys/geom/class/stripe/2_test.sh index f6e11f5..f6e11f5 100755..100644 --- a/tests/sys/geom/class/stripe/2_test.sh +++ b/tests/sys/geom/class/stripe/2_test.sh diff --git a/tests/sys/geom/class/stripe/Makefile b/tests/sys/geom/class/stripe/Makefile index 81a4e99..5659b5d 100644 --- a/tests/sys/geom/class/stripe/Makefile +++ b/tests/sys/geom/class/stripe/Makefile @@ -1,5 +1,7 @@ # $FreeBSD$ +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + TAP_TESTS_SH+= 1_test TAP_TESTS_SH+= 2_test @@ -7,4 +9,8 @@ FILES+= conf.sh FILESNAME_conf.sh= conf.sh FILESDIR= ${TESTSDIR} +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/stripe/conf.sh b/tests/sys/geom/class/stripe/conf.sh index fd0f41c..fd0f41c 100755..100644 --- a/tests/sys/geom/class/stripe/conf.sh +++ b/tests/sys/geom/class/stripe/conf.sh diff --git a/tests/sys/geom/class/uzip/1_test.sh b/tests/sys/geom/class/uzip/1_test.sh index 222b6c9..222b6c9 100755..100644 --- a/tests/sys/geom/class/uzip/1_test.sh +++ b/tests/sys/geom/class/uzip/1_test.sh diff --git a/tests/sys/geom/class/uzip/Makefile b/tests/sys/geom/class/uzip/Makefile index b4e1d7d..b962406 100644 --- a/tests/sys/geom/class/uzip/Makefile +++ b/tests/sys/geom/class/uzip/Makefile @@ -4,6 +4,8 @@ # Regression test for geom_uzip. # +TESTSDIR= ${TESTSBASE}/sys/geom/class/${.CURDIR:T} + IMAGE= 1.img ZIMAGE= ${IMAGE}.uzip UZIMAGE= ${ZIMAGE}.uue @@ -33,4 +35,8 @@ etalonDIR= ${TESTSDIR}/etalon TAP_TESTS_SH+= 1_test +.for t in ${TAP_TESTS_SH} +TEST_METADATA.$t+= required_user="root" +.endfor + .include <bsd.test.mk> diff --git a/tests/sys/geom/class/uzip/test-1.img.uzip.uue b/tests/sys/geom/class/uzip/test-1.img.uzip.uue new file mode 100644 index 0000000..ca16f47 --- /dev/null +++ b/tests/sys/geom/class/uzip/test-1.img.uzip.uue @@ -0,0 +1,110 @@ +# +# $FreeBSD$ +# + +begin 755 test-1.img.uzip +M(R$O8FEN+W-H"B-6,BXP($9O<FUA=`IM/6=E;VU?=7II<`HH:VQD<W1A="`M +M;2`D;2`R/B8M?'QK;&1L;V%D("1M*3XF+28F;6]U;G1?8V0Y-C8P("]D978O +M8&UD8V]N9FEG("UA9B`D,&`N=7II<"`D,0IE>&ET("0_"@```````$`````` +M0`````````*0`````````W<````````$F@````````AQ````````")@````` +M```(OP````````CF````````"0T````````)-`````````E;````````"8(` +M```````)J0````````G0````````"?<````````*'@````````I%```````` +M"FP````````*DP````````JZ````````"N$````````+"`````````LO```` +M````"U8````````+?0````````ND````````"\L````````+\@````````P9 +M````````#$`````````,9P````````R.````````#+4````````,W``````` +M``T#````````#2H````````-40````````UX````````#9\````````-Q@`` +M``````WM````````#A0````````..P````````YB````````#HD````````. +ML`````````[7````````#OX````````/)0````````],````````#W,````` +M```/F@````````_!````````#^@````````0#P```````!`V````````$%T` +M```````0A````````!"K````````$-(````````0^0```````!$@```````` +M$4<````````1;@```````!&5````````$<%XVNW4/0K",!3`\1>M$`3!42<[ +M>@1!AX)X`^_@X`VZZ.[%''1V]0+>0(@O[0OMZF`5^?_@-6GS2=L\$0`````` +M````````\"_&&A.-7&-NSX)Z7)=KR41N?1$GUD'OO18#Z[>*EWL(\@QAI-6A +MU.WQHL/J<;ZUF-8++7JM>V?5N-YN<]I7>\@LTGCK%Z.P]CA'J;%(<SDY\C7Q +M%6?OY>*;/SW_H;W97M*9*ZU<O#E-E0^D.9<Q+T@K9WQ48>>^8]YR7'QWX>"< +MUTV$F>7(?M,OY:9D.W6<"0```````````'3J!63?'NAXVNW9,4I#01#&\6^3 +M"*L@6&IE2@]@$=#B@7@#!6^@X`W2F-Z+6(BEM:6%UK9>P!L(ZTS>K"^"B"&8 +M6/Q_,&]W\W8W0\A.LU)KRV+;8FBQ%Y\5\_9\<*2!]-*7DF*"C;,U:S'OT!^O +MI>B]E$WK;JA][P];UJ[+ZEB_L:8W,T[1]>\[/[Z^G.8PB*CK8YY'$^]]C['% +MJ.Z5-!&P"H\YZREW__3A/\HM<JEG;ASM:,YMIO5`W;GTNJ"9FO&GFCCW2Y:C +MQOEO5ZY2RI9$V8T:V>_FU=I4G>PDS@0```````````"6[K2W_GFOE_R&[;M[ +M=?W^CN_&XM;BSN+>XB))^Q9G%I.%,BU?1ROS<Y9^Z_<PUPH````````````` +M`!;S`6\CL0=XVNV:SVXC-1S'TS^PE<6!`T>0?MFN%A8EF:;+BI(]H"1M04NE +M2FW%BA-X,IX9MYYQ9'LZS=[V`1`OP0-PV$=`W+ARX@&X\`A(_.Q)2:A8@50J +M0??WD:9V//[Y:W]_GLETVE;KU>:WX5I366V*7W]\//;E#]^\/5PN'UQ39SY\ +MZY>UYECHK_ZE_HNY[F79N2'];Y^OA+)<;S[_--?_[HK^^]?47W^)_HNY_CNM +M/^L??MWH7I;=&UK_I?[]O]'OW;!^]XK^U?Q'-Z1/$`1!$`1!$`1!$`1!$`1! +M$`1!$,3MP?]=\!D>.V0%0;R2U_\;K?65WJ*^VL,/:TU];?SY<?C?C9]7-IAP +M7.FRYRX<^480MX%-M@GW]HT0H^/=`5@SB9S6RD9&9$98*W4994(77U;/Y#1J +M;@#1XC[0.8=^KP_;6UL?1%L[4?\A;'TT>/1P\&@;TE,M8.]B"O?8)F-/AJ/1 +MWM'3P_%G7S!V(&II8<R-T4JQ]U*C"SC)C:ZR'%PNX$#K,UEFW4\4MQ9XF<#3 +MG#L8*CD1L*\K;#C)A1$=Z.]\N/V`L:].:FXA-E(IF75"A!_'*NGR&3A]+BS; +ME0ED,R/"V4P6L1(@R]"OYK$8L*%24,C"SJ#&L<.)6!N=^>@.&\['+'0AP'"7 +M6]"5RPR&]AB[.Q(UGP<]X7$L3*TG9QTH9F!UV68X73CEM<4.N)!8.IR[[SM1 +M?S1.N)OD;;8\4!6?5C'V-DFS)IM791@J-54A=65AA,W"V#+$WF7L4XQ$\R!' +M?\^UF7(%MM8F\2O-L>^`'>@R`R>+1J+@Y85?4(JY\H;Y%#CH=MFQ!DR_$XEO +MCF>A\TE5N*H`AYNE\<.B5@*\SN6EER$>_<"S.&7K&ZLTE3:_/!=4?%@G+&39 +MJQJ3!6(FT-@44L4+5!GC3\#QTU1)/^^E3>(JE0G,51C+SR:N#.8T";+>SD*T +M&3LLO=.U;L.BUJ2R&8DOZF%"<]-BQ1,4%J4#6\K)F3!=-'ERUO8.*Y$Z+Y$( +M/D],F+IT%E?'$]\E1&9<5<4T]Q./,=9OD^!+SFVP`_<GG^_`A0\?L[%/B--^ +M[W!3V+")8L$+[V*L9VUVB/GG\:G/?\)G;;R0E-(Z;RK8\*Z?P237QGD[?.9Q +M-YSJ6>]?N5`>7^="H?LM0?R76'O)\_]K6'^SM;%^I'5XVG\=C[=:&^Q(3+65 +M3IM9JW4'V[Y?V;BS5SHCA24S">)_QD!<N$$Y.;?=%)_K8IL,HAR_N2/?1%_7 +M!'&[^4>_\=.-@"!N)4LO\Z)^KQ_M&PG#*H/E5WGA]5[$=NDV0!"WB]\!34_J +M#GC:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q +M`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@ +M]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@ +M````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````` +M````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````` +M````@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<! +M0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C: +M[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0`` +M`,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M +M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```` +M````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````` +M````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````````` +M@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0``` +M`7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q +M`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@ +M]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@ +M````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````` +M````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````` +M````@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<! +M0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C: +M[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0`` +M`,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M +M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```` +M````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````` +M````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````````` +M@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0``` +M`7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q +M`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@ +M]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@ +M````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````` +M````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````` +M````@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<! +M0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C: +M[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0`` +M`,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M +M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```` +M````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````` +M````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````````` +M@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0``` +M`7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q +M`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@ +M]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@ +M````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````` +M````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````` +M````@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<! +M0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C: +M[<$Q`0```,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0`` +M`,*@]4]M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M +M#!^@````````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```` +M````````````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````` +M````````@+<!0````7C:[<$Q`0```,*@]4]M#!^@```````````````````` +M@+<!0````7C:[<$Q`0```,*@]4]M#!^@````````````````````@+<!0``` +M`7C:[=`Q`0``#`(@HQO="GOV0002````````````````````>%$%=P/6@`"! +M```````````````````````````````````````````````````````````` +2```````````````````````` +` +end diff --git a/sbin/geom/core/tests/ConfCmp/ConfCmp.c b/tools/regression/geom/ConfCmp/ConfCmp.c index 161b5cc..599a953b 100644 --- a/sbin/geom/core/tests/ConfCmp/ConfCmp.c +++ b/tools/regression/geom/ConfCmp/ConfCmp.c @@ -190,7 +190,7 @@ dofile(char *filename) XML_SetCharacterDataHandler(parser, CharData); fd = open(filename, O_RDONLY); if (fd < 0) - err(1, "%s", filename); + err(1, filename); fstat(fd, &st); p = mmap(NULL, st.st_size, PROT_READ, MAP_NOCORE|MAP_PRIVATE, fd, 0); i = XML_Parse(parser, p, st.st_size, 1); @@ -217,7 +217,6 @@ print_node(struct node *np) printf("\n"); } -#if 0 static void print_tree(struct node *np, int n) { @@ -227,7 +226,6 @@ print_tree(struct node *np, int n) LIST_FOREACH(np1, &np->children, siblings) print_tree(np1, n + 2); } -#endif static void sort_node(struct node *np) diff --git a/tools/regression/geom/ConfCmp/Makefile b/tools/regression/geom/ConfCmp/Makefile new file mode 100644 index 0000000..c34cf65 --- /dev/null +++ b/tools/regression/geom/ConfCmp/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD$ + +PROG= ConfCmp +SRCS+= ConfCmp.c +SRCS+= subr_sbuf.c + +.PATH: ../../../../sys/kern + +NO_OBJ= +WARNS?= 5 +CFLAGS+= -g -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -static +# Uncomment for ElectricFence +#LDADD += -lefence -L/usr/local/lib + +LIBADD= bsdxml + +MAN= +CLEANFILES += _* + +.include <bsd.prog.mk> + +test: ${PROG} + rm -f _* *.core + ./${PROG} a1.conf a1.conf + ./${PROG} a1.conf a1a.conf + if ./${PROG} a1.conf a1b.conf > /dev/null 2>&1 ; then exit 1 ; fi + if ./${PROG} a1.conf a1c.conf > /dev/null 2>&1 ; then exit 1 ; fi + if ./${PROG} a1.conf a1d.conf > /dev/null 2>&1 ; then exit 1 ; fi + ./${PROG} a2.conf a2.conf + ./${PROG} a2.conf a2a.conf + if ./${PROG} a2.conf a2b.conf > /dev/null 2>&1 ; then exit 1 ; fi + if ./${PROG} a2.conf a2c.conf > /dev/null 2>&1 ; then exit 1 ; fi + if ./${PROG} a2.conf a2d.conf > /dev/null 2>&1 ; then exit 1 ; fi + diff --git a/sbin/geom/core/tests/ConfCmp/a1.conf b/tools/regression/geom/ConfCmp/a1.conf index 94171cd..94171cd 100644 --- a/sbin/geom/core/tests/ConfCmp/a1.conf +++ b/tools/regression/geom/ConfCmp/a1.conf diff --git a/sbin/geom/core/tests/ConfCmp/a1a.conf b/tools/regression/geom/ConfCmp/a1a.conf index 01110f3..01110f3 100644 --- a/sbin/geom/core/tests/ConfCmp/a1a.conf +++ b/tools/regression/geom/ConfCmp/a1a.conf diff --git a/sbin/geom/core/tests/ConfCmp/a1b.conf b/tools/regression/geom/ConfCmp/a1b.conf index 46f423b..46f423b 100644 --- a/sbin/geom/core/tests/ConfCmp/a1b.conf +++ b/tools/regression/geom/ConfCmp/a1b.conf diff --git a/sbin/geom/core/tests/ConfCmp/a1c.conf b/tools/regression/geom/ConfCmp/a1c.conf index 1b5a2b9..1b5a2b9 100644 --- a/sbin/geom/core/tests/ConfCmp/a1c.conf +++ b/tools/regression/geom/ConfCmp/a1c.conf diff --git a/sbin/geom/core/tests/ConfCmp/a1d.conf b/tools/regression/geom/ConfCmp/a1d.conf index a9063c5..a9063c5 100644 --- a/sbin/geom/core/tests/ConfCmp/a1d.conf +++ b/tools/regression/geom/ConfCmp/a1d.conf diff --git a/sbin/geom/core/tests/ConfCmp/a2.conf b/tools/regression/geom/ConfCmp/a2.conf index 6688fd1..6688fd1 100644 --- a/sbin/geom/core/tests/ConfCmp/a2.conf +++ b/tools/regression/geom/ConfCmp/a2.conf diff --git a/sbin/geom/core/tests/ConfCmp/a2a.conf b/tools/regression/geom/ConfCmp/a2a.conf index 3d35fe9..3d35fe9 100644 --- a/sbin/geom/core/tests/ConfCmp/a2a.conf +++ b/tools/regression/geom/ConfCmp/a2a.conf diff --git a/sbin/geom/core/tests/ConfCmp/a2b.conf b/tools/regression/geom/ConfCmp/a2b.conf index 58c0e15..58c0e15 100644 --- a/sbin/geom/core/tests/ConfCmp/a2b.conf +++ b/tools/regression/geom/ConfCmp/a2b.conf diff --git a/sbin/geom/core/tests/ConfCmp/a2c.conf b/tools/regression/geom/ConfCmp/a2c.conf index 381c410..381c410 100644 --- a/sbin/geom/core/tests/ConfCmp/a2c.conf +++ b/tools/regression/geom/ConfCmp/a2c.conf diff --git a/sbin/geom/core/tests/ConfCmp/a2d.conf b/tools/regression/geom/ConfCmp/a2d.conf index bccaed5..bccaed5 100644 --- a/sbin/geom/core/tests/ConfCmp/a2d.conf +++ b/tools/regression/geom/ConfCmp/a2d.conf diff --git a/sbin/geom/core/tests/Data/disk.alpha.da0.xml b/tools/regression/geom/Data/disk.alpha.da0.xml index 670fcc3..670fcc3 100644 --- a/sbin/geom/core/tests/Data/disk.alpha.da0.xml +++ b/tools/regression/geom/Data/disk.alpha.da0.xml diff --git a/sbin/geom/core/tests/Data/disk.alpha2.da0.xml b/tools/regression/geom/Data/disk.alpha2.da0.xml index 5b341b1..5b341b1 100644 --- a/sbin/geom/core/tests/Data/disk.alpha2.da0.xml +++ b/tools/regression/geom/Data/disk.alpha2.da0.xml diff --git a/sbin/geom/core/tests/Data/disk.apple.xml b/tools/regression/geom/Data/disk.apple.xml index ecdd523..ecdd523 100644 --- a/sbin/geom/core/tests/Data/disk.apple.xml +++ b/tools/regression/geom/Data/disk.apple.xml diff --git a/sbin/geom/core/tests/Data/disk.beast.da0.xml b/tools/regression/geom/Data/disk.beast.da0.xml index 96ad5f7..96ad5f7 100644 --- a/sbin/geom/core/tests/Data/disk.beast.da0.xml +++ b/tools/regression/geom/Data/disk.beast.da0.xml diff --git a/sbin/geom/core/tests/Data/disk.critter.ad0.xml b/tools/regression/geom/Data/disk.critter.ad0.xml index 9e93b24..9e93b24 100644 --- a/sbin/geom/core/tests/Data/disk.critter.ad0.xml +++ b/tools/regression/geom/Data/disk.critter.ad0.xml diff --git a/sbin/geom/core/tests/Data/disk.empty.flp.xml b/tools/regression/geom/Data/disk.empty.flp.xml index 88c603a..88c603a 100644 --- a/sbin/geom/core/tests/Data/disk.empty.flp.xml +++ b/tools/regression/geom/Data/disk.empty.flp.xml diff --git a/sbin/geom/core/tests/Data/disk.far.ad0.xml b/tools/regression/geom/Data/disk.far.ad0.xml index 0a8d3ca..0a8d3ca 100644 --- a/sbin/geom/core/tests/Data/disk.far.ad0.xml +++ b/tools/regression/geom/Data/disk.far.ad0.xml diff --git a/sbin/geom/core/tests/Data/disk.flat.da1.xml b/tools/regression/geom/Data/disk.flat.da1.xml index 2302a7c..2302a7c 100644 --- a/sbin/geom/core/tests/Data/disk.flat.da1.xml +++ b/tools/regression/geom/Data/disk.flat.da1.xml diff --git a/sbin/geom/core/tests/Data/disk.kern.flp.xml b/tools/regression/geom/Data/disk.kern.flp.xml index 6640c48..6640c48 100644 --- a/sbin/geom/core/tests/Data/disk.kern.flp.xml +++ b/tools/regression/geom/Data/disk.kern.flp.xml diff --git a/sbin/geom/core/tests/Data/disk.msdos.ext.xml b/tools/regression/geom/Data/disk.msdos.ext.xml index 868a88f7..868a88f7 100644 --- a/sbin/geom/core/tests/Data/disk.msdos.ext.xml +++ b/tools/regression/geom/Data/disk.msdos.ext.xml diff --git a/sbin/geom/core/tests/Data/disk.msdos.flp.xml b/tools/regression/geom/Data/disk.msdos.flp.xml index d057d1a..d057d1a 100644 --- a/sbin/geom/core/tests/Data/disk.msdos.flp.xml +++ b/tools/regression/geom/Data/disk.msdos.flp.xml diff --git a/sbin/geom/core/tests/Data/disk.pc98.wdc0.xml b/tools/regression/geom/Data/disk.pc98.wdc0.xml index 6bae97f..6bae97f 100644 --- a/sbin/geom/core/tests/Data/disk.pc98.wdc0.xml +++ b/tools/regression/geom/Data/disk.pc98.wdc0.xml diff --git a/sbin/geom/core/tests/Data/disk.sun.da0.xml b/tools/regression/geom/Data/disk.sun.da0.xml index 826581f..826581f 100644 --- a/sbin/geom/core/tests/Data/disk.sun.da0.xml +++ b/tools/regression/geom/Data/disk.sun.da0.xml diff --git a/sbin/geom/core/tests/Data/disk.sun.da1.xml b/tools/regression/geom/Data/disk.sun.da1.xml index 0aac8e5..0aac8e5 100644 --- a/sbin/geom/core/tests/Data/disk.sun.da1.xml +++ b/tools/regression/geom/Data/disk.sun.da1.xml diff --git a/sbin/geom/core/tests/Data/disk.typo.ad0.xml b/tools/regression/geom/Data/disk.typo.ad0.xml index 56383ab..56383ab 100644 --- a/sbin/geom/core/tests/Data/disk.typo.ad0.xml +++ b/tools/regression/geom/Data/disk.typo.ad0.xml diff --git a/tools/regression/geom/MdLoad/Makefile b/tools/regression/geom/MdLoad/Makefile new file mode 100644 index 0000000..4804f97 --- /dev/null +++ b/tools/regression/geom/MdLoad/Makefile @@ -0,0 +1,13 @@ +# $FreeBSD$ + +PROG= MdLoad +LIBADD= sbuf bsdxml + +MAN= + + +WARNS?= 4 +.include "bsd.prog.mk" + +test: ${PROG} + ./${PROG} md34 ../Data/disk.critter.ad0.xml diff --git a/sbin/geom/core/tests/MdLoad/MdLoad.c b/tools/regression/geom/MdLoad/MdLoad.c index a7238aaa..33ee4de 100644 --- a/sbin/geom/core/tests/MdLoad/MdLoad.c +++ b/tools/regression/geom/MdLoad/MdLoad.c @@ -35,23 +35,22 @@ * $FreeBSD$ */ -#include <sys/types.h> -#include <sys/mman.h> -#include <sys/queue.h> -#include <sys/sbuf.h> -#include <sys/stat.h> -#include <ctype.h> -#include <err.h> -#include <errno.h> -#include <fcntl.h> -#include <paths.h> -#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <stdint.h> #include <string.h> - +#include <ctype.h> +#include <errno.h> +#include <paths.h> +#include <fcntl.h> +#include <err.h> #include <bsdxml.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/queue.h> +#include <sys/sbuf.h> +#include <sys/mman.h> struct sector { LIST_ENTRY(sector) sectors; @@ -217,12 +216,9 @@ g_simdisk_xml_load(const char *file) fd = open(file, O_RDONLY); if (fd < 0) - err(1, "%s: opening %s failed", __func__, file); - if (fstat(fd, &st) == -1) - err(1, "%s: fstat'ing %s failed", __func__, file); + err(1, file); + fstat(fd, &st); p = mmap(NULL, st.st_size, PROT_READ, MAP_NOCORE|MAP_PRIVATE, fd, 0); - if (p == MAP_FAILED) - err(1, "%s: mmap'ing %s failed", __func__, file); i = XML_Parse(parser, p, st.st_size, 1); if (i != 1) errx(1, "XML_Parse complains: return %d", i); @@ -256,7 +252,7 @@ main(int argc, char **argv) sprintf(buf + strlen(buf), " -u %s", argv[1]); error = system(buf); if (error) - err(1, "calling `%s` failed; status=%d", buf, error); + return (error); fd = open(argv[1], O_RDWR); if (fd < 0 && errno == ENOENT) { sprintf(buf, "%s%s", _PATH_DEV, argv[1]); diff --git a/tools/regression/geom/Ref/disk.alpha.da0.xml b/tools/regression/geom/Ref/disk.alpha.da0.xml new file mode 100644 index 0000000..a300f0d --- /dev/null +++ b/tools/regression/geom/Ref/disk.alpha.da0.xml @@ -0,0 +1,7 @@ +$FreeBSD$ +/dev/md34 512 5120 10 +/dev/md34a 512 251658240 491520 +/dev/md34b 512 1086291968 2121664 +/dev/md34c 512 18309995520 35761710 +/dev/md34e 512 20971520 40960 +/dev/md34f 512 16951073792 33107566 diff --git a/tools/regression/geom/Ref/disk.alpha2.da0.xml b/tools/regression/geom/Ref/disk.alpha2.da0.xml new file mode 100644 index 0000000..7ef7573 --- /dev/null +++ b/tools/regression/geom/Ref/disk.alpha2.da0.xml @@ -0,0 +1,5 @@ +$FreeBSD$ +/dev/md34 512 5120 10 +/dev/md34a 512 24675840 48195 +/dev/md34b 512 4178442240 8161020 +/dev/md34c 512 74027520 144585 diff --git a/tools/regression/geom/Ref/disk.apple.xml b/tools/regression/geom/Ref/disk.apple.xml new file mode 100644 index 0000000..a2a0f98 --- /dev/null +++ b/tools/regression/geom/Ref/disk.apple.xml @@ -0,0 +1,5 @@ +$FreeBSD$ +/dev/md34 512 366530560 715880 +/dev/md34s1 512 366481408 715784 +/dev/md34s2 512 32256 63 +/dev/md34s3 512 16384 32 diff --git a/tools/regression/geom/Ref/disk.beast.da0.xml b/tools/regression/geom/Ref/disk.beast.da0.xml new file mode 100644 index 0000000..b6aa32e --- /dev/null +++ b/tools/regression/geom/Ref/disk.beast.da0.xml @@ -0,0 +1,5 @@ +$FreeBSD$ +/dev/md34 512 5120 10 +/dev/md34a 512 4064280576 7938048 +/dev/md34b 512 270925824 529152 +/dev/md34c 512 4335206400 8467200 diff --git a/tools/regression/geom/Ref/disk.critter.ad0.xml b/tools/regression/geom/Ref/disk.critter.ad0.xml new file mode 100644 index 0000000..0620bfe --- /dev/null +++ b/tools/regression/geom/Ref/disk.critter.ad0.xml @@ -0,0 +1,11 @@ +$FreeBSD$ +/dev/md34 512 2671841280 5218440 +/dev/md34s1 512 20003848704 39070017 +/dev/md34s1a 512 1073741824 2097152 +/dev/md34s1b 512 1073741824 2097152 +/dev/md34s1c 512 20003848704 39070017 +/dev/md34s1d 512 4447175168 8685889 +/dev/md34s1e 512 524288000 1024000 +/dev/md34s1f 512 4294967296 8388608 +/dev/md34s1g 512 3221225472 6291456 +/dev/md34s1h 512 5368709120 10485760 diff --git a/tools/regression/geom/Ref/disk.empty.flp.xml b/tools/regression/geom/Ref/disk.empty.flp.xml new file mode 100644 index 0000000..659b416 --- /dev/null +++ b/tools/regression/geom/Ref/disk.empty.flp.xml @@ -0,0 +1,2 @@ +$FreeBSD$ +/dev/md34 512 1474560 2880 80 2 18 diff --git a/tools/regression/geom/Ref/disk.far.ad0.xml b/tools/regression/geom/Ref/disk.far.ad0.xml new file mode 100644 index 0000000..629816a --- /dev/null +++ b/tools/regression/geom/Ref/disk.far.ad0.xml @@ -0,0 +1,4 @@ +$FreeBSD$ +/dev/md34 512 5632 11 +/dev/md34s1 512 296821760 579730 +/dev/md34s2 512 4564740096 8915508 diff --git a/tools/regression/geom/Ref/disk.flat.da1.xml b/tools/regression/geom/Ref/disk.flat.da1.xml new file mode 100644 index 0000000..89e2df4 --- /dev/null +++ b/tools/regression/geom/Ref/disk.flat.da1.xml @@ -0,0 +1,12 @@ +$FreeBSD$ +/dev/md34 512 37888 74 +/dev/md34a 512 37748736 73728 +/dev/md34b 512 268435456 524288 +/dev/md34c 512 8422686720 16450560 +/dev/md34h 512 8115978240 15851520 +/dev/md34s1 512 18367017984 35873082 +/dev/md34s1b 512 419430400 819200 +/dev/md34s1c 512 18367017984 35873082 +/dev/md34s1e 512 419430400 819200 +/dev/md34s1f 512 1073741824 2097152 +/dev/md34s1g 512 16454415360 32137530 diff --git a/tools/regression/geom/Ref/disk.kern.flp.xml b/tools/regression/geom/Ref/disk.kern.flp.xml new file mode 100644 index 0000000..6ff67a0 --- /dev/null +++ b/tools/regression/geom/Ref/disk.kern.flp.xml @@ -0,0 +1,5 @@ +$FreeBSD$ +/dev/md34 512 5632 11 +/dev/md34a 512 1474560 2880 +/dev/md34b 512 1474560 2880 +/dev/md34c 512 1474560 2880 diff --git a/tools/regression/geom/Ref/disk.msdos.ext.xml b/tools/regression/geom/Ref/disk.msdos.ext.xml new file mode 100644 index 0000000..dc2aced --- /dev/null +++ b/tools/regression/geom/Ref/disk.msdos.ext.xml @@ -0,0 +1,27 @@ +$FreeBSD$ +/dev/md34 512 2327759360 4546405 +/dev/md34s1 512 2146765824 4192902 +/dev/md34s10 512 8193024 16002 +/dev/md34s11 512 8193024 16002 +/dev/md34s12 512 8193024 16002 +/dev/md34s13 512 8193024 16002 +/dev/md34s14 512 8193024 16002 +/dev/md34s15 512 8193024 16002 +/dev/md34s16 512 8193024 16002 +/dev/md34s17 512 8193024 16002 +/dev/md34s18 512 8193024 16002 +/dev/md34s19 512 8193024 16002 +/dev/md34s2 512 427714560 835380 +/dev/md34s20 512 8193024 16002 +/dev/md34s21 512 8193024 16002 +/dev/md34s22 512 8193024 16002 +/dev/md34s23 512 8193024 16002 +/dev/md34s24 512 8193024 16002 +/dev/md34s25 512 8193024 16002 +/dev/md34s26 512 8193024 16002 +/dev/md34s27 512 8193024 16002 +/dev/md34s5 512 8193024 16002 +/dev/md34s6 512 8193024 16002 +/dev/md34s7 512 8193024 16002 +/dev/md34s8 512 8193024 16002 +/dev/md34s9 512 8193024 16002 diff --git a/tools/regression/geom/Ref/disk.msdos.flp.xml b/tools/regression/geom/Ref/disk.msdos.flp.xml new file mode 100644 index 0000000..c176c58 --- /dev/null +++ b/tools/regression/geom/Ref/disk.msdos.flp.xml @@ -0,0 +1,2 @@ +$FreeBSD$ +/dev/md34 512 5632 11 diff --git a/tools/regression/geom/Ref/disk.pc98.wdc0.xml b/tools/regression/geom/Ref/disk.pc98.wdc0.xml new file mode 100644 index 0000000..5ffb0c9 --- /dev/null +++ b/tools/regression/geom/Ref/disk.pc98.wdc0.xml @@ -0,0 +1,8 @@ +$FreeBSD$ +/dev/md34 512 75264 147 1 8 17 +/dev/md34s1 512 1626603520 3176960 23360 8 17 +/dev/md34s1a 512 78643200 153600 1129 8 17 +/dev/md34s1b 512 104857600 204800 1505 8 17 +/dev/md34s1c 512 1626603520 3176960 23360 8 17 +/dev/md34s1e 512 52428800 102400 752 8 17 +/dev/md34s1f 512 1390673920 2716160 19971 8 17 diff --git a/tools/regression/geom/Ref/disk.sun.da0.xml b/tools/regression/geom/Ref/disk.sun.da0.xml new file mode 100644 index 0000000..15b97c8 --- /dev/null +++ b/tools/regression/geom/Ref/disk.sun.da0.xml @@ -0,0 +1,6 @@ +$FreeBSD$ +/dev/md34 512 5120 10 +/dev/md34a 512 1529708544 2987712 +/dev/md34b 512 539320320 1053360 +/dev/md34c 512 36698296320 71676360 +/dev/md34h 512 34629267456 67635288 diff --git a/tools/regression/geom/Ref/disk.sun.da1.xml b/tools/regression/geom/Ref/disk.sun.da1.xml new file mode 100644 index 0000000..004771b --- /dev/null +++ b/tools/regression/geom/Ref/disk.sun.da1.xml @@ -0,0 +1,9 @@ +$FreeBSD$ +/dev/md34 512 5120 10 +/dev/md34a 512 262967296 513608 +/dev/md34b 512 1075994624 2101552 +/dev/md34c 512 18108555264 35368272 +/dev/md34d 512 11124240384 21727032 +/dev/md34f 512 2149576704 4198392 +/dev/md34g 512 2149576704 4198392 +/dev/md34h 512 1343787008 2624584 diff --git a/tools/regression/geom/Ref/disk.typo.ad0.xml b/tools/regression/geom/Ref/disk.typo.ad0.xml new file mode 100644 index 0000000..6d537dd --- /dev/null +++ b/tools/regression/geom/Ref/disk.typo.ad0.xml @@ -0,0 +1,14 @@ +$FreeBSD$ +/dev/md34 512 8585262592 16768091 +/dev/md34s1 512 3220406784 6289857 +/dev/md34s1a 512 104857600 204800 +/dev/md34s1b 512 524288000 1024000 +/dev/md34s1c 512 3220406784 6289857 +/dev/md34s1e 512 524288000 1024000 +/dev/md34s1f 512 2066973184 4037057 +/dev/md34s2 512 5364817920 10478160 +/dev/md34s2c 512 5364817920 10478160 +/dev/md34s3 512 8585256960 16768080 +/dev/md34s3a 512 2097152000 4096000 +/dev/md34s3c 512 8585256960 16768080 +/dev/md34s3d 512 6488104960 12672080 diff --git a/tools/regression/geom/RunTest.sh b/tools/regression/geom/RunTest.sh new file mode 100644 index 0000000..46a14b4 --- /dev/null +++ b/tools/regression/geom/RunTest.sh @@ -0,0 +1,44 @@ +#!/bin/sh +# $FreeBSD$ + +MD=34 +TMP=/tmp/$$ + +set -e + +r=0 + +(cd MdLoad && make) > /dev/null 2>&1 + +for f in Data/disk.*.xml +do + b=`basename $f` + mdconfig -d -u $MD > /dev/null 2>&1 || true + if [ -c /dev/md$MD ] ; then + sleep 1 + fi + if [ -c /dev/md$MD ] ; then + sleep 1 + fi + if [ -c /dev/md$MD ] ; then + echo "/dev/md$MD is busy" 1>&2 + exit 1 + fi + MdLoad/MdLoad md${MD} $f + if [ -f Ref/$b ] ; then + if diskinfo /dev/md${MD}* | + diff -I '$FreeBSD' -u Ref/$b - > $TMP; then + echo "PASSED: $b" + else + echo "FAILED: $b" + sed 's/^/ /' $TMP + r=2; + fi + else + diskinfo /dev/md${MD}* > Ref/`basename $f` + fi +done + +mdconfig -d -u $MD > /dev/null 2>&1 || true +rm -f $TMP +exit $r diff --git a/tools/regression/geom/RunTest.t b/tools/regression/geom/RunTest.t new file mode 100644 index 0000000..96a3530 --- /dev/null +++ b/tools/regression/geom/RunTest.t @@ -0,0 +1,50 @@ +#!/bin/sh +# $FreeBSD$ + +MD=34 +TMP=/tmp/$$ + +set -e + +# Start from the right directory so we can find all our data files. +cd `dirname $0` + +(cd MdLoad && make) > /dev/null 2>&1 + +# Print the test header +echo -n '1..' +echo `ls -1 Data/disk.*.xml | wc -l` + +for f in Data/disk.*.xml +do + b=`basename $f` + mdconfig -d -u $MD > /dev/null 2>&1 || true + if [ -c /dev/md$MD ] ; then + sleep 1 + fi + if [ -c /dev/md$MD ] ; then + sleep 1 + fi + if [ -c /dev/md$MD ] ; then + echo "Bail out!" + echo "/dev/md$MD is busy" + exit 1 + fi + MdLoad/MdLoad md${MD} $f + if [ -f Ref/$b ] ; then + if diskinfo /dev/md${MD}* | + diff -I '$FreeBSD' -u Ref/$b - > $TMP; then + echo "ok - $b" + else + echo "not ok - $b" + sed 's/^/# /' $TMP + fi + else + diskinfo /dev/md${MD}* > Ref/`basename $f` + fi +done + +mdconfig -d -u $MD > /dev/null 2>&1 || true +rm -f $TMP + +exit 0 diff --git a/tests/sys/geom/class/gpt/gctl_test.pl b/tools/regression/geom_gpt/gctl.t index 0f30805..f99e6d8 100755..100644 --- a/tests/sys/geom/class/gpt/gctl_test.pl +++ b/tools/regression/geom_gpt/gctl.t @@ -29,12 +29,10 @@ my $srcdir = `dirname $0`; chomp $srcdir; -my $tmpdir = $ENV{TMPDIR} || "/tmp"; - -my $cmd = "$srcdir/gctl"; +my $cmd = "/tmp/gctl-$$"; my $out = "$cmd.out"; -my $disk = "$tmpdir/disk-$$"; -my $mntpt = "$tmpdir/mount-$$"; +my $disk = "/tmp/disk-$$"; +my $mntpt = "/tmp/mount-$$"; my %steps = ( "000" => "gctl", @@ -133,6 +131,13 @@ if (exists $ENV{'TEST_VERBOSE'}) { $verbose = "-v"; } +# Compile the driver... +my $st = system("cc -o $cmd -g $srcdir/test.c -lgeom"); +if ($st != 0) { + print "1..0 # SKIP error compiling test.c\n"; + exit 0; +} + # Make sure we have permission to use gctl... if (`$cmd` =~ "^FAIL Permission denied") { print "1..0 # SKIP not enough permission\n"; diff --git a/tests/sys/geom/class/gpt/gctl.c b/tools/regression/geom_gpt/test.c index 136a616..d750d30 100644 --- a/tests/sys/geom/class/gpt/gctl.c +++ b/tools/regression/geom_gpt/test.c @@ -29,14 +29,13 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <errno.h> +#include <libgeom.h> #include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <libgeom.h> - struct retval { struct retval *retval; const char *param; |