summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtests/clean-tests.sh8
-rwxr-xr-xtests/cli-tests.sh18
-rwxr-xr-xtests/convert-tests.sh14
-rwxr-xr-xtests/fsck-tests.sh16
-rwxr-xr-xtests/fuzz-tests.sh16
-rwxr-xr-xtests/misc-tests.sh16
-rwxr-xr-xtests/mkfs-tests.sh16
-rwxr-xr-xtests/test-console.sh4
8 files changed, 54 insertions, 54 deletions
diff --git a/tests/clean-tests.sh b/tests/clean-tests.sh
index 7f18e6f0..61baa069 100755
--- a/tests/clean-tests.sh
+++ b/tests/clean-tests.sh
@@ -1,9 +1,9 @@
#!/bin/bash
# remove all intermediate files from tests
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
-source $TOP/tests/common
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
+source "$TOP/tests/common"
setup_root_helper
@@ -13,7 +13,7 @@ fi
$SUDO_HELPER umount "$TEST_MNT" &>/dev/null
-if ! cd $TOP/tests; then
+if ! cd "$TOP/tests"; then
echo "ERROR: cannot cd to $TOP/tests"
exit 1
fi
diff --git a/tests/cli-tests.sh b/tests/cli-tests.sh
index 86dda87b..bc1a1e2c 100755
--- a/tests/cli-tests.sh
+++ b/tests/cli-tests.sh
@@ -3,13 +3,13 @@
# command line interface coverage tests
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/cli-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
+source "$TOP/tests/common"
export TOP
export RESULTS
@@ -17,25 +17,25 @@ export LANG
export IMAGE
export TEST_DEV
-rm -f $RESULTS
+rm -f "$RESULTS"
check_prereq btrfs
check_kernel_support
# The tests are driven by their custom script called 'test.sh'
-for i in $(find $TOP/tests/cli-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/cli-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
- name=$(basename $i)
- cd $i
+ name=$(basename "$i")
+ cd "$i"
if [ -x test.sh ]; then
- echo "=== Entering $i" >> $RESULTS
+ echo "=== Entering $i" >> "$RESULTS"
echo " [TEST/cli] $name"
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $(basename $i)"
fi
fi
- cd $TOP
+ cd "$TOP"
done
diff --git a/tests/convert-tests.sh b/tests/convert-tests.sh
index db149724..5fa88a12 100755
--- a/tests/convert-tests.sh
+++ b/tests/convert-tests.sh
@@ -4,14 +4,14 @@
# clean.
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/convert-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
-source $TOP/tests/common.convert
+source "$TOP/tests/common"
+source "$TOP/tests/common.convert"
export TOP
export RESULTS
@@ -19,7 +19,7 @@ export LANG
export IMAGE
export TEST_DEV
-rm -f $RESULTS
+rm -f "$RESULTS"
check_kernel_support
@@ -31,7 +31,7 @@ run_one_test() {
testname=$(basename "$testdir")
echo " [TEST/conv] $testname"
cd "$testdir"
- echo "=== Entering $testname" >> $RESULTS
+ echo "=== Entering $testname" >> "$RESULTS"
if [ -x test.sh ]; then
# Only support custom test scripts
./test.sh
@@ -44,7 +44,7 @@ run_one_test() {
}
# Test special images
-for i in $(find $TOP/tests/convert-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/convert-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
run_one_test "$i"
diff --git a/tests/fsck-tests.sh b/tests/fsck-tests.sh
index 69ec57a0..e71b7119 100755
--- a/tests/fsck-tests.sh
+++ b/tests/fsck-tests.sh
@@ -3,13 +3,13 @@
# loop through all of our bad images and make sure fsck repairs them properly
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/fsck-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
+source "$TOP/tests/common"
export TOP
export RESULTS
@@ -17,7 +17,7 @@ export LANG
export IMAGE
export TEST_DEV
-rm -f $RESULTS
+rm -f "$RESULTS"
# test rely on corrupting blocks tool
check_prereq btrfs-corrupt-block
@@ -30,8 +30,8 @@ run_one_test() {
testname="$1"
echo " [TEST/fsck] $(basename $testname)"
- cd $testname
- echo "=== Entering $testname" >> $RESULTS
+ cd "$testname"
+ echo "=== Entering $testname" >> "$RESULTS"
if [ -x test.sh ]; then
# Type 2
./test.sh
@@ -42,7 +42,7 @@ run_one_test() {
# Type 1
check_all_images `pwd`
fi
- cd $TOP
+ cd "$TOP"
}
# Each dir contains one type of error for btrfsck test.
@@ -58,7 +58,7 @@ run_one_test() {
# This is for case btrfs-image can't dump or case needs extra
# check/verify
-for i in $(find $TOP/tests/fsck-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/fsck-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
run_one_test "$i"
diff --git a/tests/fuzz-tests.sh b/tests/fuzz-tests.sh
index 29691cae..9b88aa10 100755
--- a/tests/fuzz-tests.sh
+++ b/tests/fuzz-tests.sh
@@ -3,13 +3,13 @@
# misc tests on fuzzed or crafted images
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/fuzz-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
+source "$TOP/tests/common"
export TOP
export RESULTS
@@ -17,24 +17,24 @@ export LANG
export IMAGE
export TEST_DEV
-rm -f $RESULTS
+rm -f "$RESULTS"
check_prereq btrfs
# The tests are driven by their custom script called 'test.sh'
-for i in $(find $TOP/tests/fuzz-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/fuzz-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
- name=$(basename $i)
+ name=$(basename "$i")
cd $i
if [ -x test.sh ]; then
- echo "=== Entering $i" >> $RESULTS
+ echo "=== Entering $i" >> "$RESULTS"
echo " [TEST/fuzz] $name"
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $(basename $i)"
fi
fi
- cd $TOP
+ cd "$TOP"
done
diff --git a/tests/misc-tests.sh b/tests/misc-tests.sh
index fd19c2f9..40e1cba1 100755
--- a/tests/misc-tests.sh
+++ b/tests/misc-tests.sh
@@ -3,13 +3,13 @@
# Misc tests
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/misc-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
+source "$TOP/tests/common"
export TOP
export RESULTS
@@ -17,7 +17,7 @@ export LANG
export TEST_DEV
export IMAGE
-rm -f $RESULTS
+rm -f "$RESULTS"
# test rely on corrupting blocks tool
check_prereq btrfs-corrupt-block
@@ -28,17 +28,17 @@ check_kernel_support
# The tests are driven by their custom script called 'test.sh'
-for i in $(find $TOP/tests/misc-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/misc-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
echo " [TEST/misc] $(basename $i)"
- cd $i
- echo "=== Entering $i" >> $RESULTS
+ cd "$i"
+ echo "=== Entering $i" >> "$RESULTS"
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $(basename $i)"
fi
fi
- cd $TOP
+ cd "$TOP"
done
diff --git a/tests/mkfs-tests.sh b/tests/mkfs-tests.sh
index 3c5465fa..c130520d 100755
--- a/tests/mkfs-tests.sh
+++ b/tests/mkfs-tests.sh
@@ -3,13 +3,13 @@
# mkfs.btrfs tests
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/mkfs-tests-results.txt"
IMAGE="$TOP/tests/test.img"
-source $TOP/tests/common
+source "$TOP/tests/common"
export TOP
export RESULTS
@@ -17,7 +17,7 @@ export LANG
export IMAGE
export TEST_DEV
-rm -f $RESULTS
+rm -f "$RESULTS"
check_prereq mkfs.btrfs
check_prereq btrfs
@@ -25,17 +25,17 @@ check_kernel_support
# The tests are driven by their custom script called 'test.sh'
-for i in $(find $TOP/tests/mkfs-tests -maxdepth 1 -mindepth 1 -type d \
+for i in $(find "$TOP/tests/mkfs-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
echo " [TEST/mkfs] $(basename $i)"
- cd $i
- echo "=== Entering $i" >> $RESULTS
+ cd "$i"
+ echo "=== Entering $i" >> "$RESULTS"
if [ -x test.sh ]; then
./test.sh
if [ $? -ne 0 ]; then
_fail "test failed for case $(basename $i)"
fi
fi
- cd $TOP
+ cd "$TOP"
done
diff --git a/tests/test-console.sh b/tests/test-console.sh
index 365cc971..779e541f 100755
--- a/tests/test-console.sh
+++ b/tests/test-console.sh
@@ -2,8 +2,8 @@
# a shell with test environment set up, logged commands and output
LANG=C
-SCRIPT_DIR=$(dirname $(readlink -f $0))
-TOP=$(readlink -f $SCRIPT_DIR/../)
+SCRIPT_DIR=$(dirname $(readlink -f "$0"))
+TOP=$(readlink -f "$SCRIPT_DIR/../")
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/test-console.txt"
IMAGE="$TOP/tests/test.img"