misc: move exit status into trap handler
[xfstests-dev.git] / tests / xfs / 060
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2000-2001, 2011 SGI.  All Rights Reserved.
4 #
5 # FS QA Test No. 060
6 #
7 # Test multi-stream xfsdump and restoring one stream at a time.
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         _cleanup_dump
21         cd /
22         rm -f $tmp.*
23 }
24
25 # get standard environment, filters and checks
26 . ./common/rc
27 . ./common/dump
28
29 # real QA test starts here
30 _supported_fs xfs
31
32 _require_multi_stream
33
34 _create_dumpdir_fill_multi
35 _do_dump_multi_file --multi 4
36 _prepare_restore_dir
37 base=$dump_file
38 opts=""
39 for x in 0 1 2 3; do
40     _do_restore_file_cum -f $base.$x $opts
41     opts=-R
42 done
43 _ls_compare_sub
44 _diff_compare
45
46 # success, all done
47 exit