summaryrefslogtreecommitdiff
path: root/tests/xfs/503
blob: 8805632d4fcb820474d03e09bb20652c4ab8299b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0+
# Copyright (c) 2019 Oracle, Inc.  All Rights Reserved.
#
# FS QA Test No. 503
#
# Populate a XFS filesystem and ensure that metadump, mdrestore, and copy
# all work properly.
#
. ./common/preamble
_begin_fstest auto copy metadump

_register_cleanup "_cleanup" BUS

# Override the default cleanup function.
_cleanup()
{
	cd /
	rm -rf $tmp.* $testdir
}

# Import common functions.
. ./common/filter
. ./common/populate

testdir=$TEST_DIR/test-$seq

# real QA test starts here
_supported_fs xfs

_require_command "$XFS_MDRESTORE_PROG" "xfs_mdrestore"
_require_xfs_copy
_require_scratch_nocheck
_require_populate_commands
_xfs_skip_online_rebuild
_xfs_skip_offline_rebuild

echo "Format and populate"
_scratch_populate_cached nofill > $seqres.full 2>&1

mkdir -p $testdir
metadump_file=$testdir/scratch.md
metadump_file_a=${metadump_file}.a
metadump_file_g=${metadump_file}.g
metadump_file_ag=${metadump_file}.ag
copy_file=$testdir/copy.img

echo metadump
_scratch_xfs_metadump $metadump_file -a -o >> $seqres.full

echo metadump a
_scratch_xfs_metadump $metadump_file_a -a >> $seqres.full

echo metadump g
_scratch_xfs_metadump $metadump_file_g -g >> $seqres.full

echo metadump ag
_scratch_xfs_metadump $metadump_file_ag -a -g >> $seqres.full

echo copy
$XFS_COPY_PROG $SCRATCH_DEV $copy_file >> $seqres.full
_check_scratch_fs $copy_file

echo recopy
$XFS_COPY_PROG $copy_file $SCRATCH_DEV >> $seqres.full
_scratch_mount
_check_scratch_fs
_scratch_unmount

echo mdrestore
_scratch_xfs_mdrestore $metadump_file
_scratch_mount
_check_scratch_fs
_scratch_unmount

echo mdrestore a
_scratch_xfs_mdrestore $metadump_file_a
_scratch_mount
_check_scratch_fs
_scratch_unmount

echo mdrestore g
_scratch_xfs_mdrestore $metadump_file_g
_scratch_mount
_check_scratch_fs
_scratch_unmount

echo mdrestore ag
_scratch_xfs_mdrestore $metadump_file_ag
_scratch_mount
_check_scratch_fs
_scratch_unmount

# success, all done
status=0
exit