btrfs-progs: tests: add quotation around variables in support scripts

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2016-11-11 10:12:05 +01:00
parent 8dc653f003
commit 7dbb17dbb2
8 changed files with 54 additions and 54 deletions

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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"