xfs: test xfs_copy and xfs_mdrestore on the populate images
authorDarrick J. Wong <darrick.wong@oracle.com>
Sun, 24 Mar 2019 06:48:24 +0000 (23:48 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 24 Mar 2019 15:16:56 +0000 (23:16 +0800)
Make sure that copy, metadump, and mdrestore work on a filesystem with
all known metadata types.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eryu Guan <guaneryu@gmail.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
tests/xfs/503 [new file with mode: 0755]
tests/xfs/503.out [new file with mode: 0644]
tests/xfs/group

diff --git a/tests/xfs/503 b/tests/xfs/503
new file mode 100755 (executable)
index 0000000..4175435
--- /dev/null
@@ -0,0 +1,97 @@
+#! /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.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1       # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 7 15
+
+_cleanup()
+{
+       cd /
+       rm -rf $tmp.* $testdir
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/populate
+
+testdir=$TEST_DIR/test-$seq
+
+# real QA test starts here
+_supported_os Linux
+_supported_fs xfs
+
+_require_scratch_nocheck
+_require_populate_commands
+
+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_metadump $metadump_file >> $seqres.full
+
+echo metadump a
+_scratch_metadump $metadump_file_a -a >> $seqres.full
+
+echo metadump g
+_scratch_metadump $metadump_file_g -g >> $seqres.full
+
+echo metadump ag
+_scratch_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
+xfs_mdrestore $metadump_file $SCRATCH_DEV
+_scratch_mount
+_check_scratch_fs
+_scratch_unmount
+
+echo mdrestore a
+xfs_mdrestore $metadump_file_a $SCRATCH_DEV
+_scratch_mount
+_check_scratch_fs
+_scratch_unmount
+
+echo mdrestore g
+xfs_mdrestore $metadump_file_g $SCRATCH_DEV
+_scratch_mount
+_check_scratch_fs
+_scratch_unmount
+
+echo mdrestore ag
+xfs_mdrestore $metadump_file_ag $SCRATCH_DEV
+_scratch_mount
+_check_scratch_fs
+_scratch_unmount
+
+# success, all done
+status=0
+exit
diff --git a/tests/xfs/503.out b/tests/xfs/503.out
new file mode 100644 (file)
index 0000000..8ef31db
--- /dev/null
@@ -0,0 +1,12 @@
+QA output created by 503
+Format and populate
+metadump
+metadump a
+metadump g
+metadump ag
+copy
+recopy
+mdrestore
+mdrestore a
+mdrestore g
+mdrestore ag
index 9d9458b8aab11467fa8115bd53c0b4c1a4ccb35a..e71b058f694adcb9bc13b07ca30daccdeb4b05b1 100644 (file)
 500 auto quick mkfs prealloc mkfs
 501 auto quick unlink
 502 auto quick unlink
+503 auto copy metadump