tests: remove udf/101
[xfstests-dev.git] / tests / overlay / 003
1 #! /bin/bash
2 # FS QA Test 003
3 #
4 # Test overlayfs basic whiteout.
5 #
6 # Overlayfs whiteout can be visible if underlying upper fs does not
7 # support d_type. Kernel commit
8 #       45aebea (ovl: Ensure upper filesystem supports d_type)
9 # prevents mounting overlayfs like this since v4.6-rc1.
10 # No harm to keep this test as a sanity check.
11 #
12 #-----------------------------------------------------------------------
13 # Copyright (c) 2016 Red Hat Inc. All Rights Reserved.
14 #
15 # This program is free software; you can redistribute it and/or
16 # modify it under the terms of the GNU General Public License as
17 # published by the Free Software Foundation.
18 #
19 # This program is distributed in the hope that it would be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 # GNU General Public License for more details.
23 #
24 # You should have received a copy of the GNU General Public License
25 # along with this program; if not, write the Free Software Foundation,
26 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
27 #-----------------------------------------------------------------------
28 #
29
30 seq=`basename $0`
31 seqres=$RESULT_DIR/$seq
32 echo "QA output created by $seq"
33
34 here=`pwd`
35 tmp=/tmp/$$
36 status=1        # failure is the default!
37 trap "_cleanup; exit \$status" 0 1 2 3 15
38
39 _cleanup()
40 {
41         cd /
42         rm -f $tmp.*
43 }
44
45 # get standard environment, filters and checks
46 . ./common/rc
47 . ./common/filter
48
49 # remove previous $seqres.full before test
50 rm -f $seqres.full
51
52 # real QA test starts here
53
54 # Modify as appropriate.
55 _supported_fs overlay
56 _supported_os Linux
57 _require_scratch
58
59 # Remove all files from previous tests
60 _scratch_mkfs
61
62 # Create test files dirs in lower dir
63 lowerdir=${OVL_BASE_SCRATCH_MNT}/${OVL_LOWER}
64 mkdir -p $lowerdir
65
66 touch ${lowerdir}/test_file
67 ln -s ${lowerdir}/test_file ${lowerdir}/test_softlink_file
68 ln ${lowerdir}/test_file ${lowerdir}/test_hardlink_file
69
70 mkdir -p ${lowerdir}/test_dir
71 ln -s ${lowerdir}/test_dir ${lowerdir}/test_softlink_dir
72
73 mknod ${lowerdir}/test_cdev c 2 3
74 ln -s ${lowerdir}/test_cdev ${lowerdir}/test_softlink_cdev
75 ln ${lowerdir}/test_cdev ${lowerdir}/test_hardlink_cdev
76
77 mknod ${lowerdir}/test_bdev b 2 4
78 ln -s ${lowerdir}/test_bdev ${lowerdir}/test_softlink_bdev
79 ln ${lowerdir}/test_bdev ${lowerdir}/test_hardlink_bdev
80
81 mknod ${lowerdir}/test_pipe p
82 ln -s ${lowerdir}/test_pipe ${lowerdir}/test_softlink_pipe
83 ln ${lowerdir}/test_pipe ${lowerdir}/test_hardlink_pipe
84
85 _scratch_mount
86
87 # whiteout all files in overlay mountpoint
88 rm -rf ${SCRATCH_MNT}/*
89 # nothing should be listed
90 ls ${SCRATCH_MNT}/
91
92 # unmount overlayfs but not base fs
93 $UMOUNT_PROG $SCRATCH_MNT
94
95 rm -rf $lowerdir
96 echo "Silence is golden"
97 # success, all done
98 status=0
99 exit