misc: move exit status into trap handler
[xfstests-dev.git] / tests / xfs / 267
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 SGI.  All Rights Reserved.
4 #
5 # FS QA Test No. 267
6 #
7 # Test xfsdump with a file spanning multiple media files.
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 #
26 # create a 40 MiB file with an extended attr.
27 # xfsdump writes file data in "extent groups", currently 16 MiB in size. After
28 # writing an extent group or finishing a file, xfsdump will start a new media
29 # file if it is over the suggested size. With a single 40 MiB file and using a
30 # suggested media file size of 12 MiB below, this dump will be contained in 3
31 # media files.
32 #
33 _create_files()
34 {
35     cat <<End-of-File >$tmp.config
36 # pathname      size            user    group    perm   name value namespace
37 biggg           41943040        $nobody $nobody  777    attr1 some_text1  root
38 End-of-File
39
40     _wipe_fs
41     _do_create_dumpdir_fill
42     _stable_fs
43 }
44
45 # get standard environment, filters and checks
46 . ./common/rc
47 . ./common/dump
48 . ./common/attr
49
50 # real QA test starts here
51 _supported_fs xfs
52
53 _require_tape $TAPE_DEV
54 _require_attrs trusted
55
56 _create_files
57 _erase_hard
58 _do_dump -d 12
59 _do_restore
60 _ls_compare_sub
61 _diff_compare
62 _diff_compare_eas
63
64 # success, all done
65 exit