etc/services - sync with NetBSD-8
[minix.git] / minix / tests / testmfs.sh
blob279d2e9bbf363b6a4829fb809ce398b874ef1faa
1 #!/bin/sh
3 # expected sha1sum of the FS image
4 expect=98bcafa04cb1eb75b7add6c95eb587c37f5050e0
6 set -e
8 # ownership matters for the proto file.
9 # the run script runs us with user "bin" (3), group "bin" (7).
10 if [ "`id -u`" != 3 -o "`id -g`" != 7 ]
11 then
12 echo "test script should be run with uid 3, gid 7."
13 exit 1
16 echo -n "mfs test "
18 testdir=fstest
19 protofile=proto
20 fsimage=fsimage
21 rm -rf $testdir $protofile $fsimage
23 if [ -d $testdir ]
24 then
25 echo "dir?"
26 exit 1
29 mkdir -p $testdir $testdir/contents $testdir/modes
31 if [ ! -d $testdir ]
32 then
33 echo "no dir?"
34 exit 1
37 # Make some small & big & bigger files
39 prevf=$testdir/contents/file
40 echo "Test contents 123" >$prevf
41 for double in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
42 do fn=$testdir/contents/fn.$double
43 cat $prevf $prevf >$fn
44 prevf=$fn
45 done
47 # Make some files with various modes & mtimes
49 for many in 0 1 2 3 4 5 6 7 8 9
50 do for m1 in 0 1 2 3 4 5 6 7
51 do for m2 in 0 1 2 3 4 5 6 7
52 do for m3 in 0 1 2 3 4 5 6 7
54 mode=${m1}${m2}${m3}
55 fn=$testdir/modes/m${mode}${many}
56 echo "$many $m1 $m2 $m3 $mode" > $fn
57 chmod $mode $fn
58 done
59 done
60 done
61 done
63 # Make an MFS filesystem image out of it
65 BS=4096
66 BLOCKS=15000
67 INODES=6000
68 dd if=/dev/zero seek=$BLOCKS of=$fsimage count=1 bs=$BS >/dev/null 2>&1
70 # -s keeps modes
71 /usr/sbin/mkproto -s -b $BLOCKS -i $INODES $testdir >$protofile
73 /sbin/mkfs.mfs -T 1 -b $BLOCKS -i $INODES $fsimage $protofile >/dev/null 2>&1
74 sum="`sha1 $fsimage | awk '{ print $4 }'`"
76 rm -rf $testdir $protofile $fsimage
78 if [ $sum != $expect ]
79 then
80 echo sum $sum is not expected $expect
81 exit 1
84 echo ok
86 exit 0