diff options
author | phk <phk@FreeBSD.org> | 2003-04-21 20:16:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-04-21 20:16:07 +0000 |
commit | 38d3139e70ccbe703e3910e7d64cd0c06dfd00f9 (patch) | |
tree | 096b28bee03ae2465fd296b2da3094659d1ff6f6 /sbin/sunlabel | |
parent | c99d9e1424a0640ddf1ee43a1094517ddabc00cc (diff) | |
download | FreeBSD-src-38d3139e70ccbe703e3910e7d64cd0c06dfd00f9.zip FreeBSD-src-38d3139e70ccbe703e3910e7d64cd0c06dfd00f9.tar.gz |
Add minimal regression test for hotspot handling of the sunlabel.
Diffstat (limited to 'sbin/sunlabel')
-rw-r--r-- | sbin/sunlabel/runtest.sh | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/sbin/sunlabel/runtest.sh b/sbin/sunlabel/runtest.sh new file mode 100644 index 0000000..d6ba1a5 --- /dev/null +++ b/sbin/sunlabel/runtest.sh @@ -0,0 +1,114 @@ +#!/bin/sh +# $FreeBSD$ + +TMP=/tmp/$$. +set -e +MD=`mdconfig -a -t malloc -s 2m` +trap "exec 7</dev/null; rm -f ${TMP}* ; mdconfig -d -u ${MD}" EXIT INT TERM + +./sunlabel -w $MD auto + +dd if=/dev/$MD of=${TMP}i0 count=16 > /dev/null 2>&1 +./sunlabel $MD > ${TMP}l0 + +sed ' +/ c:/{ +p +s/c:/a:/ +s/3969/1024/ +} +' ${TMP}l0 > ${TMP}l1 + +./sunlabel -R $MD ${TMP}l1 +dd if=/dev/$MD of=${TMP}i1 count=16 > /dev/null 2>&1 +sed ' +/ c:/{ +p +s/c:/a:/ +s/3969/2048/ +} +' ${TMP}l0 > ${TMP}l2 + +./sunlabel -R $MD ${TMP}l2 +dd if=/dev/$MD of=${TMP}i2 count=16 > /dev/null 2>&1 + +exec 7< /dev/${MD}a + +for t in a c +do + if dd if=${TMP}i2 of=/dev/${MD}$t 2>/dev/null ; then + echo "PASS: Could rewrite same label to ...$t while ...a open" 1>&2 + else + echo "FAIL: Could not rewrite same label to ...$t while ...a open" 1>&2 + exit 2 + fi + + if dd if=${TMP}i1 of=/dev/${MD}$t 2>/dev/null ; then + echo "FAIL: Could label with smaller ...a to ...$t while ...a open" 1>&2 + exit 2 + else + echo "PASS: Could not label with smaller ...a to ...$t while ...a open" 1>&2 + fi + + if dd if=${TMP}i0 of=/dev/${MD}$t 2>/dev/null ; then + echo "FAIL: Could write label missing ...a to ...$t while ...a open" 1>&2 + exit 2 + else + echo "PASS: Could not write label missing ...a to ...$t while ...a open" 1>&2 + fi +done + +exec 7< /dev/null + +if dd if=${TMP}i0 of=/dev/${MD}c 2>/dev/null ; then + echo "PASS: Could write missing ...a label to ...c" 1>&2 +else + echo "FAIL: Could not write missing ...a label to ...c" 1>&2 + exit 2 +fi + +if dd if=${TMP}i2 of=/dev/${MD}c 2>/dev/null ; then + echo "PASS: Could write large ...a label to ...c" 1>&2 +else + echo "FAIL: Could not write large ...a label to ...c" 1>&2 + exit 2 +fi + +if dd if=${TMP}i1 of=/dev/${MD}c 2>/dev/null ; then + echo "PASS: Could write small ...a label to ...c" 1>&2 +else + echo "FAIL: Could not write small ...a label to ...c" 1>&2 + exit 2 +fi + +if dd if=${TMP}i2 of=/dev/${MD}a 2>/dev/null ; then + echo "PASS: Could increase size of ...a by writing to ...a" 1>&2 +else + echo "FAIL: Could not increase size of ...a by writing to ...a" 1>&2 + exit 2 +fi + +if dd if=${TMP}i1 of=/dev/${MD}a 2>/dev/null ; then + echo "FAIL: Could decrease size of ...a by writing to ...a" 1>&2 + exit 2 +else + echo "PASS: Could not decrease size of ...a by writing to ...a" 1>&2 +fi + +if dd if=${TMP}i0 of=/dev/${MD}a 2>/dev/null ; then + echo "FAIL: Could delete ...a by writing to ...a" 1>&2 + exit 2 +else + echo "PASS: Could not delete ...a by writing to ...a" 1>&2 +fi + +if dd if=${TMP}i0 of=/dev/${MD}c 2>/dev/null ; then + echo "PASS: Could delete ...a by writing to ...c" 1>&2 +else + echo "FAIL: Could not delete ...a by writing to ...c" 1>&2 + exit 2 +fi + +# XXX: need to add a 'b' partition and check for overlaps. + +exit 0 |