fix group listing regexp
[xfstests-dev.git] / 032
1 #! /bin/sh
2 # FS QA Test No. 032
3 #
4 # cross check mkfs detection of foreign filesystems
5 #
6 #-----------------------------------------------------------------------
7 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
8 #-----------------------------------------------------------------------
9 #
10 # creator
11 owner=nathans@sgi.com
12
13 seq=`basename $0`
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
20 rm -f $seq.full
21
22 # get standard environment, filters and checks
23 . ./common.rc
24 . ./common.filter
25
26 # real QA test starts here
27 _supported_fs xfs
28 _supported_os Linux
29
30 _require_nobigloopfs
31 _require_scratch
32
33 echo "Silence is golden."
34 for fs in `echo /sbin/mkfs.* | sed -e 's/.sbin.mkfs.//g'`
35 do
36         preop=""        # for special input needs
37         preargs=""      # for any special pre-device options
38         postargs=""     # for any special post-device options
39
40         # minix, msdos and vfat mkfs fails for large devices, restrict to 2000 blocks
41         [ $fs = minix ] && postargs=2000
42         [ $fs = msdos ] && postargs=2000
43         [ $fs = vfat ] && postargs=2000
44         # these folks prompt before writing
45         [ $fs = jfs ] && preop="echo Y |"
46         [ $fs = reiserfs ] && preop="echo y |"
47         # cramfs mkfs requires a directory argument
48         [ $fs = cramfs ] && preargs=/proc/fs/xfs
49
50         # overwite the first few Kb - should blow away superblocks
51         src/devzero -n 20 $SCRATCH_DEV >/dev/null
52
53         # create a filesystem of this type
54         echo "=== Creating $fs filesystem..." >>$seq.full
55         echo "    ( mkfs -t $fs $SCRATCH_DEV )" >>$seq.full
56         eval $preop mkfs -t $fs $preargs $SCRATCH_DEV $postargs >>$seq.full 2>&1
57
58         # next, ensure we don't overwrite it
59         echo "=== Attempting XFS overwrite of $fs..." >>$seq.full
60         /sbin/mkfs.xfs $SCRATCH_DEV >>$seq.full 2>&1
61
62         [ $? -eq 0 ] && echo "Failed - overwrote fs type ${fs}!"
63 done
64
65 # success, all done
66 status=0
67 exit