blob: 9c18f87a2fe5bdca5cf59190753b3c9240a22ded (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#!/bin/ksh
# $OpenBSD: checknewfs,v 1.6 2019/02/12 21:47:19 bluhm Exp $
# Written by Otto Moerbeek, 2007, Public domain
cleanup() {
vnconfig -u vnd0
rm -f $image
}
trap 'cleanup' INT
dotest() {
if ! grep -q "$2|" /etc/disktab; then
echo disk type $2 does not exists in /etc/disktab
echo SKIPPED
fi
image=$(mktemp -t imageXXXXXXXXXX);
dd if=/dev/random of=$image bs=512 count=$1 2>/dev/null &&
vnconfig vnd0 $image &&
disklabel -w vnd0 $2 &&
newfs $3 /dev/rvnd0a
if [ $? != 0 ]; then
ret=$(($ret + 1))
echo TEST $1 $2 \"$3\" failed
else
(fsck -nf /dev/vnd0a | fgrep SALVAGE)
if [ $? == 0 ]; then
ret=$(($ret + 1))
echo TEST $1 $2 \"$3\" failed
else
echo TEST $1 $2 \"$3\" OK
fi
fi
echo ==========================
if [ $clean == 1 ]; then
cleanup
fi
}
ret=0
vnconfig -u vnd0 > /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"
dotest 2880 floppy3 "-m 0 -o space -i 524288 -c 2880"
else
clean=0
dotest "${@}"
fi
exit $ret
|