xfstests: move GPL boilerplates to fix lsqa.pl
[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 # This program is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation.
12 #
13 # This program is distributed in the hope that it would be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write the Free Software Foundation,
20 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
21 #
22 #-----------------------------------------------------------------------
23 #
24 # creator
25 owner=nathans@sgi.com
26
27 seq=`basename $0`
28 echo "QA output created by $seq"
29
30 here=`pwd`
31 tmp=/tmp/$$
32 status=1        # failure is the default!
33 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
34 rm -f $seq.full
35
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39
40 # real QA test starts here
41 _supported_fs xfs
42 _supported_os Linux
43
44 _require_nobigloopfs
45 _require_scratch
46
47 echo "Silence is golden."
48 for fs in `echo /sbin/mkfs.* | sed -e 's/.sbin.mkfs.//g'`
49 do
50         preop=""        # for special input needs
51         preargs=""      # for any special pre-device options
52         postargs=""     # for any special post-device options
53
54         # minix, msdos and vfat mkfs fails for large devices, restrict to 2000 blocks
55         [ $fs = minix ] && postargs=2000
56         [ $fs = msdos ] && postargs=2000
57         [ $fs = vfat ] && postargs=2000
58         # these folks prompt before writing
59         [ $fs = jfs ] && preop="echo Y |"
60         [ $fs = gfs ] && preop="echo y |" && preargs="-p lock_nolock -j 1"
61         [ $fs = gfs2 ] && preop="echo y |"
62         [ $fs = reiserfs ] && preop="echo y |" && preargs="-f"
63         # cramfs mkfs requires a directory argument
64         [ $fs = cramfs ] && preargs=/proc/fs/xfs
65         [ $fs = ext2 ] && preargs="-F"
66         [ $fs = ext3 ] && preargs="-F"
67         [ $fs = ext4 ] && preargs="-F"
68         [ $fs = ext4dev ] && preargs="-F"
69
70         # overwite the first few Kb - should blow away superblocks
71         src/devzero -n 20 $SCRATCH_DEV >/dev/null
72
73         # create a filesystem of this type
74         echo "=== Creating $fs filesystem..." >>$seq.full
75         echo "    ( $preop mkfs -t $fs $preargs $SCRATCH_DEV $postargs )" >>$seq.full
76         eval $preop mkfs -t $fs $preargs $SCRATCH_DEV $postargs >>$seq.full 2>&1
77
78         # next, ensure we don't overwrite it
79         echo "=== Attempting XFS overwrite of $fs..." >>$seq.full
80         /sbin/mkfs.xfs $SCRATCH_DEV >>$seq.full 2>&1
81
82         [ $? -eq 0 ] && echo "Failed - overwrote fs type ${fs}!"
83 done
84
85 # success, all done
86 status=0
87 exit