btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / generic / 452
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Intel Corporation.  All Rights Reserved.
4 #
5 # FS QA Test 452
6 #
7 # This is a regression test for kernel patch:
8 #   commit fd96b8da68d3 ("ext4: fix fault handling when mounted with -o dax,ro")
9 # created by Ross Zwisler <ross.zwisler@linux.intel.com>
10 #
11 seq=`basename $0`
12 seqres=$RESULT_DIR/$seq
13 echo "QA output created by $seq"
14
15 here=`pwd`
16 tmp=/tmp/$$
17 status=1        # failure is the default!
18 trap "_cleanup; exit \$status" 0 1 2 3 15
19
20 _cleanup()
21 {
22         cd /
23         rm -f $tmp.*
24 }
25
26 # get standard environment, filters and checks
27 . ./common/rc
28 . ./common/filter
29
30 # remove previous $seqres.full before test
31 rm -f $seqres.full
32
33 # Modify as appropriate.
34 _supported_fs generic
35 _require_scratch
36
37 # we need to be able to execute binaries on scratch
38 _exclude_scratch_mount_option "noexec"
39
40 # real QA test starts here
41 # format and mount
42 _scratch_mkfs > $seqres.full 2>&1
43 _scratch_mount >> $seqres.full 2>&1
44
45 LS=$(which ls --skip-alias --skip-functions)
46 SCRATCH_LS=$SCRATCH_MNT/ls_on_scratch
47 cp $LS $SCRATCH_LS
48
49 $SCRATCH_LS $SCRATCH_LS | _filter_scratch
50
51 _scratch_remount ro
52
53 $SCRATCH_LS $SCRATCH_LS | _filter_scratch
54
55 # success, all done
56 status=0
57 exit