6 MD=`mdconfig -a -t malloc -s 2m`
7 trap "exec 7</dev/null; rm -f ${TMP}* ; mdconfig -d -u ${MD}" EXIT INT TERM
9 ./sunlabel -r -w $MD auto
11 dd if=/dev/$MD of=${TMP}i0 count=16 > /dev/null 2>&1
12 ./sunlabel $MD > ${TMP}l0
22 ./sunlabel -R $MD ${TMP}l1
23 if [ -c /dev/${MD}a ] ; then
24 echo "PASS: Created a: partition" 1>&2
26 echo "FAIL: Did not create a: partition" 1>&2
30 # Spoil and rediscover
33 if [ -c /dev/${MD}a ] ; then
34 echo "PASS: Recreated a: partition after spoilage" 1>&2
36 echo "FAIL: Did not recreate a: partition after spoilage" 1>&2
40 dd if=/dev/$MD of=${TMP}i1 count=16 > /dev/null 2>&1
49 ./sunlabel -R $MD ${TMP}l2
50 dd if=/dev/$MD of=${TMP}i2 count=16 > /dev/null 2>&1
56 if dd if=${TMP}i2 of=/dev/${MD}$t 2>/dev/null ; then
57 echo "PASS: Could rewrite same label to ...$t while ...a open" 1>&2
59 echo "FAIL: Could not rewrite same label to ...$t while ...a open" 1>&2
63 if dd if=${TMP}i1 of=/dev/${MD}$t 2>/dev/null ; then
64 echo "FAIL: Could label with smaller ...a to ...$t while ...a open" 1>&2
67 echo "PASS: Could not label with smaller ...a to ...$t while ...a open" 1>&2
70 if dd if=${TMP}i0 of=/dev/${MD}$t 2>/dev/null ; then
71 echo "FAIL: Could write label missing ...a to ...$t while ...a open" 1>&2
74 echo "PASS: Could not write label missing ...a to ...$t while ...a open" 1>&2
80 if dd if=${TMP}i0 of=/dev/${MD}c 2>/dev/null ; then
81 echo "PASS: Could write missing ...a label to ...c" 1>&2
83 echo "FAIL: Could not write missing ...a label to ...c" 1>&2
87 if dd if=${TMP}i2 of=/dev/${MD}c 2>/dev/null ; then
88 echo "PASS: Could write large ...a label to ...c" 1>&2
90 echo "FAIL: Could not write large ...a label to ...c" 1>&2
94 if dd if=${TMP}i1 of=/dev/${MD}c 2>/dev/null ; then
95 echo "PASS: Could write small ...a label to ...c" 1>&2
97 echo "FAIL: Could not write small ...a label to ...c" 1>&2
101 if dd if=${TMP}i2 of=/dev/${MD}a 2>/dev/null ; then
102 echo "PASS: Could increase size of ...a by writing to ...a" 1>&2
104 echo "FAIL: Could not increase size of ...a by writing to ...a" 1>&2
108 if dd if=${TMP}i1 of=/dev/${MD}a 2>/dev/null ; then
109 echo "FAIL: Could decrease size of ...a by writing to ...a" 1>&2
112 echo "PASS: Could not decrease size of ...a by writing to ...a" 1>&2
115 if dd if=${TMP}i0 of=/dev/${MD}a 2>/dev/null ; then
116 echo "FAIL: Could delete ...a by writing to ...a" 1>&2
119 echo "PASS: Could not delete ...a by writing to ...a" 1>&2
122 if ./sunlabel -B -b ${TMP}i0 ${MD} ; then
123 if [ ! -c /dev/${MD}a ] ; then
124 echo "FAILED: Writing bootcode killed ...a" 1>&2
127 echo "PASS: Could write bootcode while closed" 1>&2
130 echo "FAILED: Could not write bootcode while closed" 1>&2
135 if ktrace ./sunlabel -B -b ${TMP}i0 ${MD} ; then
136 if [ ! -c /dev/${MD}a ] ; then
137 echo "FAILED: Writing bootcode killed ...a" 1>&2
140 echo "PASS: Could write bootcode while open" 1>&2
143 echo "FAILED: Could not write bootcode while open" 1>&2
148 if dd if=${TMP}i0 of=/dev/${MD}c 2>/dev/null ; then
149 echo "PASS: Could delete ...a by writing to ...c" 1>&2
151 echo "FAIL: Could not delete ...a by writing to ...c" 1>&2
155 # XXX: need to add a 'b' partition and check for overlaps.