btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / generic / 599
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Chengguang Xu <cgxu519@mykernel.net>.
4 # All Rights Reserved.
5 #
6 # FS QA Test 599
7 #
8 # Test data integrity for ro remount.
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=0
17 trap "_cleanup; exit \$status" 0 1 2 3 15
18
19 _cleanup()
20 {
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 # remove previous $seqres.full before test
30 rm -f $seqres.full
31
32 # real QA test starts here
33 _supported_fs generic
34 _require_fssum
35 _require_scratch
36 _require_scratch_shutdown
37
38 _scratch_mkfs &>/dev/null
39 _scratch_mount
40
41 localdir=$SCRATCH_MNT/dir
42 mkdir $localdir
43 sync
44
45 # fssum used for comparing checksum of test file(data & metedata),
46 # exclude checking about atime, block structure, open error.
47 $FSSUM_PROG -ugomAcdES -f -w $tmp.fssum $localdir
48 _scratch_remount ro
49 _scratch_shutdown
50 _scratch_cycle_mount
51 $FSSUM_PROG -r $tmp.fssum $localdir
52
53 exit