generic: test adding filesystem-level fscrypt key via key_id
[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 _supported_os Linux
31
32 _require_test
33 _require_sparse_files
34
35 # ensure EOF preallocation doesn't massively extend the runtime of this test
36 # by limiting the amount of preallocation and therefore the amount of blocks
37 # zeroed during the truncfile test run.
38 if [ "$FSTYP" == "xfs" ]; then
39         _test_unmount
40         _test_mount -o allocsize=64k
41 fi
42
43 echo "brevity is wit..."
44
45 echo "------"
46 echo "test 1"
47 echo "------"
48 $here/src/truncfile -c 10000 $TEST_DIR/truncfile.$$.0 >$tmp.out 2>&1
49 ret=$?
50 if [ "$ret" -ne 0 ]; then
51         out=`cat $tmp.out`
52         echo "truncfile returned $ret : \"$out\""
53 else
54         echo "OK"
55 fi
56
57 exit