btrfs/012: check free size of scratch device before copying files
[xfstests-dev.git] / tests / generic / 014
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 014
6 #
7 # truncfile
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=0        # success is the default!
16 trap "_cleanup; exit \$status" 0 1 2 3 15
17
18 _cleanup()
19 {
20     cd /
21     rm -f $tmp.*
22     rm -rf $TEST_DIR/truncfile.$$.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/filter
28
29 _supported_fs generic
30
31 _require_test
32 _require_sparse_files
33
34 # ensure EOF preallocation doesn't massively extend the runtime of this test
35 # by limiting the amount of preallocation and therefore the amount of blocks
36 # zeroed during the truncfile test run.
37 if [ "$FSTYP" == "xfs" ]; then
38         _test_unmount
39         _test_mount -o allocsize=64k
40 fi
41
42 echo "brevity is wit..."
43
44 echo "------"
45 echo "test 1"
46 echo "------"
47 $here/src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
48 ret=$?
49 if [ "$ret" -ne 0 ]; then
50         out=`cat $tmp.out`
51         echo "truncfile returned $ret : \"$out\""
52 else
53         echo "OK"
54 fi
55
56 exit