misc: move exit status into trap handler
[xfstests-dev.git] / tests / generic / 022
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2013 Samsung Electronics.  All Rights Reserved.
4 #
5 # FS QA Test No. generic/022
6 #
7 # Delayed allocation collapse range tests
8 # This testcase is one of the 4 testcases which tries to
9 # test various corner cases for fcollapse range functionality over different
10 # type of extents. These tests are based on generic/255 test case.
11 # For the type of tests, check the description of _test_generic_punch
12 # in common/rc.
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20
21 _cleanup()
22 {
23     rm -f $tmp.*
24 }
25
26 trap "_cleanup ; exit \$status" 0 1 2 3 15
27
28 # get standard environment, filters and checks
29 # we need to include common/punch to get defination fo filter functions
30 . ./common/rc
31 . ./common/filter
32 . ./common/punch
33
34 # real QA test starts here
35 _supported_fs generic
36
37 _require_test
38 _require_xfs_io_command "fpunch"
39 _require_xfs_io_command "falloc"
40 _require_xfs_io_command "fiemap"
41 _require_xfs_io_command "fcollapse"
42
43 testfile=$TEST_DIR/$seq.$$
44
45 _test_generic_punch -d falloc fpunch fcollapse fiemap _filter_hole_fiemap $testfile
46 _check_test_fs
47
48 status=0
49 exit