From: David Sterba Date: Tue, 13 Aug 2013 21:16:27 +0000 (-0500) Subject: xfstests: renumber existing btrfs tests to start with 1 X-Git-Tag: v2022.05.01~3396 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=aab6d4e47d51b5cf4e5fc4a15a5dee80fb72aab4;p=xfstests-dev.git xfstests: renumber existing btrfs tests to start with 1 Current numbering is inheried from the single testsuite series. There are only 6 btrfs-specific tests and it makes more sense to start adding new ones at a more natural place than 300-something. There's no overlap with the old and new numbers and I hope there' will be no confusion when referencing them. Signed-off-by: David Sterba Reviewed-by: Eric Sandeen Signed-off-by: Rich Johnston --- diff --git a/tests/btrfs/001 b/tests/btrfs/001 new file mode 100755 index 00000000..9aa24317 --- /dev/null +++ b/tests/btrfs/001 @@ -0,0 +1,107 @@ +#! /bin/bash +# FS QA Test No. btrfs/001 +# +# Test btrfs's subvolume and snapshot support +# +#----------------------------------------------------------------------- +# Copyright (c) 2011 Red Hat. 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 +# +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs > /dev/null 2>&1 +_scratch_mount + +# First test basic snapshotting +echo "Creating file foo in root dir" +dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 &> /dev/null +echo "List root dir" +ls $SCRATCH_MNT +echo "Creating snapshot of root dir" +$BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap | _filter_scratch +echo "List root dir after snapshot" +ls $SCRATCH_MNT +echo "List snapshot dir" +ls $SCRATCH_MNT/snap +rm -f $SCRATCH_MNT/foo +echo "List root dir after rm of foo" +ls $SCRATCH_MNT +echo "List snapshot dir" +ls $SCRATCH_MNT/snap + +# Test creating a normal subvolme +$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol | _filter_scratch +echo "Listing root dir" +ls $SCRATCH_MNT +echo "Listing subvol" +ls $SCRATCH_MNT/subvol + +# Test setting a default mount +echo "Creating file bar in subvol" +dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null +echo "Setting subvol to the default" +$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch +_scratch_remount +echo "List root dir which is now subvol" +ls $SCRATCH_MNT +_scratch_unmount +echo "Mounting sbuvolid=0 for the root dir" +_scratch_mount "-o subvolid=0" +echo "List root dir" +ls $SCRATCH_MNT +echo "Setting the root dir as the default again" +$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT | _filter_scratch +_scratch_remount +echo "List root dir" +ls $SCRATCH_MNT + +# Test listing the subvolumes +echo "Listing subvolumes" +$BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT | awk '{ print $NF }' + +# Delete the snapshot +$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/snap | _filter_scratch +echo "List root dir" +ls $SCRATCH_MNT +_scratch_remount +echo "List root dir" +ls $SCRATCH_MNT + +status=0 ; exit diff --git a/tests/btrfs/001.out b/tests/btrfs/001.out new file mode 100644 index 00000000..c782bde9 --- /dev/null +++ b/tests/btrfs/001.out @@ -0,0 +1,40 @@ +QA output created by 001 +Creating file foo in root dir +List root dir +foo +Creating snapshot of root dir +Create a snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/snap' +List root dir after snapshot +foo +snap +List snapshot dir +foo +List root dir after rm of foo +snap +List snapshot dir +foo +Create subvolume 'SCRATCH_MNT/subvol' +Listing root dir +snap +subvol +Listing subvol +Creating file bar in subvol +Setting subvol to the default +List root dir which is now subvol +bar +Mounting sbuvolid=0 for the root dir +List root dir +snap +subvol +Setting the root dir as the default again +List root dir +snap +subvol +Listing subvolumes +snap +subvol +Delete subvolume 'SCRATCH_MNT/snap' +List root dir +subvol +List root dir +subvol diff --git a/tests/btrfs/002 b/tests/btrfs/002 new file mode 100755 index 00000000..03e9137f --- /dev/null +++ b/tests/btrfs/002 @@ -0,0 +1,191 @@ +#!/bin/bash +# FS QA Test No. btrfs/002 +# +# Extented btrfs snapshot test cases +# +#----------------------------------------------------------------------- +# Copyright (c) 2011 Oracle 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 +# +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + rm -f $tmp.* +} + +trap "_cleanup ; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +_need_to_be_root +_supported_fs btrfs +_supported_os Linux +_require_scratch + +_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" +_scratch_mount + +# Create and save sha256sum +# arg1 FS to generate sha256 +# arg2 File name to save the sha256 output +_save_checksum() +{ + local i=0 + >$2 + cd $1 + for i in `find . -type f`; do sha256sum $i >> $2; done + cd $OLDPWD +} + +# Verify the sha256sum for a FS +# arg1 FS to be tested +# arg2 sha256 file +_verify_checksum() +{ + cd $1 + [ -f $2 ] || _fail "checksum file $2 not found" + sha256sum -c $2 | grep "FAILED" + cd $OLDPWD +} + +# Create a snapshot +# arg1 dest dir +# Return snapshot name in the SNAPNAME +_create_snap() +{ + local x + [ -d $1 ] || _fail "Destination dir $1 not present" + SNAPNAME=`mktemp -u $SCRATCH_MNT/snap.XXXXXX` + $BTRFS_UTIL_PROG subvolume snapshot $1 $SNAPNAME > /dev/null || _fail "snapshot create failed" +} + +# Reads and writes new data but does not allocate new blocks +# arg1 FS to be modified +_read_modify_write() +{ + local i + local FSIZE + for i in `find $1 -type f` + do + FSIZE=`stat -t $i | cut -d" " -f2` + dd if=$i of=/dev/null obs=$FSIZE count=1 status=noxfer 2>/dev/null & + dd if=/dev/urandom of=$i obs=$FSIZE count=1 status=noxfer 2>/dev/null & + done + wait $! +} + +# Fills the allocated blocks +# arg1 FS in question +_fill_blk() +{ + local FSIZE + local BLKS + local NBLK + local FALLOC + local WS + + for i in `find /$1 -type f` + do + FSIZE=`stat -t $i | cut -d" " -f2` + BLKS=`stat -c "%B" $i` + NBLK=`stat -c "%b" $i` + FALLOC=$(($BLKS * $NBLK)) + WS=$(($FALLOC - $FSIZE)) + dd if=/dev/urandom of=$i oseek=$FSIZE obs=$WS count=1 status=noxfer 2>/dev/null & + done + wait $! +} + +# Append a random size to the files +# arg1 : FS in question +_append_file() +{ + local FSIZE + local X + local N + local i + N=0 + for i in `find $1 -type f` + do + if [ $N == 0 ]; then + X=$i + FSIZE=`stat -t $X | cut -d" " -f2` + dd if=$X of=$X seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null & + N=$(($N+1)) + continue + fi + FSIZE=`stat -t $i | cut -d" " -f2` + dd if=$X of=$i seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null & + X=$i + done + wait $! +} + +##################### real QA test starts here################################### +# sv1 - is just a name nothing spl +firstvol="$SCRATCH_MNT/sv1" +$BTRFS_UTIL_PROG subvolume create $firstvol > /dev/null || _fail "btrfs subvolume create $firstvol failed" +dirp=`mktemp -duq $firstvol/dir.XXXXXX` +_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 -x +SNAPNAME=0 +_create_snap $firstvol +_save_checksum $firstvol $tmp.sv1.sum +_verify_checksum $SNAPNAME $tmp.sv1.sum + +#Append1 the files +_fill_blk $SNAPNAME +_verify_checksum $firstvol $tmp.sv1.sum + +#Append2 the files +_append_file $SNAPNAME +_verify_checksum $firstvol $tmp.sv1.sum + +#read modify write +_read_modify_write $SNAPNAME +_verify_checksum $firstvol $tmp.sv1.sum + +#nested snapshot test +src_vol=$firstvol +for i in `seq 1 7`; do + SNAPNAME=0 + _create_snap $src_vol + _verify_checksum $SNAPNAME $tmp.sv1.sum + src_vol=$SNAPNAME +done + +# file delete test +SNAPNAME=0 +_create_snap $firstvol +tname=`echo $SNAPNAME | rev | cut -d"/" -f1 | rev` +_save_checksum $SNAPNAME $tmp.$tname.sum +\rm -rf $firstvol/* +_verify_checksum $SNAPNAME $tmp.$tname.sum + +umount $SCRATCH_DEV || _fail "unmount failed" + +echo "Silence is golden" +status=0; exit diff --git a/tests/btrfs/002.out b/tests/btrfs/002.out new file mode 100644 index 00000000..61705c7c --- /dev/null +++ b/tests/btrfs/002.out @@ -0,0 +1,2 @@ +QA output created by 002 +Silence is golden diff --git a/tests/btrfs/003 b/tests/btrfs/003 new file mode 100755 index 00000000..37909358 --- /dev/null +++ b/tests/btrfs/003 @@ -0,0 +1,186 @@ +#! /bin/bash +# FS QA Test No. btrfs/003 +# +# btrfs vol tests +# +#----------------------------------------------------------------------- +# Copyright (c) 2011 Oracle. 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 +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! +dev_removed=0 +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* + if [ $dev_removed == 1 ]; then + umount $SCRATCH_MNT + _devmgt_add "${DEVHTL}" + fi +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +_need_to_be_root +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_scratch_dev_pool +_require_deletable_scratch_dev_pool + +# Test cases related to raid in btrfs +_test_raid0() +{ + export MKFS_OPTIONS="-m raid0 -d raid0" + _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + umount $SCRATCH_MNT +} + +_test_raid1() +{ + export MKFS_OPTIONS="-m raid1 -d raid1" + _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + umount $SCRATCH_MNT +} + +_test_raid10() +{ + export MKFS_OPTIONS="-m raid10 -d raid10" + _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + umount $SCRATCH_MNT +} + +_test_single() +{ + export MKFS_OPTIONS="-m single -d single" + _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + umount $SCRATCH_MNT +} + +_test_add() +{ + local i + local devs[]="( $SCRATCH_DEV_POOL )" + local n=${#devs[@]} + + n=$(($n-1)) + + export MKFS_OPTIONS="" + _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + for i in `seq 1 $n`; do + $BTRFS_UTIL_PROG device add ${devs[$i]} $SCRATCH_MNT > /dev/null 2>&1 || _fail "device add failed" + done + $BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "balance failed" + umount $SCRATCH_MNT +} + +_test_replace() +{ + local i + local devs=( $SCRATCH_DEV_POOL ) + local n=${#devs[@]} + local ds + local d + local DEVHTL="" + + # exclude the last disk in the disk pool + n=$(($n-1)) + ds=${devs[@]:0:$n} + + export MKFS_OPTIONS="-m raid1 -d raid1" + _scratch_mkfs "$ds" > /dev/null 2>&1 || _fail "tr: mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + + #pick the 2nd last disk + ds=${devs[@]:$(($n-1)):1} + + # retrive the HTL for this scsi disk + d=`echo $ds|cut -d"/" -f3` + DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev` + + #fail disk + _devmgt_remove ${DEVHTL} + dev_removed=1 + + $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" > /dev/null || _fail \ + "btrfs did not report device missing" + + # add a new disk to btrfs + ds=${devs[@]:$(($n)):1} + $BTRFS_UTIL_PROG device add ${ds} $SCRATCH_MNT > /dev/null 2>&1 || _fail "dev add failed" + # in some system balance fails if there is no delay (a bug) + # putting sleep 10 to work around as of now + # sleep 10 + $BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "dev balance failed" + + # cleaup. add the removed disk + umount $SCRATCH_MNT + _devmgt_add "${DEVHTL}" + dev_removed=0 +} + +_test_remove() +{ + _scratch_mkfs "$SCRATCH_DEV_POOL" > /dev/null 2>&1 || _fail "mkfs failed" + _scratch_mount + dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` + _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 + + # pick last dev in the list + dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'` + $BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed" + $BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV 2>&1 | grep $dev_del > /dev/null && _fail "btrfs still shows the deleted dev" + umount $SCRATCH_MNT +} + +_test_raid0 +_test_raid1 +_test_raid10 +_test_single +_test_add +_test_replace +_test_remove + +echo "Silence is golden" +status=0; exit diff --git a/tests/btrfs/003.out b/tests/btrfs/003.out new file mode 100644 index 00000000..6895fc80 --- /dev/null +++ b/tests/btrfs/003.out @@ -0,0 +1,2 @@ +QA output created by 003 +Silence is golden diff --git a/tests/btrfs/004 b/tests/btrfs/004 new file mode 100755 index 00000000..6e58b03c --- /dev/null +++ b/tests/btrfs/004 @@ -0,0 +1,266 @@ +#! /bin/bash +# FSQA Test No. btrfs/004 +# +# Run fsstress to create a reasonably strange file system, make a +# snapshot and run more fsstress. Then select some files from that fs, +# run filefrag to get the extent mapping and follow the backrefs. +# We check to end up back at the original file with the correct offset. +# +#----------------------------------------------------------------------- +# Copyright (C) 2011 STRATO. 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 +# +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 +noise_pid=0 + +_cleanup() +{ + rm $tmp.running + wait + rm -f $tmp.* +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter + +# real QA test starts here +_need_to_be_root +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_no_large_scratch_dev +_require_btrfs inspect-internal +_require_command "/usr/sbin/filefrag" + +rm -f $seqres.full + +FILEFRAG_FILTER='if (/, blocksize (\d+)/) {$blocksize = $1; next} ($ext, '\ +'$logical, $physical, $expected, $length, $flags) = (/^\s*(\d+)\s+(\d+)'\ +'\s+(\d+)\s+(?:(\d+)\s+)?(\d+)\s+(.*)/) or next; $flags =~ '\ +'/(?:^|,)inline(?:,|$)/ and next; print $physical * $blocksize, "#", '\ +'$length * $blocksize, "#", $logical * $blocksize, " "' + +# this makes filefrag output script readable by using a perl helper. +# output is one extent per line, with three numbers separated by '#' +# the numbers are: physical, length, logical (all in bytes) +# sample output: "1234#10#5678" -> physical 1234, length 10, logical 5678 +_filter_extents() +{ + tee -a $seqres.full | $PERL_PROG -ne "$FILEFRAG_FILTER" +} + +_check_file_extents() +{ + cmd="filefrag -v $1" + echo "# $cmd" >> $seqres.full + out=`$cmd | _filter_extents` + if [ -z "$out" ]; then + return 1 + fi + echo "after filter: $out" >> $seqres.full + echo $out + return 0 +} + +# use a logical address and walk the backrefs back to the inode. +# compare to the expected result. +# returns 0 on success, 1 on error (with output made) +_btrfs_inspect_addr() +{ + mp=$1 + addr=$2 + expect_addr=$3 + expect_inum=$4 + file=$5 + cmd="$BTRFS_UTIL_PROG inspect-internal logical-resolve -P $addr $mp" + echo "# $cmd" >> $seqres.full + out=`$cmd` + echo "$out" >> $seqres.full + grep_expr="inode $expect_inum offset $expect_addr root" + echo "$out" | grep "^$grep_expr 5$" >/dev/null + ret=$? + if [ $ret -eq 0 ]; then + # look for a root number that is not 5 + echo "$out" | grep "^$grep_expr \([0-46-9][0-9]*\|5[0-9]\+\)$" \ + >/dev/null + ret=$? + fi + if [ $ret -eq 0 ]; then + return 0 + fi + echo "unexpected output from" + echo " $cmd" + echo "expected inum: $expect_inum, expected address: $expect_addr,"\ + "file: $file, got:" + echo "$out" + return 1 +} + +# use an inode number and walk the backrefs back to the file name. +# compare to the expected result. +# returns 0 on success, 1 on error (with output made) +_btrfs_inspect_inum() +{ + file=$1 + inum=$2 + snap_name=$3 + mp="$SCRATCH_MNT/$snap_name" + cmd="$BTRFS_UTIL_PROG inspect-internal inode-resolve $inum $mp" + echo "# $cmd" >> $seqres.full + out=`$cmd` + echo "$out" >> $seqres.full + grep_expr="^$file$" + cnt=`echo "$out" | grep "$grep_expr" | wc -l` + if [ $cnt -ge "1" ]; then + return 0 + fi + echo "unexpected output from" + echo " $cmd" + echo "expected path: $file, got:" + echo "$out" + return 1 +} + +_btrfs_inspect_check() +{ + file=$1 + physical=$2 + length=$3 + logical=$4 + snap_name=$5 + cmd="stat -c %i $file" + echo "# $cmd" >> $seqres.full + inum=`$cmd` + echo "$inum" >> $seqres.full + _btrfs_inspect_addr $SCRATCH_MNT $physical $logical $inum $file + ret=$? + if [ $ret -eq 0 ]; then + _btrfs_inspect_inum $file $inum $snap_name + ret=$? + fi + return $ret +} + +workout() +{ + fsz=$1 + nfiles=$2 + procs=$3 + snap_name=$4 + do_bg_noise=$5 + + umount $SCRATCH_DEV >/dev/null 2>&1 + echo "*** mkfs -dsize=$fsz" >>$seqres.full + echo "" >>$seqres.full + _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \ + || _fail "size=$fsz mkfs failed" + run_check _scratch_mount + # -w ensures that the only ops are ones which cause write I/O + run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \ + $FSSTRESS_AVOID + + run_check $BTRFS_UTIL_PROG subvol snap $SCRATCH_MNT \ + $SCRATCH_MNT/$snap_name + + run_check umount $SCRATCH_DEV >/dev/null 2>&1 + run_check _scratch_mount "-o compress=lzo" + + # make some noise but ensure we're not touching existing data + # extents. + run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p $procs -n 4000 \ + -z -f chown=3 -f link=1 -f mkdir=2 -f mknod=2 \ + -f rename=2 -f setxattr=1 -f symlink=2 + + clean_dir="$SCRATCH_MNT/next" + mkdir $clean_dir + # now make more files to get a higher tree + run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \ + $FSSTRESS_AVOID + run_check umount $SCRATCH_DEV >/dev/null 2>&1 + run_check _scratch_mount "-o atime" + + if [ $do_bg_noise -ne 0 ]; then + # make background noise while backrefs are being walked + while [ -f "$tmp.running" ]; do + echo background fsstress >>$seqres.full + run_check $FSSTRESS_PROG -d $SCRATCH_MNT/bgnoise -n 999 + echo background rm >>$seqres.full + rm -rf $SCRATCH_MNT/bgnoise/ + done & + noise_pid=`jobs -p %1` + echo "background noise by $noise_pid" >>$seqres.full + fi + + cnt=0 + errcnt=0 + dir="$SCRATCH_MNT/$snap_name/" + for file in `find $dir -name f\* -size +0 | sort -R`; do + extents=`_check_file_extents $file` + ret=$? + if [ $ret -ne 0 ]; then + continue; + fi + for i in $extents; do + physical=$i + length=$i + logical=$i + physical=`echo $physical | sed -e 's/#.*//'` + length=`echo $length | sed -e 's/[^#]+#//'` + length=`echo $length | sed -e 's/#.*//'` + logical=`echo $logical | sed -e 's/.*#//'` + _btrfs_inspect_check $file $physical $length $logical \ + $snap_name + ret=$? + if [ $ret -ne 0 ]; then + errcnt=`expr $errcnt + 1` + fi + done + cnt=`expr $cnt + 1` + if [ $cnt -ge $nfiles ]; then + break + fi + done + + if [ $errcnt -gt 0 ]; then + _fail "test failed: $errcnt error(s)" + fi +} + +echo "*** test backref walking" + +snap_name="snap1" +filesize=`expr 2000 \* 1024 \* 1024` +nfiles=4 +numprocs=1 +do_bg_noise=1 + +touch $tmp.running + +workout $filesize $nfiles $numprocs $snap_name $do_bg_noise + +echo "*** done" +status=0 +exit diff --git a/tests/btrfs/004.out b/tests/btrfs/004.out new file mode 100644 index 00000000..643b9344 --- /dev/null +++ b/tests/btrfs/004.out @@ -0,0 +1,3 @@ +QA output created by 004 +*** test backref walking +*** done diff --git a/tests/btrfs/005 b/tests/btrfs/005 new file mode 100755 index 00000000..81badf6c --- /dev/null +++ b/tests/btrfs/005 @@ -0,0 +1,174 @@ +#! /bin/bash +# FS QA Test No. btrfs/005 +# +# Btrfs Online defragmentation tests +# +#----------------------------------------------------------------------- +# Copyright (c) 2012 Fujitsu Liu Bo. 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 +#----------------------------------------------------------------------- +# + +seq=`basename $0` +seqres=$RESULT_DIR/$seq +echo "QA output created by $seq" +here="`pwd`" +tmp=/tmp/$$ +cnt=119 +filesize=48000 + +status=1 # failure is the default! +trap "_cleanup; exit \$status" 0 1 2 3 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +_create_file() +{ + if [ $1 -ne 2 ]; then + tmpfile="$SCRATCH_MNT/tmp_file" + else + mkdir -p $SCRATCH_MNT/tmp_dir + tmpfile="$SCRATCH_MNT/tmp_dir/tmp_file" + fi + + for i in `seq $cnt -1 0`; do + dd if=/dev/zero of=$tmpfile bs=4k count=1 \ + conv=notrunc seek=$i oflag=sync &>/dev/null + done + # get md5sum + md5sum $tmpfile > /tmp/checksum +} + +_btrfs_online_defrag() +{ + str="" + # start = -1 is invalid, should fail + if [ "$2" = "2" ];then + str="$str -s -1 -l $((filesize / 2)) " + elif [ "$2" = "3" ];then + str="$str -s $((filesize + 1)) -l $((filesize / 2)) " + # len = -1 is invalid, should fail + elif [ "$2" = "4" ];then + str="$str -l -1 " + elif [ "$2" = "5" ];then + str="$str -l $((filesize + 1)) " + elif [ "$2" = "6" ];then + str="$str -l $((filesize / 2)) " + fi + + if [ "$3" = "2" ];then + str="$str -c " + fi + + if [ "$str" != "" ]; then + $BTRFS_UTIL_PROG filesystem defragment $str $SCRATCH_MNT/tmp_file >> $seq.full 2>&1 + else + if [ "$1" = "1" ];then + $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_file >> $seq.full 2>&1 + elif [ "$1" = "2" ];then + $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_dir >> $seq.full 2>&1 + elif [ "$1" = "3" ];then + $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT >> $seq.full 2>&1 + fi + fi + ret_val=$? + _scratch_remount + # Older defrag returned "20" for success + # e9393c2 btrfs-progs: defrag return zero on success + if [ $ret_val -ne 0 -a $ret_val -ne 20 ]; then + echo "btrfs filesystem defragment failed!" + fi +} + +_checksum() +{ + md5sum -c /tmp/checksum > /dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "md5 checksum failed!" + fi +} + +_cleanup_defrag() +{ + umount $SCRATCH_MNT > /dev/null 2>&1 +} + +_setup_defrag() +{ + umount $SCRATCH_MNT > /dev/null 2>&1 + _scratch_mkfs > /dev/null 2>&1 + _scratch_mount + _create_file $1 +} + +_rundefrag() +{ + _setup_defrag $1 + _btrfs_online_defrag $1 $2 $3 + _checksum + _cleanup_defrag + _check_scratch_fs +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter +. ./common/defrag + +# real QA test starts here +_supported_fs btrfs +_supported_os Linux + +_setup_testdir +## We require scratch so that we'll have free contiguous space +_require_scratch +_scratch_mkfs >/dev/null 2>&1 +_scratch_mount +_require_defrag + +echo "defrag object | defragment range | defragment compress" +echo "a single file | default | off" +_rundefrag 1 1 1 + +echo "a single file | default | on" +_rundefrag 1 1 2 + +echo "a single file | start < 0 && 0 < len < file size | off (should fail)" +_rundefrag 1 2 1 + +echo "a single file | start > file size && 0 < len < file size | off" +_rundefrag 1 3 1 + +echo "a single file | start = 0 && len < 0 | off (should fail)" +_rundefrag 1 4 1 + +echo "a single file | start = 0 && len > file size | off" +_rundefrag 1 5 1 + +echo "a single file | start = 0 && 0 < len < file size | off" +_rundefrag 1 6 1 + +echo "a directory | default | off" +_rundefrag 2 1 1 + +echo "a filesystem | default | off" +_rundefrag 3 1 1 + +status=0 +exit diff --git a/tests/btrfs/005.out b/tests/btrfs/005.out new file mode 100644 index 00000000..f0574d6b --- /dev/null +++ b/tests/btrfs/005.out @@ -0,0 +1,13 @@ +QA output created by 005 +defrag object | defragment range | defragment compress +a single file | default | off +a single file | default | on +a single file | start < 0 && 0 < len < file size | off (should fail) +btrfs filesystem defragment failed! +a single file | start > file size && 0 < len < file size | off +a single file | start = 0 && len < 0 | off (should fail) +btrfs filesystem defragment failed! +a single file | start = 0 && len > file size | off +a single file | start = 0 && 0 < len < file size | off +a directory | default | off +a filesystem | default | off diff --git a/tests/btrfs/006 b/tests/btrfs/006 new file mode 100755 index 00000000..9f7beff4 --- /dev/null +++ b/tests/btrfs/006 @@ -0,0 +1,95 @@ +#! /bin/bash +# FS QA Test No. btrfs/006 +# +# run basic btrfs information commands in various ways +# sanity tests: filesystem show, label, sync, and device stats +# +#----------------------------------------------------------------------- +# Copyright (c) 2013 Red Hat, Inc. 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 +#----------------------------------------------------------------------- +# + +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 15 + +_cleanup() +{ + cd / + rm -f $tmp.* +} + +# get standard environment, filters and checks +. ./common/rc +. ./common/filter.btrfs + +# real QA test starts here + +# Modify as appropriate. +_supported_fs btrfs +_supported_os Linux +_require_scratch +_require_scratch_dev_pool + +rm -f $seqres.full + +FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'` +LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'` +TOTAL_DEVS=`echo $SCRATCH_DEV $SCRATCH_DEV_POOL | wc -w` +LABEL=TestLabel.$seq + +echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seqres.full + +_scratch_mkfs $SCRATCH_DEV_POOL >> $seqres.full 2>&1 || _fail "mkfs failed" + +# These have to be done unmounted...? +echo "== Set filesystem label to $LABEL" +$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL +echo "== Get filesystem label" +$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV + +echo "== Mount." +_scratch_mount + +echo "== Show filesystem by label" +$BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS +UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'` + +echo "UUID $UUID" >> $seqres.full + +echo "== Show filesystem by UUID" +$BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID + +echo "== Sync filesystem" +$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch + +echo "== Show device stats by mountpoint" +$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS +echo "== Show device stats by first/scratch dev" +$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats +echo "== Show device stats by second dev" +$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" +echo "== Show device stats by last dev" +$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" + +# success, all done +status=0 +exit diff --git a/tests/btrfs/006.out b/tests/btrfs/006.out new file mode 100644 index 00000000..ab33b7e8 --- /dev/null +++ b/tests/btrfs/006.out @@ -0,0 +1,41 @@ +== QA output created by 006 +== Set filesystem label to TestLabel.006 +== Get filesystem label +TestLabel.006 +== Mount. +== Show filesystem by label +Label: 'TestLabel.006' uuid: + Total devices FS bytes used + devid size used path SCRATCH_DEV + +== Show filesystem by UUID +Label: 'TestLabel.006' uuid: + Total devices FS bytes used + devid size used path SCRATCH_DEV + +== Sync filesystem +FSSync 'SCRATCH_MNT' +== Show device stats by mountpoint + [SCRATCH_DEV].corruption_errs + [SCRATCH_DEV].flush_io_errs + [SCRATCH_DEV].generation_errs + [SCRATCH_DEV].read_io_errs + [SCRATCH_DEV].write_io_errs +== Show device stats by first/scratch dev +[SCRATCH_DEV].corruption_errs +[SCRATCH_DEV].flush_io_errs +[SCRATCH_DEV].generation_errs +[SCRATCH_DEV].read_io_errs +[SCRATCH_DEV].write_io_errs +== Show device stats by second dev +[FIRST_POOL_DEV].write_io_errs 0 +[FIRST_POOL_DEV].read_io_errs 0 +[FIRST_POOL_DEV].flush_io_errs 0 +[FIRST_POOL_DEV].corruption_errs 0 +[FIRST_POOL_DEV].generation_errs 0 +== Show device stats by last dev +[LAST_POOL_DEV].write_io_errs 0 +[LAST_POOL_DEV].read_io_errs 0 +[LAST_POOL_DEV].flush_io_errs 0 +[LAST_POOL_DEV].corruption_errs 0 +[LAST_POOL_DEV].generation_errs 0 diff --git a/tests/btrfs/254 b/tests/btrfs/254 deleted file mode 100755 index 7ce09e11..00000000 --- a/tests/btrfs/254 +++ /dev/null @@ -1,107 +0,0 @@ -#! /bin/bash -# FS QA Test No. 254 -# -# Test btrfs's subvolume and snapshot support -# -#----------------------------------------------------------------------- -# Copyright (c) 2011 Red Hat. 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 -# -#----------------------------------------------------------------------- -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! - -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here -_supported_fs btrfs -_supported_os Linux -_require_scratch - -_scratch_mkfs > /dev/null 2>&1 -_scratch_mount - -# First test basic snapshotting -echo "Creating file foo in root dir" -dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 &> /dev/null -echo "List root dir" -ls $SCRATCH_MNT -echo "Creating snapshot of root dir" -$BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap | _filter_scratch -echo "List root dir after snapshot" -ls $SCRATCH_MNT -echo "List snapshot dir" -ls $SCRATCH_MNT/snap -rm -f $SCRATCH_MNT/foo -echo "List root dir after rm of foo" -ls $SCRATCH_MNT -echo "List snapshot dir" -ls $SCRATCH_MNT/snap - -# Test creating a normal subvolme -$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol | _filter_scratch -echo "Listing root dir" -ls $SCRATCH_MNT -echo "Listing subvol" -ls $SCRATCH_MNT/subvol - -# Test setting a default mount -echo "Creating file bar in subvol" -dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null -echo "Setting subvol to the default" -$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch -_scratch_remount -echo "List root dir which is now subvol" -ls $SCRATCH_MNT -_scratch_unmount -echo "Mounting sbuvolid=0 for the root dir" -_scratch_mount "-o subvolid=0" -echo "List root dir" -ls $SCRATCH_MNT -echo "Setting the root dir as the default again" -$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT | _filter_scratch -_scratch_remount -echo "List root dir" -ls $SCRATCH_MNT - -# Test listing the subvolumes -echo "Listing subvolumes" -$BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT | awk '{ print $NF }' - -# Delete the snapshot -$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/snap | _filter_scratch -echo "List root dir" -ls $SCRATCH_MNT -_scratch_remount -echo "List root dir" -ls $SCRATCH_MNT - -status=0 ; exit diff --git a/tests/btrfs/254.out b/tests/btrfs/254.out deleted file mode 100644 index d4b53463..00000000 --- a/tests/btrfs/254.out +++ /dev/null @@ -1,40 +0,0 @@ -QA output created by 254 -Creating file foo in root dir -List root dir -foo -Creating snapshot of root dir -Create a snapshot of 'SCRATCH_MNT' in 'SCRATCH_MNT/snap' -List root dir after snapshot -foo -snap -List snapshot dir -foo -List root dir after rm of foo -snap -List snapshot dir -foo -Create subvolume 'SCRATCH_MNT/subvol' -Listing root dir -snap -subvol -Listing subvol -Creating file bar in subvol -Setting subvol to the default -List root dir which is now subvol -bar -Mounting sbuvolid=0 for the root dir -List root dir -snap -subvol -Setting the root dir as the default again -List root dir -snap -subvol -Listing subvolumes -snap -subvol -Delete subvolume 'SCRATCH_MNT/snap' -List root dir -subvol -List root dir -subvol diff --git a/tests/btrfs/264 b/tests/btrfs/264 deleted file mode 100755 index b08667a1..00000000 --- a/tests/btrfs/264 +++ /dev/null @@ -1,191 +0,0 @@ -#!/bin/bash -# FS QA Test No. 264 -# -# Extented btrfs snapshot test cases -# -#----------------------------------------------------------------------- -# Copyright (c) 2011 Oracle 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 -# -#----------------------------------------------------------------------- -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! - -_cleanup() -{ - rm -f $tmp.* -} - -trap "_cleanup ; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -_need_to_be_root -_supported_fs btrfs -_supported_os Linux -_require_scratch - -_scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" -_scratch_mount - -# Create and save sha256sum -# arg1 FS to generate sha256 -# arg2 File name to save the sha256 output -_save_checksum() -{ - local i=0 - >$2 - cd $1 - for i in `find . -type f`; do sha256sum $i >> $2; done - cd $OLDPWD -} - -# Verify the sha256sum for a FS -# arg1 FS to be tested -# arg2 sha256 file -_verify_checksum() -{ - cd $1 - [ -f $2 ] || _fail "checksum file $2 not found" - sha256sum -c $2 | grep "FAILED" - cd $OLDPWD -} - -# Create a snapshot -# arg1 dest dir -# Return snapshot name in the SNAPNAME -_create_snap() -{ - local x - [ -d $1 ] || _fail "Destination dir $1 not present" - SNAPNAME=`mktemp -u $SCRATCH_MNT/snap.XXXXXX` - $BTRFS_UTIL_PROG subvolume snapshot $1 $SNAPNAME > /dev/null || _fail "snapshot create failed" -} - -# Reads and writes new data but does not allocate new blocks -# arg1 FS to be modified -_read_modify_write() -{ - local i - local FSIZE - for i in `find $1 -type f` - do - FSIZE=`stat -t $i | cut -d" " -f2` - dd if=$i of=/dev/null obs=$FSIZE count=1 status=noxfer 2>/dev/null & - dd if=/dev/urandom of=$i obs=$FSIZE count=1 status=noxfer 2>/dev/null & - done - wait $! -} - -# Fills the allocated blocks -# arg1 FS in question -_fill_blk() -{ - local FSIZE - local BLKS - local NBLK - local FALLOC - local WS - - for i in `find /$1 -type f` - do - FSIZE=`stat -t $i | cut -d" " -f2` - BLKS=`stat -c "%B" $i` - NBLK=`stat -c "%b" $i` - FALLOC=$(($BLKS * $NBLK)) - WS=$(($FALLOC - $FSIZE)) - dd if=/dev/urandom of=$i oseek=$FSIZE obs=$WS count=1 status=noxfer 2>/dev/null & - done - wait $! -} - -# Append a random size to the files -# arg1 : FS in question -_append_file() -{ - local FSIZE - local X - local N - local i - N=0 - for i in `find $1 -type f` - do - if [ $N == 0 ]; then - X=$i - FSIZE=`stat -t $X | cut -d" " -f2` - dd if=$X of=$X seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null & - N=$(($N+1)) - continue - fi - FSIZE=`stat -t $i | cut -d" " -f2` - dd if=$X of=$i seek=1 bs=$FSIZE obs=$FSIZE count=1 status=noxfer 2>/dev/null & - X=$i - done - wait $! -} - -##################### real QA test starts here################################### -# sv1 - is just a name nothing spl -firstvol="$SCRATCH_MNT/sv1" -$BTRFS_UTIL_PROG subvolume create $firstvol > /dev/null || _fail "btrfs subvolume create $firstvol failed" -dirp=`mktemp -duq $firstvol/dir.XXXXXX` -_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 -x -SNAPNAME=0 -_create_snap $firstvol -_save_checksum $firstvol $tmp.sv1.sum -_verify_checksum $SNAPNAME $tmp.sv1.sum - -#Append1 the files -_fill_blk $SNAPNAME -_verify_checksum $firstvol $tmp.sv1.sum - -#Append2 the files -_append_file $SNAPNAME -_verify_checksum $firstvol $tmp.sv1.sum - -#read modify write -_read_modify_write $SNAPNAME -_verify_checksum $firstvol $tmp.sv1.sum - -#nested snapshot test -src_vol=$firstvol -for i in `seq 1 7`; do - SNAPNAME=0 - _create_snap $src_vol - _verify_checksum $SNAPNAME $tmp.sv1.sum - src_vol=$SNAPNAME -done - -# file delete test -SNAPNAME=0 -_create_snap $firstvol -tname=`echo $SNAPNAME | rev | cut -d"/" -f1 | rev` -_save_checksum $SNAPNAME $tmp.$tname.sum -\rm -rf $firstvol/* -_verify_checksum $SNAPNAME $tmp.$tname.sum - -umount $SCRATCH_DEV || _fail "unmount failed" - -echo "Silence is golden" -status=0; exit diff --git a/tests/btrfs/264.out b/tests/btrfs/264.out deleted file mode 100644 index eca790b5..00000000 --- a/tests/btrfs/264.out +++ /dev/null @@ -1,2 +0,0 @@ -QA output created by 264 -Silence is golden diff --git a/tests/btrfs/265 b/tests/btrfs/265 deleted file mode 100755 index 79a9ddf5..00000000 --- a/tests/btrfs/265 +++ /dev/null @@ -1,186 +0,0 @@ -#! /bin/bash -# FS QA Test No. 265 -# -# btrfs vol tests -# -#----------------------------------------------------------------------- -# Copyright (c) 2011 Oracle. 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 -#----------------------------------------------------------------------- -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 # failure is the default! -dev_removed=0 -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* - if [ $dev_removed == 1 ]; then - umount $SCRATCH_MNT - _devmgt_add "${DEVHTL}" - fi -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -_need_to_be_root -_supported_fs btrfs -_supported_os Linux -_require_scratch -_require_scratch_dev_pool -_require_deletable_scratch_dev_pool - -# Test cases related to raid in btrfs -_test_raid0() -{ - export MKFS_OPTIONS="-m raid0 -d raid0" - _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - umount $SCRATCH_MNT -} - -_test_raid1() -{ - export MKFS_OPTIONS="-m raid1 -d raid1" - _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - umount $SCRATCH_MNT -} - -_test_raid10() -{ - export MKFS_OPTIONS="-m raid10 -d raid10" - _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - umount $SCRATCH_MNT -} - -_test_single() -{ - export MKFS_OPTIONS="-m single -d single" - _scratch_mkfs $SCRATCH_DEV_POOL > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - umount $SCRATCH_MNT -} - -_test_add() -{ - local i - local devs[]="( $SCRATCH_DEV_POOL )" - local n=${#devs[@]} - - n=$(($n-1)) - - export MKFS_OPTIONS="" - _scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - for i in `seq 1 $n`; do - $BTRFS_UTIL_PROG device add ${devs[$i]} $SCRATCH_MNT > /dev/null 2>&1 || _fail "device add failed" - done - $BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "balance failed" - umount $SCRATCH_MNT -} - -_test_replace() -{ - local i - local devs=( $SCRATCH_DEV_POOL ) - local n=${#devs[@]} - local ds - local d - local DEVHTL="" - - # exclude the last disk in the disk pool - n=$(($n-1)) - ds=${devs[@]:0:$n} - - export MKFS_OPTIONS="-m raid1 -d raid1" - _scratch_mkfs "$ds" > /dev/null 2>&1 || _fail "tr: mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - - #pick the 2nd last disk - ds=${devs[@]:$(($n-1)):1} - - # retrive the HTL for this scsi disk - d=`echo $ds|cut -d"/" -f3` - DEVHTL=`ls -l /sys/class/block/${d} | rev | cut -d "/" -f 3 | rev` - - #fail disk - _devmgt_remove ${DEVHTL} - dev_removed=1 - - $BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" > /dev/null || _fail \ - "btrfs did not report device missing" - - # add a new disk to btrfs - ds=${devs[@]:$(($n)):1} - $BTRFS_UTIL_PROG device add ${ds} $SCRATCH_MNT > /dev/null 2>&1 || _fail "dev add failed" - # in some system balance fails if there is no delay (a bug) - # putting sleep 10 to work around as of now - # sleep 10 - $BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "dev balance failed" - - # cleaup. add the removed disk - umount $SCRATCH_MNT - _devmgt_add "${DEVHTL}" - dev_removed=0 -} - -_test_remove() -{ - _scratch_mkfs "$SCRATCH_DEV_POOL" > /dev/null 2>&1 || _fail "mkfs failed" - _scratch_mount - dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX` - _populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 - - # pick last dev in the list - dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'` - $BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed" - $BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV 2>&1 | grep $dev_del > /dev/null && _fail "btrfs still shows the deleted dev" - umount $SCRATCH_MNT -} - -_test_raid0 -_test_raid1 -_test_raid10 -_test_single -_test_add -_test_replace -_test_remove - -echo "Silence is golden" -status=0; exit diff --git a/tests/btrfs/265.out b/tests/btrfs/265.out deleted file mode 100644 index 9fa4eb05..00000000 --- a/tests/btrfs/265.out +++ /dev/null @@ -1,2 +0,0 @@ -QA output created by 265 -Silence is golden diff --git a/tests/btrfs/276 b/tests/btrfs/276 deleted file mode 100755 index 9d68b548..00000000 --- a/tests/btrfs/276 +++ /dev/null @@ -1,266 +0,0 @@ -#! /bin/bash -# FSQA Test No. 276 -# -# Run fsstress to create a reasonably strange file system, make a -# snapshot and run more fsstress. Then select some files from that fs, -# run filefrag to get the extent mapping and follow the backrefs. -# We check to end up back at the original file with the correct offset. -# -#----------------------------------------------------------------------- -# Copyright (C) 2011 STRATO. 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 -# -#----------------------------------------------------------------------- -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" - -here=`pwd` -tmp=/tmp/$$ -status=1 -noise_pid=0 - -_cleanup() -{ - rm $tmp.running - wait - rm -f $tmp.* -} -trap "_cleanup; exit \$status" 0 1 2 3 15 - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter - -# real QA test starts here -_need_to_be_root -_supported_fs btrfs -_supported_os Linux -_require_scratch -_require_no_large_scratch_dev -_require_btrfs inspect-internal -_require_command "/usr/sbin/filefrag" - -rm -f $seqres.full - -FILEFRAG_FILTER='if (/, blocksize (\d+)/) {$blocksize = $1; next} ($ext, '\ -'$logical, $physical, $expected, $length, $flags) = (/^\s*(\d+)\s+(\d+)'\ -'\s+(\d+)\s+(?:(\d+)\s+)?(\d+)\s+(.*)/) or next; $flags =~ '\ -'/(?:^|,)inline(?:,|$)/ and next; print $physical * $blocksize, "#", '\ -'$length * $blocksize, "#", $logical * $blocksize, " "' - -# this makes filefrag output script readable by using a perl helper. -# output is one extent per line, with three numbers separated by '#' -# the numbers are: physical, length, logical (all in bytes) -# sample output: "1234#10#5678" -> physical 1234, length 10, logical 5678 -_filter_extents() -{ - tee -a $seqres.full | $PERL_PROG -ne "$FILEFRAG_FILTER" -} - -_check_file_extents() -{ - cmd="filefrag -v $1" - echo "# $cmd" >> $seqres.full - out=`$cmd | _filter_extents` - if [ -z "$out" ]; then - return 1 - fi - echo "after filter: $out" >> $seqres.full - echo $out - return 0 -} - -# use a logical address and walk the backrefs back to the inode. -# compare to the expected result. -# returns 0 on success, 1 on error (with output made) -_btrfs_inspect_addr() -{ - mp=$1 - addr=$2 - expect_addr=$3 - expect_inum=$4 - file=$5 - cmd="$BTRFS_UTIL_PROG inspect-internal logical-resolve -P $addr $mp" - echo "# $cmd" >> $seqres.full - out=`$cmd` - echo "$out" >> $seqres.full - grep_expr="inode $expect_inum offset $expect_addr root" - echo "$out" | grep "^$grep_expr 5$" >/dev/null - ret=$? - if [ $ret -eq 0 ]; then - # look for a root number that is not 5 - echo "$out" | grep "^$grep_expr \([0-46-9][0-9]*\|5[0-9]\+\)$" \ - >/dev/null - ret=$? - fi - if [ $ret -eq 0 ]; then - return 0 - fi - echo "unexpected output from" - echo " $cmd" - echo "expected inum: $expect_inum, expected address: $expect_addr,"\ - "file: $file, got:" - echo "$out" - return 1 -} - -# use an inode number and walk the backrefs back to the file name. -# compare to the expected result. -# returns 0 on success, 1 on error (with output made) -_btrfs_inspect_inum() -{ - file=$1 - inum=$2 - snap_name=$3 - mp="$SCRATCH_MNT/$snap_name" - cmd="$BTRFS_UTIL_PROG inspect-internal inode-resolve $inum $mp" - echo "# $cmd" >> $seqres.full - out=`$cmd` - echo "$out" >> $seqres.full - grep_expr="^$file$" - cnt=`echo "$out" | grep "$grep_expr" | wc -l` - if [ $cnt -ge "1" ]; then - return 0 - fi - echo "unexpected output from" - echo " $cmd" - echo "expected path: $file, got:" - echo "$out" - return 1 -} - -_btrfs_inspect_check() -{ - file=$1 - physical=$2 - length=$3 - logical=$4 - snap_name=$5 - cmd="stat -c %i $file" - echo "# $cmd" >> $seqres.full - inum=`$cmd` - echo "$inum" >> $seqres.full - _btrfs_inspect_addr $SCRATCH_MNT $physical $logical $inum $file - ret=$? - if [ $ret -eq 0 ]; then - _btrfs_inspect_inum $file $inum $snap_name - ret=$? - fi - return $ret -} - -workout() -{ - fsz=$1 - nfiles=$2 - procs=$3 - snap_name=$4 - do_bg_noise=$5 - - umount $SCRATCH_DEV >/dev/null 2>&1 - echo "*** mkfs -dsize=$fsz" >>$seqres.full - echo "" >>$seqres.full - _scratch_mkfs_sized $fsz >>$seqres.full 2>&1 \ - || _fail "size=$fsz mkfs failed" - run_check _scratch_mount - # -w ensures that the only ops are ones which cause write I/O - run_check $FSSTRESS_PROG -d $SCRATCH_MNT -w -p $procs -n 2000 \ - $FSSTRESS_AVOID - - run_check $BTRFS_UTIL_PROG subvol snap $SCRATCH_MNT \ - $SCRATCH_MNT/$snap_name - - run_check umount $SCRATCH_DEV >/dev/null 2>&1 - run_check _scratch_mount "-o compress=lzo" - - # make some noise but ensure we're not touching existing data - # extents. - run_check $FSSTRESS_PROG -d $SCRATCH_MNT -p $procs -n 4000 \ - -z -f chown=3 -f link=1 -f mkdir=2 -f mknod=2 \ - -f rename=2 -f setxattr=1 -f symlink=2 - - clean_dir="$SCRATCH_MNT/next" - mkdir $clean_dir - # now make more files to get a higher tree - run_check $FSSTRESS_PROG -d $clean_dir -w -p $procs -n 2000 \ - $FSSTRESS_AVOID - run_check umount $SCRATCH_DEV >/dev/null 2>&1 - run_check _scratch_mount "-o atime" - - if [ $do_bg_noise -ne 0 ]; then - # make background noise while backrefs are being walked - while [ -f "$tmp.running" ]; do - echo background fsstress >>$seqres.full - run_check $FSSTRESS_PROG -d $SCRATCH_MNT/bgnoise -n 999 - echo background rm >>$seqres.full - rm -rf $SCRATCH_MNT/bgnoise/ - done & - noise_pid=`jobs -p %1` - echo "background noise by $noise_pid" >>$seqres.full - fi - - cnt=0 - errcnt=0 - dir="$SCRATCH_MNT/$snap_name/" - for file in `find $dir -name f\* -size +0 | sort -R`; do - extents=`_check_file_extents $file` - ret=$? - if [ $ret -ne 0 ]; then - continue; - fi - for i in $extents; do - physical=$i - length=$i - logical=$i - physical=`echo $physical | sed -e 's/#.*//'` - length=`echo $length | sed -e 's/[^#]+#//'` - length=`echo $length | sed -e 's/#.*//'` - logical=`echo $logical | sed -e 's/.*#//'` - _btrfs_inspect_check $file $physical $length $logical \ - $snap_name - ret=$? - if [ $ret -ne 0 ]; then - errcnt=`expr $errcnt + 1` - fi - done - cnt=`expr $cnt + 1` - if [ $cnt -ge $nfiles ]; then - break - fi - done - - if [ $errcnt -gt 0 ]; then - _fail "test failed: $errcnt error(s)" - fi -} - -echo "*** test backref walking" - -snap_name="snap1" -filesize=`expr 2000 \* 1024 \* 1024` -nfiles=4 -numprocs=1 -do_bg_noise=1 - -touch $tmp.running - -workout $filesize $nfiles $numprocs $snap_name $do_bg_noise - -echo "*** done" -status=0 -exit diff --git a/tests/btrfs/276.out b/tests/btrfs/276.out deleted file mode 100644 index 51131646..00000000 --- a/tests/btrfs/276.out +++ /dev/null @@ -1,3 +0,0 @@ -QA output created by 276 -*** test backref walking -*** done diff --git a/tests/btrfs/284 b/tests/btrfs/284 deleted file mode 100755 index 67161a31..00000000 --- a/tests/btrfs/284 +++ /dev/null @@ -1,174 +0,0 @@ -#! /bin/bash -# FS QA Test No. 284 -# -# Btrfs Online defragmentation tests -# -#----------------------------------------------------------------------- -# Copyright (c) 2012 Fujitsu Liu Bo. 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 -#----------------------------------------------------------------------- -# - -seq=`basename $0` -seqres=$RESULT_DIR/$seq -echo "QA output created by $seq" -here="`pwd`" -tmp=/tmp/$$ -cnt=119 -filesize=48000 - -status=1 # failure is the default! -trap "_cleanup; exit \$status" 0 1 2 3 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -_create_file() -{ - if [ $1 -ne 2 ]; then - tmpfile="$SCRATCH_MNT/tmp_file" - else - mkdir -p $SCRATCH_MNT/tmp_dir - tmpfile="$SCRATCH_MNT/tmp_dir/tmp_file" - fi - - for i in `seq $cnt -1 0`; do - dd if=/dev/zero of=$tmpfile bs=4k count=1 \ - conv=notrunc seek=$i oflag=sync &>/dev/null - done - # get md5sum - md5sum $tmpfile > /tmp/checksum -} - -_btrfs_online_defrag() -{ - str="" - # start = -1 is invalid, should fail - if [ "$2" = "2" ];then - str="$str -s -1 -l $((filesize / 2)) " - elif [ "$2" = "3" ];then - str="$str -s $((filesize + 1)) -l $((filesize / 2)) " - # len = -1 is invalid, should fail - elif [ "$2" = "4" ];then - str="$str -l -1 " - elif [ "$2" = "5" ];then - str="$str -l $((filesize + 1)) " - elif [ "$2" = "6" ];then - str="$str -l $((filesize / 2)) " - fi - - if [ "$3" = "2" ];then - str="$str -c " - fi - - if [ "$str" != "" ]; then - $BTRFS_UTIL_PROG filesystem defragment $str $SCRATCH_MNT/tmp_file >> $seq.full 2>&1 - else - if [ "$1" = "1" ];then - $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_file >> $seq.full 2>&1 - elif [ "$1" = "2" ];then - $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_dir >> $seq.full 2>&1 - elif [ "$1" = "3" ];then - $BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT >> $seq.full 2>&1 - fi - fi - ret_val=$? - _scratch_remount - # Older defrag returned "20" for success - # e9393c2 btrfs-progs: defrag return zero on success - if [ $ret_val -ne 0 -a $ret_val -ne 20 ]; then - echo "btrfs filesystem defragment failed!" - fi -} - -_checksum() -{ - md5sum -c /tmp/checksum > /dev/null 2>&1 - if [ $? -ne 0 ]; then - echo "md5 checksum failed!" - fi -} - -_cleanup_defrag() -{ - umount $SCRATCH_MNT > /dev/null 2>&1 -} - -_setup_defrag() -{ - umount $SCRATCH_MNT > /dev/null 2>&1 - _scratch_mkfs > /dev/null 2>&1 - _scratch_mount - _create_file $1 -} - -_rundefrag() -{ - _setup_defrag $1 - _btrfs_online_defrag $1 $2 $3 - _checksum - _cleanup_defrag - _check_scratch_fs -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter -. ./common/defrag - -# real QA test starts here -_supported_fs btrfs -_supported_os Linux - -_setup_testdir -## We require scratch so that we'll have free contiguous space -_require_scratch -_scratch_mkfs >/dev/null 2>&1 -_scratch_mount -_require_defrag - -echo "defrag object | defragment range | defragment compress" -echo "a single file | default | off" -_rundefrag 1 1 1 - -echo "a single file | default | on" -_rundefrag 1 1 2 - -echo "a single file | start < 0 && 0 < len < file size | off (should fail)" -_rundefrag 1 2 1 - -echo "a single file | start > file size && 0 < len < file size | off" -_rundefrag 1 3 1 - -echo "a single file | start = 0 && len < 0 | off (should fail)" -_rundefrag 1 4 1 - -echo "a single file | start = 0 && len > file size | off" -_rundefrag 1 5 1 - -echo "a single file | start = 0 && 0 < len < file size | off" -_rundefrag 1 6 1 - -echo "a directory | default | off" -_rundefrag 2 1 1 - -echo "a filesystem | default | off" -_rundefrag 3 1 1 - -status=0 -exit diff --git a/tests/btrfs/284.out b/tests/btrfs/284.out deleted file mode 100644 index c9422712..00000000 --- a/tests/btrfs/284.out +++ /dev/null @@ -1,13 +0,0 @@ -QA output created by 284 -defrag object | defragment range | defragment compress -a single file | default | off -a single file | default | on -a single file | start < 0 && 0 < len < file size | off (should fail) -btrfs filesystem defragment failed! -a single file | start > file size && 0 < len < file size | off -a single file | start = 0 && len < 0 | off (should fail) -btrfs filesystem defragment failed! -a single file | start = 0 && len > file size | off -a single file | start = 0 && 0 < len < file size | off -a directory | default | off -a filesystem | default | off diff --git a/tests/btrfs/307 b/tests/btrfs/307 deleted file mode 100755 index 87314c67..00000000 --- a/tests/btrfs/307 +++ /dev/null @@ -1,95 +0,0 @@ -#! /bin/bash -# FS QA Test No. 307 -# -# run basic btrfs information commands in various ways -# sanity tests: filesystem show, label, sync, and device stats -# -#----------------------------------------------------------------------- -# Copyright (c) 2013 Red Hat, Inc. 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 -#----------------------------------------------------------------------- -# - -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 15 - -_cleanup() -{ - cd / - rm -f $tmp.* -} - -# get standard environment, filters and checks -. ./common/rc -. ./common/filter.btrfs - -# real QA test starts here - -# Modify as appropriate. -_supported_fs btrfs -_supported_os Linux -_require_scratch -_require_scratch_dev_pool - -rm -f $seqres.full - -FIRST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $1}'` -LAST_POOL_DEV=`echo $SCRATCH_DEV_POOL | awk '{print $NF}'` -TOTAL_DEVS=`echo $SCRATCH_DEV $SCRATCH_DEV_POOL | wc -w` -LABEL=TestLabel.$seq - -echo "Scratch $SCRATCH_DEV First $FIRST_POOL_DEV last $LAST_POOL_DEV Total $TOTAL_DEVS" > $seqres.full - -_scratch_mkfs $SCRATCH_DEV_POOL >> $seqres.full 2>&1 || _fail "mkfs failed" - -# These have to be done unmounted...? -echo "== Set filesystem label to $LABEL" -$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV $LABEL -echo "== Get filesystem label" -$BTRFS_UTIL_PROG filesystem label $SCRATCH_DEV - -echo "== Mount." -_scratch_mount - -echo "== Show filesystem by label" -$BTRFS_UTIL_PROG filesystem show $LABEL | _filter_btrfs_filesystem_show $TOTAL_DEVS -UUID=`$BTRFS_UTIL_PROG filesystem show $LABEL | grep uuid: | awk '{print $NF}'` - -echo "UUID $UUID" >> $seqres.full - -echo "== Show filesystem by UUID" -$BTRFS_UTIL_PROG filesystem show $UUID | _filter_btrfs_filesystem_show $TOTAL_DEVS $UUID - -echo "== Sync filesystem" -$BTRFS_UTIL_PROG filesystem sync $SCRATCH_MNT | _filter_scratch - -echo "== Show device stats by mountpoint" -$BTRFS_UTIL_PROG device stats $SCRATCH_MNT | _filter_btrfs_device_stats $TOTAL_DEVS -echo "== Show device stats by first/scratch dev" -$BTRFS_UTIL_PROG device stats $SCRATCH_DEV | _filter_btrfs_device_stats -echo "== Show device stats by second dev" -$BTRFS_UTIL_PROG device stats $FIRST_POOL_DEV | sed -e "s,$FIRST_POOL_DEV,FIRST_POOL_DEV,g" -echo "== Show device stats by last dev" -$BTRFS_UTIL_PROG device stats $LAST_POOL_DEV | sed -e "s,$LAST_POOL_DEV,LAST_POOL_DEV,g" - -# success, all done -status=0 -exit diff --git a/tests/btrfs/307.out b/tests/btrfs/307.out deleted file mode 100644 index ea9a6210..00000000 --- a/tests/btrfs/307.out +++ /dev/null @@ -1,41 +0,0 @@ -== QA output created by 307 -== Set filesystem label to TestLabel.307 -== Get filesystem label -TestLabel.307 -== Mount. -== Show filesystem by label -Label: 'TestLabel.307' uuid: - Total devices FS bytes used - devid size used path SCRATCH_DEV - -== Show filesystem by UUID -Label: 'TestLabel.307' uuid: - Total devices FS bytes used - devid size used path SCRATCH_DEV - -== Sync filesystem -FSSync 'SCRATCH_MNT' -== Show device stats by mountpoint - [SCRATCH_DEV].corruption_errs - [SCRATCH_DEV].flush_io_errs - [SCRATCH_DEV].generation_errs - [SCRATCH_DEV].read_io_errs - [SCRATCH_DEV].write_io_errs -== Show device stats by first/scratch dev -[SCRATCH_DEV].corruption_errs -[SCRATCH_DEV].flush_io_errs -[SCRATCH_DEV].generation_errs -[SCRATCH_DEV].read_io_errs -[SCRATCH_DEV].write_io_errs -== Show device stats by second dev -[FIRST_POOL_DEV].write_io_errs 0 -[FIRST_POOL_DEV].read_io_errs 0 -[FIRST_POOL_DEV].flush_io_errs 0 -[FIRST_POOL_DEV].corruption_errs 0 -[FIRST_POOL_DEV].generation_errs 0 -== Show device stats by last dev -[LAST_POOL_DEV].write_io_errs 0 -[LAST_POOL_DEV].read_io_errs 0 -[LAST_POOL_DEV].flush_io_errs 0 -[LAST_POOL_DEV].corruption_errs 0 -[LAST_POOL_DEV].generation_errs 0 diff --git a/tests/btrfs/group b/tests/btrfs/group index bc6c256c..6f9325e3 100644 --- a/tests/btrfs/group +++ b/tests/btrfs/group @@ -3,9 +3,9 @@ # - do not start group names with a digit # - comment line before each group is "new" description # -254 auto quick -264 auto -265 auto -276 auto rw metadata -284 auto -307 auto quick +001 auto quick +002 auto +003 auto +004 auto rw metadata +005 auto +006 auto quick