mirror of
https://github.com/linux-apfs/apfstests.git
synced 2026-05-01 15:01:44 -07:00
xfstests: use BTRFS_UTIL_PROG instead of btrfs
Signed-off-by: David Sterba <dsterba@suse.cz> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Signed-off-by: Rich Johnston <rjohnston@sgi.com>
This commit is contained in:
committed by
Rich Johnston
parent
2c13db28be
commit
0edeaaab2a
+6
-6
@@ -58,7 +58,7 @@ dd if=/dev/zero of=$SCRATCH_MNT/foo bs=1M count=1 &> /dev/null
|
|||||||
echo "List root dir"
|
echo "List root dir"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
echo "Creating snapshot of root dir"
|
echo "Creating snapshot of root dir"
|
||||||
btrfs subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap | _filter_scratch
|
$BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap | _filter_scratch
|
||||||
echo "List root dir after snapshot"
|
echo "List root dir after snapshot"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
echo "List snapshot dir"
|
echo "List snapshot dir"
|
||||||
@@ -70,7 +70,7 @@ echo "List snapshot dir"
|
|||||||
ls $SCRATCH_MNT/snap
|
ls $SCRATCH_MNT/snap
|
||||||
|
|
||||||
# Test creating a normal subvolme
|
# Test creating a normal subvolme
|
||||||
btrfs subvolume create $SCRATCH_MNT/subvol | _filter_scratch
|
$BTRFS_UTIL_PROG subvolume create $SCRATCH_MNT/subvol | _filter_scratch
|
||||||
echo "Listing root dir"
|
echo "Listing root dir"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
echo "Listing subvol"
|
echo "Listing subvol"
|
||||||
@@ -80,7 +80,7 @@ ls $SCRATCH_MNT/subvol
|
|||||||
echo "Creating file bar in subvol"
|
echo "Creating file bar in subvol"
|
||||||
dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null
|
dd if=/dev/zero of=$SCRATCH_MNT/subvol/bar bs=1M count=1 &> /dev/null
|
||||||
echo "Setting subvol to the default"
|
echo "Setting subvol to the default"
|
||||||
btrfs subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch
|
$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT/subvol | _filter_scratch
|
||||||
_scratch_remount
|
_scratch_remount
|
||||||
echo "List root dir which is now subvol"
|
echo "List root dir which is now subvol"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
@@ -90,17 +90,17 @@ _scratch_mount "-o subvolid=0"
|
|||||||
echo "List root dir"
|
echo "List root dir"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
echo "Setting the root dir as the default again"
|
echo "Setting the root dir as the default again"
|
||||||
btrfs subvolume set-default 0 $SCRATCH_MNT | _filter_scratch
|
$BTRFS_UTIL_PROG subvolume set-default 0 $SCRATCH_MNT | _filter_scratch
|
||||||
_scratch_remount
|
_scratch_remount
|
||||||
echo "List root dir"
|
echo "List root dir"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
|
|
||||||
# Test listing the subvolumes
|
# Test listing the subvolumes
|
||||||
echo "Listing subvolumes"
|
echo "Listing subvolumes"
|
||||||
btrfs subvolume list $SCRATCH_MNT | awk '{ print $NF }'
|
$BTRFS_UTIL_PROG subvolume list $SCRATCH_MNT | awk '{ print $NF }'
|
||||||
|
|
||||||
# Delete the snapshot
|
# Delete the snapshot
|
||||||
btrfs subvolume delete $SCRATCH_MNT/snap | _filter_scratch
|
$BTRFS_UTIL_PROG subvolume delete $SCRATCH_MNT/snap | _filter_scratch
|
||||||
echo "List root dir"
|
echo "List root dir"
|
||||||
ls $SCRATCH_MNT
|
ls $SCRATCH_MNT
|
||||||
_scratch_remount
|
_scratch_remount
|
||||||
|
|||||||
+2
-2
@@ -83,7 +83,7 @@ _create_snap()
|
|||||||
local x
|
local x
|
||||||
[ -d $1 ] || _fail "Destination dir $1 not present"
|
[ -d $1 ] || _fail "Destination dir $1 not present"
|
||||||
SNAPNAME=`mktemp -u $SCRATCH_MNT/snap.XXXXXX`
|
SNAPNAME=`mktemp -u $SCRATCH_MNT/snap.XXXXXX`
|
||||||
btrfs subvolume snapshot $1 $SNAPNAME > /dev/null || _fail "snapshot create failed"
|
$BTRFS_UTIL_PROG subvolume snapshot $1 $SNAPNAME > /dev/null || _fail "snapshot create failed"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Reads and writes new data but does not allocate new blocks
|
# Reads and writes new data but does not allocate new blocks
|
||||||
@@ -152,7 +152,7 @@ _append_file()
|
|||||||
##################### real QA test starts here###################################
|
##################### real QA test starts here###################################
|
||||||
# sv1 - is just a name nothing spl
|
# sv1 - is just a name nothing spl
|
||||||
firstvol="$SCRATCH_MNT/sv1"
|
firstvol="$SCRATCH_MNT/sv1"
|
||||||
btrfs subvolume create $firstvol > /dev/null || _fail "btrfs subvolume create $firstvol failed"
|
$BTRFS_UTIL_PROG subvolume create $firstvol > /dev/null || _fail "btrfs subvolume create $firstvol failed"
|
||||||
dirp=`mktemp -duq $firstvol/dir.XXXXXX`
|
dirp=`mktemp -duq $firstvol/dir.XXXXXX`
|
||||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 -x
|
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10 -x
|
||||||
SNAPNAME=0
|
SNAPNAME=0
|
||||||
|
|||||||
+7
-7
@@ -110,9 +110,9 @@ _test_add()
|
|||||||
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
dirp=`mktemp -duq $SCRATCH_MNT/dir.XXXXXX`
|
||||||
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
_populate_fs -n 1 -f 20 -d 10 -r $dirp -s 10
|
||||||
for i in `seq 1 $n`; do
|
for i in `seq 1 $n`; do
|
||||||
btrfs device add ${devs[$i]} $SCRATCH_MNT > /dev/null 2>&1 || _fail "device add failed"
|
$BTRFS_UTIL_PROG device add ${devs[$i]} $SCRATCH_MNT > /dev/null 2>&1 || _fail "device add failed"
|
||||||
done
|
done
|
||||||
btrfs filesystem balance $SCRATCH_MNT || _fail "balance failed"
|
$BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "balance failed"
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,16 +146,16 @@ _test_replace()
|
|||||||
_devmgt_remove ${DEVHTL}
|
_devmgt_remove ${DEVHTL}
|
||||||
dev_removed=1
|
dev_removed=1
|
||||||
|
|
||||||
btrfs fi show $SCRATCH_DEV | grep "Some devices missing" > /dev/null || _fail \
|
$BTRFS_UTIL_PROG fi show $SCRATCH_DEV | grep "Some devices missing" > /dev/null || _fail \
|
||||||
"btrfs did not report device missing"
|
"btrfs did not report device missing"
|
||||||
|
|
||||||
# add a new disk to btrfs
|
# add a new disk to btrfs
|
||||||
ds=${devs[@]:$(($n)):1}
|
ds=${devs[@]:$(($n)):1}
|
||||||
btrfs device add ${ds} $SCRATCH_MNT > /dev/null 2>&1 || _fail "dev add failed"
|
$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)
|
# in some system balance fails if there is no delay (a bug)
|
||||||
# putting sleep 10 to work around as of now
|
# putting sleep 10 to work around as of now
|
||||||
# sleep 10
|
# sleep 10
|
||||||
btrfs fi balance $SCRATCH_MNT || _fail "dev balance failed"
|
$BTRFS_UTIL_PROG filesystem balance $SCRATCH_MNT || _fail "dev balance failed"
|
||||||
|
|
||||||
# cleaup. add the removed disk
|
# cleaup. add the removed disk
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
@@ -172,8 +172,8 @@ _test_remove()
|
|||||||
|
|
||||||
# pick last dev in the list
|
# pick last dev in the list
|
||||||
dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'`
|
dev_del=`echo ${SCRATCH_DEV_POOL} | awk '{print $NF}'`
|
||||||
btrfs device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed"
|
$BTRFS_UTIL_PROG device delete $dev_del $SCRATCH_MNT || _fail "btrfs device delete failed"
|
||||||
btrfs fi show $SCRATCH_DEV 2>&1 | grep $dev_del > /dev/null && _fail "btrfs still shows the deleted dev"
|
$BTRFS_UTIL_PROG filesystem show $SCRATCH_DEV 2>&1 | grep $dev_del > /dev/null && _fail "btrfs still shows the deleted dev"
|
||||||
umount $SCRATCH_MNT
|
umount $SCRATCH_MNT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -79,14 +79,14 @@ _btrfs_online_defrag()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$str" != "" ]; then
|
if [ "$str" != "" ]; then
|
||||||
btrfs filesystem defragment $str $SCRATCH_MNT/tmp_file
|
$BTRFS_UTIL_PROG filesystem defragment $str $SCRATCH_MNT/tmp_file
|
||||||
else
|
else
|
||||||
if [ "$1" = "1" ];then
|
if [ "$1" = "1" ];then
|
||||||
btrfs filesystem defragment $SCRATCH_MNT/tmp_file
|
$BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_file
|
||||||
elif [ "$1" = "2" ];then
|
elif [ "$1" = "2" ];then
|
||||||
btrfs filesystem defragment $SCRATCH_MNT/tmp_dir
|
$BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT/tmp_dir
|
||||||
elif [ "$1" = "3" ];then
|
elif [ "$1" = "3" ];then
|
||||||
btrfs filesystem defragment $SCRATCH_MNT
|
$BTRFS_UTIL_PROG filesystem defragment $SCRATCH_MNT
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
ret_val=$?
|
ret_val=$?
|
||||||
|
|||||||
Reference in New Issue
Block a user