mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 22:53:35 +00:00
btrfs-progs: tests: add quotation around variables in support scripts
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
8dc653f003
commit
7dbb17dbb2
@ -1,9 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# remove all intermediate files from tests
|
# remove all intermediate files from tests
|
||||||
|
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ fi
|
|||||||
|
|
||||||
$SUDO_HELPER umount "$TEST_MNT" &>/dev/null
|
$SUDO_HELPER umount "$TEST_MNT" &>/dev/null
|
||||||
|
|
||||||
if ! cd $TOP/tests; then
|
if ! cd "$TOP/tests"; then
|
||||||
echo "ERROR: cannot cd to $TOP/tests"
|
echo "ERROR: cannot cd to $TOP/tests"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
# command line interface coverage tests
|
# command line interface coverage tests
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/cli-tests-results.txt"
|
RESULTS="$TOP/tests/cli-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -17,25 +17,25 @@ export LANG
|
|||||||
export IMAGE
|
export IMAGE
|
||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
check_kernel_support
|
check_kernel_support
|
||||||
|
|
||||||
# The tests are driven by their custom script called 'test.sh'
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
name=$(basename $i)
|
name=$(basename "$i")
|
||||||
cd $i
|
cd "$i"
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
echo "=== Entering $i" >> $RESULTS
|
echo "=== Entering $i" >> "$RESULTS"
|
||||||
echo " [TEST/cli] $name"
|
echo " [TEST/cli] $name"
|
||||||
./test.sh
|
./test.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd $TOP
|
cd "$TOP"
|
||||||
done
|
done
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
# clean.
|
# clean.
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/convert-tests-results.txt"
|
RESULTS="$TOP/tests/convert-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
source $TOP/tests/common.convert
|
source "$TOP/tests/common.convert"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -19,7 +19,7 @@ export LANG
|
|||||||
export IMAGE
|
export IMAGE
|
||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
check_kernel_support
|
check_kernel_support
|
||||||
|
|
||||||
@ -31,7 +31,7 @@ run_one_test() {
|
|||||||
testname=$(basename "$testdir")
|
testname=$(basename "$testdir")
|
||||||
echo " [TEST/conv] $testname"
|
echo " [TEST/conv] $testname"
|
||||||
cd "$testdir"
|
cd "$testdir"
|
||||||
echo "=== Entering $testname" >> $RESULTS
|
echo "=== Entering $testname" >> "$RESULTS"
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
# Only support custom test scripts
|
# Only support custom test scripts
|
||||||
./test.sh
|
./test.sh
|
||||||
@ -44,7 +44,7 @@ run_one_test() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Test special images
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
run_one_test "$i"
|
run_one_test "$i"
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
# loop through all of our bad images and make sure fsck repairs them properly
|
# loop through all of our bad images and make sure fsck repairs them properly
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/fsck-tests-results.txt"
|
RESULTS="$TOP/tests/fsck-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -17,7 +17,7 @@ export LANG
|
|||||||
export IMAGE
|
export IMAGE
|
||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
# test rely on corrupting blocks tool
|
# test rely on corrupting blocks tool
|
||||||
check_prereq btrfs-corrupt-block
|
check_prereq btrfs-corrupt-block
|
||||||
@ -30,8 +30,8 @@ run_one_test() {
|
|||||||
|
|
||||||
testname="$1"
|
testname="$1"
|
||||||
echo " [TEST/fsck] $(basename $testname)"
|
echo " [TEST/fsck] $(basename $testname)"
|
||||||
cd $testname
|
cd "$testname"
|
||||||
echo "=== Entering $testname" >> $RESULTS
|
echo "=== Entering $testname" >> "$RESULTS"
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
# Type 2
|
# Type 2
|
||||||
./test.sh
|
./test.sh
|
||||||
@ -42,7 +42,7 @@ run_one_test() {
|
|||||||
# Type 1
|
# Type 1
|
||||||
check_all_images `pwd`
|
check_all_images `pwd`
|
||||||
fi
|
fi
|
||||||
cd $TOP
|
cd "$TOP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Each dir contains one type of error for btrfsck test.
|
# 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
|
# This is for case btrfs-image can't dump or case needs extra
|
||||||
# check/verify
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
run_one_test "$i"
|
run_one_test "$i"
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
# misc tests on fuzzed or crafted images
|
# misc tests on fuzzed or crafted images
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/fuzz-tests-results.txt"
|
RESULTS="$TOP/tests/fuzz-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -17,24 +17,24 @@ export LANG
|
|||||||
export IMAGE
|
export IMAGE
|
||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
# The tests are driven by their custom script called 'test.sh'
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
name=$(basename $i)
|
name=$(basename "$i")
|
||||||
cd $i
|
cd $i
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
echo "=== Entering $i" >> $RESULTS
|
echo "=== Entering $i" >> "$RESULTS"
|
||||||
echo " [TEST/fuzz] $name"
|
echo " [TEST/fuzz] $name"
|
||||||
./test.sh
|
./test.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd $TOP
|
cd "$TOP"
|
||||||
done
|
done
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
# Misc tests
|
# Misc tests
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/misc-tests-results.txt"
|
RESULTS="$TOP/tests/misc-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -17,7 +17,7 @@ export LANG
|
|||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
export IMAGE
|
export IMAGE
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
# test rely on corrupting blocks tool
|
# test rely on corrupting blocks tool
|
||||||
check_prereq btrfs-corrupt-block
|
check_prereq btrfs-corrupt-block
|
||||||
@ -28,17 +28,17 @@ check_kernel_support
|
|||||||
|
|
||||||
# The tests are driven by their custom script called 'test.sh'
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
echo " [TEST/misc] $(basename $i)"
|
echo " [TEST/misc] $(basename $i)"
|
||||||
cd $i
|
cd "$i"
|
||||||
echo "=== Entering $i" >> $RESULTS
|
echo "=== Entering $i" >> "$RESULTS"
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
./test.sh
|
./test.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd $TOP
|
cd "$TOP"
|
||||||
done
|
done
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
# mkfs.btrfs tests
|
# mkfs.btrfs tests
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/mkfs-tests-results.txt"
|
RESULTS="$TOP/tests/mkfs-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TOP/tests/common"
|
||||||
|
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
@ -17,7 +17,7 @@ export LANG
|
|||||||
export IMAGE
|
export IMAGE
|
||||||
export TEST_DEV
|
export TEST_DEV
|
||||||
|
|
||||||
rm -f $RESULTS
|
rm -f "$RESULTS"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -25,17 +25,17 @@ check_kernel_support
|
|||||||
|
|
||||||
# The tests are driven by their custom script called 'test.sh'
|
# 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)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
echo " [TEST/mkfs] $(basename $i)"
|
echo " [TEST/mkfs] $(basename $i)"
|
||||||
cd $i
|
cd "$i"
|
||||||
echo "=== Entering $i" >> $RESULTS
|
echo "=== Entering $i" >> "$RESULTS"
|
||||||
if [ -x test.sh ]; then
|
if [ -x test.sh ]; then
|
||||||
./test.sh
|
./test.sh
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd $TOP
|
cd "$TOP"
|
||||||
done
|
done
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# a shell with test environment set up, logged commands and output
|
# a shell with test environment set up, logged commands and output
|
||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f $0))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
TOP=$(readlink -f $SCRIPT_DIR/../)
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/test-console.txt"
|
RESULTS="$TOP/tests/test-console.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TOP/tests/test.img"
|
||||||
|
Loading…
Reference in New Issue
Block a user