btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / xfs / 273
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016, Oracle and/or its affiliates.  All Rights Reserved.
4 #
5 # FS QA Test No. 273
6 #
7 # Populate filesystem, check that fsmap -n10000 matches fsmap -n1.
8 #
9 seq=`basename "$0"`
10 seqres="$RESULT_DIR/$seq"
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20         cd /
21         rm -rf "$tmp".* $TEST_DIR/a $TEST_DIR/b
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27 . ./common/populate
28
29 # real QA test starts here
30 _supported_fs xfs
31 _require_scratch
32 _require_populate_commands
33 _require_xfs_io_command "fsmap"
34
35 rm -f "$seqres.full"
36
37 echo "Format and mount"
38 _scratch_populate_cached nofill > $seqres.full 2>&1
39
40 echo "Compare fsmap" | tee -a $seqres.full
41 _scratch_mount
42 $XFS_IO_PROG -c 'fsmap -v -n 65536' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/a
43 $XFS_IO_PROG -c 'fsmap -v -n 1' $SCRATCH_MNT | grep -v 'EXT:' > $TEST_DIR/b
44 cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
45
46 diff -uw $TEST_DIR/a $TEST_DIR/b
47
48 # success, all done
49 status=0
50 exit