misc: move exit status into trap handler
[xfstests-dev.git] / tests / xfs / 222
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2010 Dave Chinner.  All Rights Reserved.
4 #
5 # FS QA Test No. 222
6 #
7 # xfs_fsr QA tests
8 # run xfs_fsr over the test filesystem to give it a wide and varied set of
9 # inodes to try to defragment. This is effectively a crash/assert failure
10 # test looking for corruption induced by xfs_fsr runs.
11 #
12 seq=`basename $0`
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
15
16 here=`pwd`
17 tmp=/tmp/$$
18 status=1        # failure is the default!
19
20 _cleanup()
21 {
22     rm -f $tmp.*
23 }
24
25 trap "_cleanup ; exit \$status" 0 1 2 3 15
26
27 # get standard environment, filters and checks
28 . ./common/rc
29 . ./common/filter
30
31 # real QA test starts here
32 _supported_fs xfs
33 _require_test
34
35 [ "$XFS_FSR_PROG" = "" ] && _notrun "xfs_fsr not found"
36
37 xfs_fsr -d -v $TEST_DIR > $seqres.full 2>&1
38
39 echo "--- silence is golden ---"
40 status=0 ; exit