1228a25690429d639f5cf02e3689a1a4928642b7
[xfstests-dev.git] / tests / generic / 225
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2009 Eric Sandeen.  All Rights Reserved.
4 #
5 # FS QA Test No. 225
6 #
7 # Run the fiemap (file extent mapping) tester
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 -f $tmp.*
22 }
23
24 # get standard environment, filters and checks
25 . ./common/rc
26 . ./common/filter
27
28 # real QA test starts here
29 _supported_fs generic
30 _require_scratch
31 _require_odirect
32 _require_xfs_io_command "fiemap"
33
34 _scratch_mkfs > /dev/null 2>&1
35 _scratch_mount > /dev/null 2>&1
36
37 rm -f $seqres.full
38 fiemapfile=$SCRATCH_MNT/$seq.fiemap
39 fiemaplog=$SCRATCH_MNT/$seq.log
40
41 _require_test_program "fiemap-tester"
42
43 seed=`date +%s`
44
45 echo "using seed $seed" >> $fiemaplog
46
47 echo "fiemap run without preallocation, with sync"
48 $here/src/fiemap-tester -q -S -s $seed -p 0 -r 200 $fiemapfile 2>&1 | tee -a $fiemaplog
49
50 if [ $? -ne 0 ]; then
51         if grep -q "Operation not supported" $fiemaplog; then
52               _notrun "FIEMAP not supported by this filesystem type: $FSTYP"
53         fi
54         status=$?
55         exit
56 fi
57
58 echo "fiemap run without preallocation or sync"
59 $here/src/fiemap-tester -q -s $seed -p 0 -r 200 $fiemapfile 2>&1 | tee -a $fiemaplog
60
61 status=0
62 exit