xfstests: resolve symlinked devices to real paths
[xfstests-dev.git] / 045
1 #! /bin/bash
2 # FS QA Test No. 045
3 #
4 # test mount of two FSes with identical UUID and mount with unknown option
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 #
25 # creator
26 owner=dxm@sgi.com
27
28 seq=`basename $0`
29 echo "QA output created by $seq"
30
31 here=`pwd`
32 tmp=/tmp/$$
33 status=1        # failure is the default!
34 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
35
36 # get standard environment, filters and checks
37 . ./common.rc
38 . ./common.filter
39
40 _get_existing_uuid()
41 {
42     xfs_db -r $TEST_DEV -c "uuid" | $AWK_PROG '/^UUID/ { print $3 }'
43 }
44
45 # real QA test starts here
46 _supported_fs xfs
47 _supported_os Linux
48
49 _require_scratch
50
51 echo "*** get uuid"
52 uuid=`_get_existing_uuid`
53 echo "*** mkfs"
54 if ! _scratch_mkfs_xfs >$tmp.out 2>&1
55 then
56     cat $tmp.out
57     echo "!!! failed to mkfs on $SCRATCH_DEV"
58     exit
59 fi
60
61 echo "*** mount fs with bad mount option (expect failure)"
62 if _scratch_mount -o foobar >$tmp.out 2>&1
63 then
64     cat $tmp.out
65     echo "!!! mount succeeded (expecting failure)"
66     exit
67 fi
68
69 echo "*** duplicate uuid"
70 xfs_db -x -c "uuid $uuid" `_scratch_xfs_db_options` >/dev/null
71
72 echo "*** mount fs with duplicate uuid (expect failure)"
73 if _scratch_mount >$tmp.out 2>&1
74 then
75     cat $tmp.out
76     echo "!!! mount succeeded (expecting failure)"
77     exit
78 fi
79
80 echo "*** ok!"
81 # success, all done
82 status=0
83 exit