common: print hints for reasons of test failures
[xfstests-dev.git] / tests / overlay / 010
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 010
6 #
7 # Remove dir which contains whiteout from lower dir.
8 #
9 # The following kernel commit fixed the kernel crash on the removal
10 # 84889d4 ovl: check dentry positiveness in ovl_cleanup_whiteouts()
11 #
12 . ./common/preamble
13 _begin_fstest auto quick whiteout
14
15 # Import common functions.
16 . ./common/filter
17
18 # real QA test starts here
19 _supported_fs overlay
20 _fixed_by_kernel_commit 84889d493356 \
21         "ovl: check dentry positiveness in ovl_cleanup_whiteouts()"
22
23 # Use non-default scratch underlying overlay dirs, we need to check
24 # them explicity after test.
25 _require_scratch_nocheck
26
27 # Remove all files from previous tests
28 _scratch_mkfs
29
30 # Need two lower dirs in this test, and we mount overlay ourselves,
31 # create upper and workdir as well
32 lowerdir1=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.1
33 lowerdir2=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER.2
34 upperdir=$OVL_BASE_SCRATCH_MNT/$OVL_UPPER
35 workdir=$OVL_BASE_SCRATCH_MNT/$OVL_WORK
36 mkdir -p $lowerdir1 $lowerdir2 $upperdir $workdir
37
38 # One lowerdir contains test dir and test files, the other contains whiteout
39 mkdir -p $lowerdir1/testdir $lowerdir2/testdir
40 touch $lowerdir1/testdir/a $lowerdir1/testdir/b
41 mknod $lowerdir2/testdir/a c 0 0
42
43 # Mount overlayfs and remove testdir, which led to kernel crash
44 _overlay_scratch_mount_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
45 rm -rf $SCRATCH_MNT/testdir
46
47 # check overlayfs
48 _overlay_check_scratch_dirs "$lowerdir2:$lowerdir1" $upperdir $workdir
49
50 # success, all done
51 echo "Silence is golden"
52 status=0
53 exit