summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-04-18 10:18:24 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-04-18 10:18:24 +0000
commitc79c3c559fefedf65b52c6929159c2d38cc92712 (patch)
tree707d0009c717498841402f519bae6c70c9f40f41 /regress
parentd8016119426fcf1460cf025b746ce5151f9e0037 (diff)
some newfs checks, not hooked in, because it needs certain disktab
entries which are not available on all platforms
Diffstat (limited to 'regress')
-rw-r--r--regress/sbin/newfs/Makefile6
-rw-r--r--regress/sbin/newfs/checknewfs49
2 files changed, 55 insertions, 0 deletions
diff --git a/regress/sbin/newfs/Makefile b/regress/sbin/newfs/Makefile
new file mode 100644
index 00000000000..56565f660c5
--- /dev/null
+++ b/regress/sbin/newfs/Makefile
@@ -0,0 +1,6 @@
+# $OpenBSD: Makefile,v 1.1 2007/04/18 10:18:23 otto Exp $
+#
+# Regress tests for newfs
+
+all:
+ sh checknewfs
diff --git a/regress/sbin/newfs/checknewfs b/regress/sbin/newfs/checknewfs
new file mode 100644
index 00000000000..fd95b2dccf1
--- /dev/null
+++ b/regress/sbin/newfs/checknewfs
@@ -0,0 +1,49 @@
+#!/bin/ksh
+# $OpenBSD: checknewfs,v 1.1 2007/04/18 10:18:23 otto Exp $
+# Written by Otto Moerbeek, 2007, Public domain
+
+
+cleanup() {
+ vnconfig -u svnd0
+ rm -f $image
+}
+
+trap 'cleanup' INT
+
+dotest() {
+ image=$(mktemp -t imageXXXXXXXXXX);
+ dd if=/dev/prandom of=$image bs=512 count=$1 2>/dev/null &&
+ vnconfig svnd0 $image &&
+ disklabel -w -r svnd0 $2 &&
+ newfs $3 /dev/rsvnd0a &&
+ fsck -nf /dev/svnd0a | fgrep SALVAGE
+ if [ $? == 0 ]; then
+ ret=$(($ret + 1))
+ echo TEST $1 $2 \"$3\" failed
+ else
+ echo TEST $1 $2 \"$3\" OK
+ fi
+ echo ==========================
+ if [ $clean = 1 ]; then
+ cleanup
+ fi
+}
+
+ret=0
+
+vnconfig -u svnd0 > /dev/null 2>&1
+if [ $# == 0 ]; then
+ clean=1
+ dotest 3800 rdroot "-m 0 -o space -i 4096"
+ dotest 5760 floppy288 "-m 0 -o space -i 81920 -c 5760"
+ dotest 5760 floppy288 "-m 0 -o space -i 81920 -c 5752"
+ dotest 5760 floppy288 "-m 0 -o space -i 524288 -c 5760"
+ dotest 5760 floppy288 "-m 0 -o space -i 524288 -c 5761"
+ dotest 2880 floppy3 "-m 0 -o space -i 81920"
+ dotest 2880 floppy3 "-m 0 -o space -i 81920 -c 2880"
+else
+ clean=0
+ dotest "${@}"
+fi
+
+exit $ret