16ec8cbb7ccde1f22522147818ab6936487fbc1b
[xfstests-dev.git] / 045
1 #! /bin/sh
2 #
3 #-----------------------------------------------------------------------
4 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
5 #
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License as
8 # published by the Free Software Foundation.
9 #
10 # This program is distributed in the hope that it would be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write the Free Software Foundation,
17 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 #
19 #-----------------------------------------------------------------------
20 #
21 # FS QA Test No. 045
22 #
23 # test mount of two FSes with identical UUID and mount with unknown option
24 #
25 #-----------------------------------------------------------------------
26 # Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
27 #-----------------------------------------------------------------------
28 #
29 # creator
30 owner=dxm@sgi.com
31
32 seq=`basename $0`
33 echo "QA output created by $seq"
34
35 here=`pwd`
36 tmp=/tmp/$$
37 status=1        # failure is the default!
38 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
39
40 # get standard environment, filters and checks
41 . ./common.rc
42 . ./common.filter
43
44 _get_existing_uuid()
45 {
46     xfs_db -r $TEST_DEV -c "uuid" | $AWK_PROG '/^UUID/ { print $3 }'
47 }
48
49 # real QA test starts here
50 _supported_fs xfs
51 _supported_os Linux
52
53 _require_scratch
54
55 echo "*** get uuid"
56 uuid=`_get_existing_uuid`
57 echo "*** mkfs"
58 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
59 then
60     cat $tmp.out
61     echo "!!! failed to mkfs on $SCRATCH_DEV"
62     exit
63 fi
64
65 echo "*** mount fs with bad mount option (expect failure)"
66 if _scratch_mount -o foobar >$tmp.out 2>&1
67 then
68     cat $tmp.out
69     echo "!!! mount succeeded (expecting failure)"
70     exit
71 fi
72
73 echo "*** duplicate uuid"
74 xfs_db -x -c "uuid $uuid" `_scratch_xfs_db_options` >/dev/null
75
76 echo "*** mount fs with duplicate uuid (expect failure)"
77 if _scratch_mount >$tmp.out 2>&1
78 then
79     cat $tmp.out
80     echo "!!! mount succeeded (expecting failure)"
81     exit
82 fi
83
84 echo "*** ok!"
85 # success, all done
86 status=0
87 exit