summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/mkfs-tests/001-basic-profiles/test.sh19
-rwxr-xr-xtests/mkfs-tests/004-rootdir-keeps-size/test.sh12
-rwxr-xr-xtests/mkfs-tests/005-long-device-name-for-ssd/test.sh20
-rwxr-xr-xtests/mkfs-tests/006-partitioned-loopdev/test.sh10
-rwxr-xr-xtests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh16
-rwxr-xr-xtests/mkfs-tests/008-sectorsize-nodesize-combination/test.sh10
-rwxr-xr-xtests/mkfs-tests/010-minimal-size/test.sh4
-rwxr-xr-xtests/mkfs-tests/012-rootdir-no-shrink/test.sh6
-rwxr-xr-xtests/mkfs-tests/013-reserved-1M-for-single/test.sh4
-rwxr-xr-xtests/mkfs-tests/014-rootdir-inline-extent/test.sh6
10 files changed, 53 insertions, 54 deletions
diff --git a/tests/mkfs-tests/001-basic-profiles/test.sh b/tests/mkfs-tests/001-basic-profiles/test.sh
index b84016f7..6e295274 100755
--- a/tests/mkfs-tests/001-basic-profiles/test.sh
+++ b/tests/mkfs-tests/001-basic-profiles/test.sh
@@ -11,28 +11,27 @@ setup_root_helper
test_get_info()
{
- run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $dev1
- run_check $SUDO_HELPER $TOP/btrfs check $dev1
- run_check $SUDO_HELPER mount $dev1 $TEST_MNT
- run_check $TOP/btrfs filesystem df $TEST_MNT
- run_check $SUDO_HELPER $TOP/btrfs filesystem usage $TEST_MNT
- run_check $SUDO_HELPER $TOP/btrfs device usage $TEST_MNT
+ run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dev1"
+ run_check $SUDO_HELPER "$TOP/btrfs" check "$dev1"
+ run_check $SUDO_HELPER mount "$dev1" "$TEST_MNT"
+ run_check "$TOP/btrfs" filesystem df "$TEST_MNT"
+ run_check $SUDO_HELPER "$TOP/btrfs" filesystem usage "$TEST_MNT"
+ run_check $SUDO_HELPER "$TOP/btrfs" device usage "$TEST_MNT"
run_check $SUDO_HELPER umount "$TEST_MNT"
}
test_do_mkfs()
{
- run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
- $@
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@"
}
test_mkfs_single()
{
- test_do_mkfs $@ $dev1
+ test_do_mkfs "$@" "$dev1"
test_get_info
}
test_mkfs_multi()
{
- test_do_mkfs $@ ${loopdevs[@]}
+ test_do_mkfs "$@" ${loopdevs[@]}
test_get_info
}
diff --git a/tests/mkfs-tests/004-rootdir-keeps-size/test.sh b/tests/mkfs-tests/004-rootdir-keeps-size/test.sh
index 4a84e6db..635a5137 100755
--- a/tests/mkfs-tests/004-rootdir-keeps-size/test.sh
+++ b/tests/mkfs-tests/004-rootdir-keeps-size/test.sh
@@ -13,12 +13,12 @@ test_mkfs_with_size() {
local tmp
size="$1"
- run_check truncate -s$size $TEST_DEV
- imgsize=$(run_check_stdout stat --format=%s $TEST_DEV)
- run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
- --rootdir $INTERNAL_BIN/Documentation \
- $TEST_DEV
- tmp=$(run_check_stdout stat --format=%s $TEST_DEV)
+ run_check truncate -s"$size" "$TEST_DEV"
+ imgsize=$(run_check_stdout stat --format=%s "$TEST_DEV")
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f \
+ --rootdir "$INTERNAL_BIN/Documentation" \
+ "$TEST_DEV"
+ tmp=$(run_check_stdout stat --format=%s "$TEST_DEV")
if ! [ "$imgsize" = "$tmp" ]; then
_fail "image size changed from $imgsize to $tmp"
fi
diff --git a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
index 55ce676e..b7c76b18 100755
--- a/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
+++ b/tests/mkfs-tests/005-long-device-name-for-ssd/test.sh
@@ -11,31 +11,31 @@ prepare_test_dev
# prep device
dmname=\
btrfs-test-with-very-long-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
-dmdev=/dev/mapper/$dmname
+dmdev="/dev/mapper/$dmname"
run_check truncate -s0 img
chmod a+w img
run_check truncate -s2g img
loopdev=`run_check_stdout $SUDO_HELPER losetup --find --show img`
-run_check $SUDO_HELPER dmsetup create $dmname --table "0 1048576 linear $loopdev 0"
+run_check $SUDO_HELPER dmsetup create "$dmname" --table "0 1048576 linear $loopdev 0"
-dmbase=`readlink -f $dmdev`
+dmbase=`readlink -f "$dmdev"`
base=`basename "$dmbase"`
-rot=/sys/class/block/$base/queue/rotational
+rot="/sys/class/block/$base/queue/rotational"
# switch rotational
run_check cat $rot
-echo 0 | run_check $SUDO_HELPER tee $rot
-run_check cat $rot
+echo 0 | run_check $SUDO_HELPER tee "$rot"
+run_check cat "$rot"
# test
-run_check_stdout $SUDO_HELPER $TOP/mkfs.btrfs -f $@ $dmdev |
+run_check_stdout $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@" "$dmdev" |
grep -q 'SSD detected:.*yes' || _fail 'SSD not detected'
-run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $dmdev
+run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$dmdev"
# cleanup
-run_check $SUDO_HELPER dmsetup remove $dmname
-run_mayfail $SUDO_HELPER losetup -d $loopdev
+run_check $SUDO_HELPER dmsetup remove "$dmname"
+run_mayfail $SUDO_HELPER losetup -d "$loopdev"
run_check truncate -s0 img
rm img
diff --git a/tests/mkfs-tests/006-partitioned-loopdev/test.sh b/tests/mkfs-tests/006-partitioned-loopdev/test.sh
index 06c254fd..5d972a78 100755
--- a/tests/mkfs-tests/006-partitioned-loopdev/test.sh
+++ b/tests/mkfs-tests/006-partitioned-loopdev/test.sh
@@ -18,15 +18,15 @@ cp partition-1g-1g img
run_check truncate -s2g img
loopdev=$(run_check_stdout $SUDO_HELPER losetup --partscan --find --show img)
-base=$(basename $loopdev)
+base=$(basename "$loopdev")
# expect partitions named like loop0p1 etc
-for looppart in $(ls /dev/$base?*); do
- run_check $SUDO_HELPER $TOP/mkfs.btrfs -f $looppart
- run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $looppart
+for looppart in $(ls /dev/"$base"?*); do
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$looppart"
+ run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$looppart"
done
# cleanup
-run_check $SUDO_HELPER losetup -d $loopdev
+run_check $SUDO_HELPER losetup -d "$loopdev"
run_check truncate -s0 img
rm img
diff --git a/tests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh b/tests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh
index f7e88c9a..31f44f33 100755
--- a/tests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh
+++ b/tests/mkfs-tests/007-mix-nodesize-sectorsize/test.sh
@@ -11,9 +11,9 @@ prepare_test_dev
test_mkfs_single()
{
- run_check $SUDO_HELPER $TOP/mkfs.btrfs -f "$@" $TEST_DEV
- run_check $SUDO_HELPER $TOP/btrfs inspect-internal dump-super $TEST_DEV
- run_check $SUDO_HELPER $TOP/btrfs check $TEST_DEV
+ run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f "$@" "$TEST_DEV"
+ run_check $SUDO_HELPER "$TOP/btrfs" inspect-internal dump-super "$TEST_DEV"
+ run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
}
# default
@@ -22,14 +22,14 @@ test_mkfs_single
# nodesize >= sectorsize
for nodesize in 4096 8192 16384 32768 65536; do
for sectorsize in 4096 8192 16384 32768 65536; do
- [ $nodesize -lt $sectorsize ] && continue
- test_mkfs_single -n $nodesize -s $sectorsize -d single -m single
- test_mkfs_single -n $nodesize -s $sectorsize -d single -m dup
+ [ "$nodesize" -lt "$sectorsize" ] && continue
+ test_mkfs_single -n "$nodesize" -s "$sectorsize" -d single -m single
+ test_mkfs_single -n "$nodesize" -s "$sectorsize" -d single -m dup
done
done
# nodesize, mixed mode
for nodesize in 4k 8k 16k 32k 64k; do
- test_mkfs_single -n $nodesize -s $nodesize -d single -m single --mixed
- test_mkfs_single -n $nodesize -s $nodesize -d dup -m dup --mixed
+ test_mkfs_single -n "$nodesize" -s "$nodesize" -d single -m single --mixed
+ test_mkfs_single -n "$nodesize" -s "$nodesize" -d dup -m dup --mixed
done
diff --git a/tests/mkfs-tests/008-sectorsize-nodesize-combination/test.sh b/tests/mkfs-tests/008-sectorsize-nodesize-combination/test.sh
index 9cc2f9e0..345d81de 100755
--- a/tests/mkfs-tests/008-sectorsize-nodesize-combination/test.sh
+++ b/tests/mkfs-tests/008-sectorsize-nodesize-combination/test.sh
@@ -19,13 +19,13 @@ do_test()
{
sectorsize=$1
nodesize=$2
- run_mayfail $TOP/mkfs.btrfs -f -O $features -n $nodesize -s $sectorsize \
- $TEST_DEV
+ run_mayfail "$TOP/mkfs.btrfs" -f -O "$features" -n "$nodesize" -s "$sectorsize" \
+ "$TEST_DEV"
ret=$?
- if [ $ret == 0 ]; then
- run_check $TOP/btrfs check $TEST_DEV
+ if [ "$ret" == 0 ]; then
+ run_check "$TOP/btrfs" check "$TEST_DEV"
fi
- return $ret
+ return "$ret"
}
# Invalid: Unaligned sectorsize and nodesize
diff --git a/tests/mkfs-tests/010-minimal-size/test.sh b/tests/mkfs-tests/010-minimal-size/test.sh
index 582533c3..0ebe0995 100755
--- a/tests/mkfs-tests/010-minimal-size/test.sh
+++ b/tests/mkfs-tests/010-minimal-size/test.sh
@@ -14,12 +14,12 @@ do_test()
# the minimal device size for the given option combination
prepare_test_dev 1M
output=$(run_mustfail_stdout "mkfs.btrfs for small image" \
- "$TOP/mkfs.btrfs" -f $@ "$TEST_DEV")
+ "$TOP/mkfs.btrfs" -f "$@" "$TEST_DEV")
good_size=$(echo "$output" | grep -oP "(?<=is )\d+")
prepare_test_dev "$good_size"
echo "Minimal device size is $good_size" >> "$RESULTS"
- run_check $TOP/mkfs.btrfs -f $@ "$TEST_DEV"
+ run_check $TOP/mkfs.btrfs -f "$@" "$TEST_DEV"
run_check_mount_test_dev
run_check_umount_test_dev
}
diff --git a/tests/mkfs-tests/012-rootdir-no-shrink/test.sh b/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
index 045906ae..765f8cdd 100755
--- a/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
+++ b/tests/mkfs-tests/012-rootdir-no-shrink/test.sh
@@ -11,7 +11,7 @@ fs_size=$((512 * 1024 * 1024))
bs=$((1024 * 1024))
tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
-prepare_test_dev $fs_size
+prepare_test_dev "$fs_size"
# No shrink case
@@ -20,7 +20,7 @@ run_check_mount_test_dev
# We should be able to write at least half of the fs size data since the fs is
# not shrunk
-run_check $SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
+run_check $SUDO_HELPER dd if=/dev/zero bs="$bs" count=$(($fs_size / $bs / 2)) \
of="$TEST_MNT/file"
run_check_umount_test_dev
@@ -31,7 +31,7 @@ run_check "$TOP/mkfs.btrfs" -f --rootdir "$tmp" --shrink "$TEST_DEV"
run_check_mount_test_dev
run_mustfail "mkfs.btrfs for shrink rootdir" \
- $SUDO_HELPER dd if=/dev/zero bs=$bs count=$(($fs_size / $bs / 2)) \
+ $SUDO_HELPER dd if=/dev/zero bs="$bs" count=$(($fs_size / $bs / 2)) \
of="$TEST_MNT/file"
run_check_umount_test_dev
diff --git a/tests/mkfs-tests/013-reserved-1M-for-single/test.sh b/tests/mkfs-tests/013-reserved-1M-for-single/test.sh
index caeb7d59..1944ad93 100755
--- a/tests/mkfs-tests/013-reserved-1M-for-single/test.sh
+++ b/tests/mkfs-tests/013-reserved-1M-for-single/test.sh
@@ -22,14 +22,14 @@ do_one_test ()
dump-tree -t device "$TEST_DEV" | \
grep -oP '(?<=DEV_EXTENT )[[:digit:]]*' | head -n1)
- if [ -z $first_dev_extent ]; then
+ if [ -z "$first_dev_extent" ]; then
_fail "failed to get first device extent"
fi
echo "first dev extent starts at $first_dev_extent" >> "$RESULTS"
echo "reserved range is [0, $(( 1024 * 1024)))" >> "$RESULTS"
# First device extent should not start below 1M
- if [ $first_dev_extent -lt $(( 1024 * 1024 )) ]; then
+ if [ "$first_dev_extent" -lt $(( 1024 * 1024 )) ]; then
_fail "first device extent occupies reserved 0~1M range"
fi
}
diff --git a/tests/mkfs-tests/014-rootdir-inline-extent/test.sh b/tests/mkfs-tests/014-rootdir-inline-extent/test.sh
index b337e493..09a96004 100755
--- a/tests/mkfs-tests/014-rootdir-inline-extent/test.sh
+++ b/tests/mkfs-tests/014-rootdir-inline-extent/test.sh
@@ -21,7 +21,7 @@ create_file()
test_mkfs_rootdir()
{
nodesize=$1
- run_check "$TOP/mkfs.btrfs" --nodesize $nodesize -f --rootdir "$tmp" \
+ run_check "$TOP/mkfs.btrfs" --nodesize "$nodesize" -f --rootdir "$tmp" \
"$TEST_DEV"
run_check $SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV"
}
@@ -39,8 +39,8 @@ for i in 512 1024 2048 4096 8192 16384 32768; do
done
for nodesize in 4096 8192 16384 32768 65536; do
- if [ $nodesize -ge $pagesize ]; then
- test_mkfs_rootdir $nodesize
+ if [ "$nodesize" -ge "$pagesize" ]; then
+ test_mkfs_rootdir "$nodesize"
fi
done
rm -rf -- "$tmp"