generic/520: Remove sync in clean_dir
[xfstests-dev.git] / tests / generic / 405
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 405
6 #
7 # Test mkfs against thin provision device, which has very small backing size,
8 # mkfs should return error when it hits EIO.
9 #
10 seq=`basename $0`
11 seqres=$RESULT_DIR/$seq
12 echo "QA output created by $seq"
13
14 here=`pwd`
15 tmp=/tmp/$$
16 status=1        # failure is the default!
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 # Initialize dmthin device with very small backing size & very big virtual
20 # size, with the hope that mkfs hit EIO at mkfs time
21 BACKING_SIZE=$((1 * 1024 * 1024 / 512))                 # 1M
22 VIRTUAL_SIZE=$((1 * 1024 * 1024 * 1024 * 1024 / 512))   # 1T
23
24 _cleanup()
25 {
26         _dmthin_cleanup
27         cd /
28         rm -f $tmp.*
29 }
30
31 # get standard environment, filters and checks
32 . ./common/rc
33 . ./common/filter
34 . ./common/dmthin
35
36 # remove previous $seqres.full before test
37 rm -f $seqres.full
38
39 # real QA test starts here
40 _supported_fs generic
41 _supported_os Linux
42 # $SCRATCH_DEV won't be directly created filesystem on, so fsck isn't required
43 _require_scratch_nocheck
44 _require_dm_target thin-pool
45
46 _dmthin_init $BACKING_SIZE $VIRTUAL_SIZE
47
48 # try mkfs on dmthin device, expect mkfs failure if 1M isn't big enough to hold
49 # all the metadata. But if mkfs returns success, we expect the filesystem is
50 # consistent, make sure it doesn't currupt silently.
51 $MKFS_PROG -t $FSTYP $DMTHIN_VOL_DEV >>$seqres.full 2>&1
52 if [ $? -eq 0 ]; then
53         _dmthin_check_fs
54 fi
55
56 echo "Silence is golden"
57 status=0
58 exit