xfstests: 302: cross-subvolume sparse copies on btrfs
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 48 lines · Koen De Wit
Signed-off-by Koen De Wit <[email protected]>---
302 | 108
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++302.out | 28 ++++++++++++++++ 2 files changed, 136 insertions(+), 0 deletions(-)create mode 100644 302
create mode 100644 302.out302 new file +32
-0@@ -0,0 +1,108 @@ +#! /bin/bash +# FS QA Test No. 302 +# +# Testing cross-subvolume sparse copy on btrfs +# - Create two subvolumes, mount one of them +# - Create a file on each (sub/root)volume, +# reflink them on the other volumes +# - Change one original and two reflinked files +# - Move and delete files +# +#----------------------------------------------------------------------- +# Copyright (c) 2013, Oracle and/or its affiliates. All Rights Reserved. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it would be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#----------------------------------------------------------------------- +# +# creator [email protected] + +seq=`basename $0` +echo "QA output created by $seq"
302 line 42
Quoted 10 lines
302 new file +10
-0+ +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.*
should cleanup delete created subvols?
302 line 54
Quoted 12 lines
302 new file +12
-0+} + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux + +_require_scratch +_require_cp_reflink
same basic stuff, need the above deifined somewehre, add to groups, add some context to output & comments if you would, to make it easier for future testers.
302 line 56
Quoted 2 lines
302 new file +2
-0+ +_catfiles() {
_checksum_files
302 line 61
Quoted 5 lines
302 new file +5
-0+ for D in $TESTDIR1 $SCRATCH_MNT $SUBVOL2 + do + for F in file1 file2 file3 + do + md5sum $D/$F | $AWK_PROG 'END {print $1}'
md5sum $D/$F | _filter_testdirs to get filenames?
302 line 70
Quoted 9 lines
302 new file +9
-0+ done + done +} + +_scratch_unmount 2>/dev/null +TESTDIR1=$TEST_DIR/test-$seq.$$-1 +TESTDIR2=$TEST_DIR/test-$seq.$$-2 +SUBVOL1=$TEST_DIR/subvol-$seq.$$-1 +SUBVOL2=$TEST_DIR/subvol-$seq.$$-2
same mild concern w/ using pids.
302 line 76
Quoted 6 lines
302 new file +6
-0+ +mkdir $TESTDIR1 +mkdir $TESTDIR2 +btrfs subvolume create $SUBVOL1 > /dev/null +btrfs subvolume create $SUBVOL2 > /dev/null +mount -t btrfs -o subvol=subvol-$seq.$$-1 $TEST_DEV $SCRATCH_MNT
eek, $TEST_DEV on $SCRATCH_MNT again ;) I guess we need some more btrfs-aware basic infrastructure.
302 line 80
Quoted 4 lines
302 new file +4
-0+ +$XFS_IO_PROG -f -c 'pwrite -S 0x61 0 9000' $TESTDIR1/file1 > /dev/null +$XFS_IO_PROG -f -c 'pwrite -S 0x62 0 13000' $SCRATCH_MNT/file2 > /dev/null +$XFS_IO_PROG -f -c 'pwrite -S 0x63 0 17000' $SUBVOL2/file3 > /dev/null
echos & things to add context to the output file would help.
Quoted 37 lines
302 new file +28
-0+cp --reflink $TESTDIR1/file1 $SUBVOL1 +cp --reflink $TESTDIR1/file1 $SUBVOL2 +cp --reflink $SUBVOL1/file2 $TESTDIR1/ +cp --reflink $SUBVOL1/file2 $SUBVOL2 +cp --reflink $SUBVOL2/file3 $TESTDIR1/ +cp --reflink $SUBVOL2/file3 $SUBVOL1 +_catfiles + +$XFS_IO_PROG -c 'pwrite -S 0x64 0 9000' $TESTDIR1/file1 > /dev/null +$XFS_IO_PROG -c 'pwrite -S 0x66 7000 21000' $SUBVOL2/file2 > /dev/null +$XFS_IO_PROG -c 'pwrite -S 0x65 5000 5000' $SCRATCH_MNT/file3 > /dev/null +_catfiles + +mv $TESTDIR1/file* $TESTDIR2 +mv $SCRATCH_MNT/file* $TESTDIR1/ +mv $SUBVOL2/file* $SCRATCH_MNT/ +mv $TESTDIR2/file* $SUBVOL2/ +_catfiles + +rm -rf $TESTDIR1 +rm -rf $TESTDIR2 +umount $SCRATCH_MNT +btrfs subvolume delete $SUBVOL1 > /dev/null +btrfs subvolume delete $SUBVOL2 > /dev/null + +# success, all done +status=0 +exit302.out new file +0
-0
302.out line 1
Quoted 1 line
302.out new file +1
-0@@ -0,0 +1,28 @@ +QA output created by 302
you can imagine the problem here if, say, the 12th md5sum is wrong in the output. What's a tester to think? ;)
Quoted 28 lines
302.out new file +27
-0+42d69d1a6d333a7ebdf64792a555e392 +d7402b46310fbbfbc5e466b1dccb043b +5a95800e4c04b11117aa4e4de057721f +42d69d1a6d333a7ebdf64792a555e392 +d7402b46310fbbfbc5e466b1dccb043b +5a95800e4c04b11117aa4e4de057721f +42d69d1a6d333a7ebdf64792a555e392 +d7402b46310fbbfbc5e466b1dccb043b +5a95800e4c04b11117aa4e4de057721f +2e26ad0e8b8e123d18c2d20c81cab0a8 +d7402b46310fbbfbc5e466b1dccb043b +5a95800e4c04b11117aa4e4de057721f +42d69d1a6d333a7ebdf64792a555e392 +d7402b46310fbbfbc5e466b1dccb043b +b9f275cd638cb784c9e61def94c622a8 +42d69d1a6d333a7ebdf64792a555e392 +a229d0159dad76eecec390d9b1db16d3 +5a95800e4c04b11117aa4e4de057721f +42d69d1a6d333a7ebdf64792a555e392 +d7402b46310fbbfbc5e466b1dccb043b +b9f275cd638cb784c9e61def94c622a8 +42d69d1a6d333a7ebdf64792a555e392 +a229d0159dad76eecec390d9b1db16d3 +5a95800e4c04b11117aa4e4de057721f +2e26ad0e8b8e123d18c2d20c81cab0a8 +d7402b46310fbbfbc5e466b1dccb043b +5a95800e4c04b11117aa4e4de057721f