overlay: use OVL_BASE_SCRATCH_MNT instead of SCRATCH_DEV
[xfstests-dev.git] / tests / overlay / 006
1 #! /bin/bash
2 # FS QA Test 006
3 #
4 # Test visible whiteout issue after renaming file from lowerdir to a dir in
5 # upperdir.
6 #
7 # Upstream commit 45d117389696 ("ovl: ignore lower entries when checking purity
8 # of non-directory entries") fixed the issue
9 #
10 #-----------------------------------------------------------------------
11 # Copyright (c) 2016 Red Hat Inc.,  All Rights Reserved.
12 #
13 # This program is free software; you can redistribute it and/or
14 # modify it under the terms of the GNU General Public License as
15 # published by the Free Software Foundation.
16 #
17 # This program is distributed in the hope that it would be useful,
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 # GNU General Public License for more details.
21 #
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write the Free Software Foundation,
24 # Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
25 #-----------------------------------------------------------------------
26 #
27
28 seq=`basename $0`
29 seqres=$RESULT_DIR/$seq
30 echo "QA output created by $seq"
31
32 here=`pwd`
33 tmp=/tmp/$$
34 status=1        # failure is the default!
35 trap "_cleanup; exit \$status" 0 1 2 3 15
36
37 _cleanup()
38 {
39         cd /
40         rm -f $tmp.*
41 }
42
43 # get standard environment, filters and checks
44 . ./common/rc
45 . ./common/filter
46
47 rm -f $seqres.full
48
49 # real QA test starts here
50 _supported_fs overlay
51 _supported_os Linux
52 _require_scratch
53
54 echo "Silence is golden"
55
56 # Remove all files from previous tests
57 _scratch_mkfs
58
59 # Create test file/dir before mount
60 mkdir -p $OVL_BASE_SCRATCH_MNT/$OVL_LOWER
61 mkdir -p $OVL_BASE_SCRATCH_MNT/$OVL_UPPER
62 touch $OVL_BASE_SCRATCH_MNT/$OVL_LOWER/lowertestfile
63 mkdir $OVL_BASE_SCRATCH_MNT/$OVL_UPPER/uppertestdir
64
65 _scratch_mount
66
67 # rename lowertestfile to uppertestdir, this triggers copyup and creates
68 # whiteout in $OVL_UPPER
69 mv $SCRATCH_MNT/lowertestfile $SCRATCH_MNT/uppertestdir
70 # the lowertestfile can be removed
71 rm $SCRATCH_MNT/uppertestdir/lowertestfile
72 # no file no whiteout file in upptestdir
73 ls $SCRATCH_MNT/uppertestdir
74
75 # success, all done
76 status=0
77 exit