mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git
synced 2025-01-22 19:53:22 +08:00
btrfs-progs: introduce TEST_TOP and INTERNAL_BIN for tests
Use TEST_TOP as base for tests to reference any files, this will be used for git and external testsuite. INTERNAL_BIN is needed for referencing binaries that could reside in different paths in git vs external testsuite. Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com> [ add quotes around sourced files, update changelog ] Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
04cd2c0bca
commit
cebf3b3722
@ -4,13 +4,18 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/cli-tests-results.txt"
|
RESULTS="$TEST_TOP/cli-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -24,7 +29,7 @@ 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 "$TEST_TOP/cli-tests" -maxdepth 1 -mindepth 1 -type d \
|
||||||
${TEST:+-name "$TEST"} | sort)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
name=$(basename "$i")
|
name=$(basename "$i")
|
||||||
@ -40,5 +45,5 @@ do
|
|||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd "$TOP"
|
cd "$TEST_TOP"
|
||||||
done
|
done
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test commands of btrfs
|
# test commands of btrfs
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# coverage of balance --full-balance
|
# coverage of balance --full-balance
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# test parsing of various resize arguments
|
# test parsing of various resize arguments
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# minimal test for the following syntax: btrfs send -p parent subvol1 subvol2
|
# minimal test for the following syntax: btrfs send -p parent subvol1 subvol2
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# qgroup show behaviour when quotas are not enabled
|
# qgroup show behaviour when quotas are not enabled
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# simple test of qgroup show --sync option
|
# simple test of qgroup show --sync option
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# test 'btrfs check --force' on a mounted filesystem
|
# test 'btrfs check --force' on a mounted filesystem
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -10,7 +10,7 @@ check_default_id()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
16
tests/common
16
tests/common
@ -290,8 +290,12 @@ run_mustfail_stdout()
|
|||||||
|
|
||||||
check_prereq()
|
check_prereq()
|
||||||
{
|
{
|
||||||
if ! [ -f "$TOP/$1" ]; then
|
if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
|
||||||
_fail "Failed prerequisites: $1";
|
if ! [ -f "$INTERNAL_BIN/$1" ]; then
|
||||||
|
_fail "Failed prerequisites: $INTERNAL_BIN/$1";
|
||||||
|
fi
|
||||||
|
elif ! [ -f "$TOP/$1" ]; then
|
||||||
|
_fail "Failed prerequisites: $TOP/$1";
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,9 +453,9 @@ prepare_test_dev()
|
|||||||
return;
|
return;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "\$TEST_DEV not given, using $TOP/tests/test.img as fallback" >> \
|
echo "\$TEST_DEV not given, using $TEST_TOP/test.img as fallback" >> \
|
||||||
"$RESULTS"
|
"$RESULTS"
|
||||||
TEST_DEV="$TOP/tests/test.img"
|
TEST_DEV="$TEST_TOP/test.img"
|
||||||
|
|
||||||
truncate -s 0 "$TEST_DEV"
|
truncate -s 0 "$TEST_DEV"
|
||||||
truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed"
|
truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed"
|
||||||
@ -632,11 +636,11 @@ cleanup_loopdevs()
|
|||||||
|
|
||||||
init_env()
|
init_env()
|
||||||
{
|
{
|
||||||
TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}"
|
TEST_MNT="${TEST_MNT:-$TEST_TOP/mnt}"
|
||||||
export TEST_MNT
|
export TEST_MNT
|
||||||
mkdir -p "$TEST_MNT" || { echo "Failed mkdir -p $TEST_MNT"; exit 1; }
|
mkdir -p "$TEST_MNT" || { echo "Failed mkdir -p $TEST_MNT"; exit 1; }
|
||||||
|
|
||||||
source $TOP/tests/common.local
|
source $TEST_TOP/common.local
|
||||||
|
|
||||||
if [ "$TEST_ENABLE_OVERRIDE" = 'true' -a -n "$RESULTS" ]; then
|
if [ "$TEST_ENABLE_OVERRIDE" = 'true' -a -n "$RESULTS" ]; then
|
||||||
echo "INCLUDE common.local" >> "$RESULTS"
|
echo "INCLUDE common.local" >> "$RESULTS"
|
||||||
|
@ -5,14 +5,19 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/convert-tests-results.txt"
|
RESULTS="$TEST_TOP/convert-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -54,7 +59,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 "$TEST_TOP/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"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
# 4) Overlap file extents
|
# 4) Overlap file extents
|
||||||
# 5) Unable to rollback
|
# 5) Unable to rollback
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-convert
|
check_prereq btrfs-convert
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# create a base image, convert to btrfs, remove all files, rollback the ext4 image
|
# create a base image, convert to btrfs, remove all files, rollback the ext4 image
|
||||||
# note: ext4 only
|
# note: ext4 only
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
# Fast pinpoint regression test. No options combination nor checksum
|
# Fast pinpoint regression test. No options combination nor checksum
|
||||||
# verification
|
# verification
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Check if block sizes smaller than 4k expectedly fail to convert
|
# Check if block sizes smaller than 4k expectedly fail to convert
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Check if the converted ext2 image is readonly
|
# Check if the converted ext2 image is readonly
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
|
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
if ! check_kernel_support_reiserfs >/dev/null; then
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
||||||
_not_run "no reiserfs support"
|
_not_run "no reiserfs support"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# create a base image, convert to btrfs, remove all files, rollback the reiserfs image
|
# create a base image, convert to btrfs, remove all files, rollback the reiserfs image
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
if ! check_kernel_support_reiserfs >/dev/null; then
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
||||||
_not_run "no reiserfs support"
|
_not_run "no reiserfs support"
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
# Fast pinpoint regression test. No options combination nor checksum
|
# Fast pinpoint regression test. No options combination nor checksum
|
||||||
# verification
|
# verification
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
if ! check_kernel_support_reiserfs >/dev/null; then
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
||||||
_not_run "no reiserfs support"
|
_not_run "no reiserfs support"
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
|
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
if ! check_kernel_support_reiserfs >/dev/null; then
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
||||||
_not_run "no reiserfs support"
|
_not_run "no reiserfs support"
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
# We use separate inputs for tails and real blocks so we can determine
|
# We use separate inputs for tails and real blocks so we can determine
|
||||||
# if there was a failure in copying either.
|
# if there was a failure in copying either.
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
if ! check_kernel_support_reiserfs >/dev/null; then
|
if ! check_kernel_support_reiserfs >/dev/null; then
|
||||||
_not_run "no reiserfs support"
|
_not_run "no reiserfs support"
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
# Check if btrfs-convert refuses to rollback the filesystem, and leave the fs
|
# Check if btrfs-convert refuses to rollback the filesystem, and leave the fs
|
||||||
# and the convert image untouched
|
# and the convert image untouched
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
source "$TOP/tests/common.convert"
|
source "$TEST_TOP/common.convert"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
@ -4,13 +4,20 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/fsck-tests-results.txt"
|
RESULTS="$TEST_TOP/fsck-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
export INTERNAL_BIN
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -46,7 +53,7 @@ run_one_test() {
|
|||||||
# Type 1
|
# Type 1
|
||||||
check_all_images
|
check_all_images
|
||||||
fi
|
fi
|
||||||
cd "$TOP"
|
cd "$TEST_TOP"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Each dir contains one type of error for btrfsck test.
|
# Each dir contains one type of error for btrfsck test.
|
||||||
@ -62,7 +69,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 "$TEST_TOP/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"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-corrupt-block
|
check_prereq btrfs-corrupt-block
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
@ -31,7 +31,7 @@ test_extent_tree_rebuild()
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# corrupt extent root node block
|
# corrupt extent root node block
|
||||||
run_check $SUDO_HELPER "$TOP/btrfs-corrupt-block" -l "$extent_root_bytenr" \
|
run_check $SUDO_HELPER "$INTERNAL_BIN/btrfs-corrupt-block" -l "$extent_root_bytenr" \
|
||||||
-b 4096 "$TEST_DEV"
|
-b 4096 "$TEST_DEV"
|
||||||
|
|
||||||
$SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" >& /dev/null && \
|
$SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" >& /dev/null && \
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# a buggy check leads to the above messages
|
# a buggy check leads to the above messages
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
# the beginning of leaf.
|
# the beginning of leaf.
|
||||||
# Which caused false alert for lowmem mode.
|
# Which caused false alert for lowmem mode.
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# confirm whether 'btrfs check' supports check ing of a partially dropped
|
# confirm whether 'btrfs check' supports check ing of a partially dropped
|
||||||
# snapshot
|
# snapshot
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# check whether btrfsck can detect running qgroup rescan
|
# check whether btrfsck can detect running qgroup rescan
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# Fixed by patch:
|
# Fixed by patch:
|
||||||
# btrfs-progs: Fix stack overflow for checking qgroup on tree reloc tree
|
# btrfs-progs: Fix stack overflow for checking qgroup on tree reloc tree
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# confirm that clearing space cache works
|
# confirm that clearing space cache works
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Confirm btrfs check can check file extents without causing false alert
|
# Confirm btrfs check can check file extents without causing false alert
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# confirm whether check detects name and hash mismatch in dir_item
|
# confirm whether check detects name and hash mismatch in dir_item
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# An image with mis-aligned superblock total_bytes, that will be found and
|
# An image with mis-aligned superblock total_bytes, that will be found and
|
||||||
# fixed by 'check' or fixed by 'rescue fix-device-size'
|
# fixed by 'check' or fixed by 'rescue fix-device-size'
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
|
@ -4,13 +4,18 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/fuzz-tests-results.txt"
|
RESULTS="$TEST_TOP/fuzz-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -23,7 +28,7 @@ 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 "$TEST_TOP/fuzz-tests" -maxdepth 1 -mindepth 1 -type d \
|
||||||
${TEST:+-name "$TEST"} | sort)
|
${TEST:+-name "$TEST"} | sort)
|
||||||
do
|
do
|
||||||
name=$(basename "$i")
|
name=$(basename "$i")
|
||||||
@ -39,5 +44,5 @@ do
|
|||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd "$TOP"
|
cd "$TEST_TOP"
|
||||||
done
|
done
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# iterate over all fuzzed images and run 'btrfs check'
|
# iterate over all fuzzed images and run 'btrfs check'
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -15,6 +15,6 @@ check_image() {
|
|||||||
run_mayfail $TOP/btrfs check "$image"
|
run_mayfail $TOP/btrfs check "$image"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# iterate over all fuzzed images and run 'btrfs-image'
|
# iterate over all fuzzed images and run 'btrfs-image'
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
@ -17,7 +17,7 @@ check_image() {
|
|||||||
truncate -s0 target
|
truncate -s0 target
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
rm -- target
|
rm -- target
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# iterate over all fuzzed images and run 'btrfs check', try various options to
|
# iterate over all fuzzed images and run 'btrfs check', try various options to
|
||||||
# get more code coverage
|
# get more code coverage
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -21,6 +21,6 @@ check_image() {
|
|||||||
run_mayfail $TOP/btrfs check --repair "$image"
|
run_mayfail $TOP/btrfs check --repair "$image"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -13,6 +13,6 @@ check_image() {
|
|||||||
run_mayfail $TOP/btrfs inspect-internal dump-tree "$image"
|
run_mayfail $TOP/btrfs inspect-internal dump-tree "$image"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -14,6 +14,6 @@ check_image() {
|
|||||||
run_mayfail $TOP/btrfs inspect-internal dump-super -Ffa "$image"
|
run_mayfail $TOP/btrfs inspect-internal dump-super -Ffa "$image"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -13,6 +13,6 @@ check_image() {
|
|||||||
run_mayfail $TOP/btrfs inspect-internal tree-stats "$image"
|
run_mayfail $TOP/btrfs inspect-internal tree-stats "$image"
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -15,6 +15,6 @@ check_image() {
|
|||||||
rm -- "$image".scratch
|
rm -- "$image".scratch
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -15,6 +15,6 @@ check_image() {
|
|||||||
rm -- "$image".scratch
|
rm -- "$image".scratch
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
setup_root_helper
|
setup_root_helper
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -15,6 +15,6 @@ check_image() {
|
|||||||
rm -- "$image".scratch
|
rm -- "$image".scratch
|
||||||
}
|
}
|
||||||
|
|
||||||
check_all_images $TOP/tests/fuzz-tests/images
|
check_all_images $TEST_TOP/fuzz-tests/images
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -4,13 +4,20 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
|
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/misc-tests-results.txt"
|
RESULTS="$TEST_TOP/misc-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
export INTERNAL_BIN
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -31,7 +38,7 @@ 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 "$TEST_TOP/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)"
|
||||||
@ -46,5 +53,5 @@ do
|
|||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd "$TOP"
|
cd "$TEST_TOP"
|
||||||
done
|
done
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test btrfstune options that enable filesystem features
|
# test btrfstune options that enable filesystem features
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfstune
|
check_prereq btrfstune
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test btrfstune uuid rewriting options
|
# test btrfstune uuid rewriting options
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfstune
|
check_prereq btrfstune
|
||||||
@ -25,7 +25,7 @@ test_uuid_random()
|
|||||||
|
|
||||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
||||||
--uuid $origuuid \
|
--uuid $origuuid \
|
||||||
--rootdir $TOP/Documentation \
|
--rootdir $INTERNAL_BIN/Documentation \
|
||||||
$TEST_DEV
|
$TEST_DEV
|
||||||
run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
|
run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
|
||||||
currentfsid=$(run_check_stdout $TOP/btrfstune -f -u $TEST_DEV | \
|
currentfsid=$(run_check_stdout $TOP/btrfstune -f -u $TEST_DEV | \
|
||||||
@ -47,7 +47,7 @@ test_uuid_user()
|
|||||||
|
|
||||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
||||||
--uuid $origuuid \
|
--uuid $origuuid \
|
||||||
--rootdir $TOP/Documentation \
|
--rootdir $INTERNAL_BIN/Documentation \
|
||||||
$TEST_DEV
|
$TEST_DEV
|
||||||
run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
|
run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
|
||||||
run_check $TOP/btrfstune -f -U $newuuid \
|
run_check $TOP/btrfstune -f -U $newuuid \
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test zero-log
|
# test zero-log
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -27,7 +27,7 @@ test_zero_log()
|
|||||||
{
|
{
|
||||||
# FIXME: we need an image with existing log_root
|
# FIXME: we need an image with existing log_root
|
||||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
||||||
--rootdir $TOP/Documentation \
|
--rootdir $INTERNAL_BIN/Documentation \
|
||||||
$TEST_DEV
|
$TEST_DEV
|
||||||
run_check $TOP/btrfs inspect-internal dump-super $TEST_DEV
|
run_check $TOP/btrfs inspect-internal dump-super $TEST_DEV
|
||||||
if [ "$1" = 'standalone' ]; then
|
if [ "$1" = 'standalone' ]; then
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# are able to resize (shrink) it to that size.
|
# are able to resize (shrink) it to that size.
|
||||||
#
|
#
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test convert-thread-conflict
|
# test convert-thread-conflict
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-convert
|
check_prereq btrfs-convert
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# - btrfs-image must not loop indefinetelly
|
# - btrfs-image must not loop indefinetelly
|
||||||
# - btrfs-image will expectedly fail to produce the dump
|
# - btrfs-image will expectedly fail to produce the dump
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# - btrfs subvolume must not loop indefinitely
|
# - btrfs subvolume must not loop indefinitely
|
||||||
# - btrfs subvolume return 0 in normal case
|
# - btrfs subvolume return 0 in normal case
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# test if btrfs-convert creates a filesystem without leaf crossing stripes
|
# test if btrfs-convert creates a filesystem without leaf crossing stripes
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-convert
|
check_prereq btrfs-convert
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Verify that subvolume sync waits until the subvolume is cleaned
|
# Verify that subvolume sync waits until the subvolume is cleaned
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# verify that convert rollback finds the ext2_subvolume intact and fails if it
|
# verify that convert rollback finds the ext2_subvolume intact and fails if it
|
||||||
# was partially deleted
|
# was partially deleted
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-convert
|
check_prereq btrfs-convert
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# make sure that 'missing' is accepted for device deletion
|
# make sure that 'missing' is accepted for device deletion
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# recent fs or balanced fs, whose metadata chunk is the first chunk
|
# recent fs or balanced fs, whose metadata chunk is the first chunk
|
||||||
# and the only metadata chunk
|
# and the only metadata chunk
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-find-root
|
check_prereq btrfs-find-root
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# Verify that subvolume sync waits until the subvolume is cleaned and does not
|
# Verify that subvolume sync waits until the subvolume is cleaned and does not
|
||||||
# crash at the end
|
# crash at the end
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# test label settings
|
# test label settings
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# let dump-super dump random data, must not crash
|
# let dump-super dump random data, must not crash
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# test for sending stream size of clone-src option, compare against a send
|
# test for sending stream size of clone-src option, compare against a send
|
||||||
# stream generated by buggy version
|
# stream generated by buggy version
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# test receiving stream that's not valid, simple cases
|
# test receiving stream that's not valid, simple cases
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
# end of stream conditions: test that no instructions in a stream are still
|
# end of stream conditions: test that no instructions in a stream are still
|
||||||
# received, at least the header must be present
|
# received, at least the header must be present
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
# have an entry with the same name that corresponds to different inodes in each
|
# have an entry with the same name that corresponds to different inodes in each
|
||||||
# snapshot.
|
# snapshot.
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
@ -14,7 +14,7 @@ check_prereq fssum
|
|||||||
setup_root_helper
|
setup_root_helper
|
||||||
prepare_test_dev
|
prepare_test_dev
|
||||||
|
|
||||||
FSSUM_PROG="$TOP/fssum"
|
FSSUM_PROG="$INTERNAL_BIN/fssum"
|
||||||
srcdir=./send-test-dir
|
srcdir=./send-test-dir
|
||||||
rm -rf "$srcdir"
|
rm -rf "$srcdir"
|
||||||
mkdir -p "$srcdir"
|
mkdir -p "$srcdir"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Corrupt primary superblock and restore it using backup superblock.
|
# Corrupt primary superblock and restore it using backup superblock.
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-select-super
|
check_prereq btrfs-select-super
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# Test btrfs-image with multiple devices filesystem and verify that restoring
|
# Test btrfs-image with multiple devices filesystem and verify that restoring
|
||||||
# the created image works against a single device.
|
# the created image works against a single device.
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# btrfs fi du should handle empty subvolumes (with ino == 2)
|
# btrfs fi du should handle empty subvolumes (with ino == 2)
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# check if 'device slack' is reported as zero when a device is missing
|
# check if 'device slack' is reported as zero when a device is missing
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs-image
|
check_prereq btrfs-image
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# test commands of inspect-internal rootid
|
# test commands of inspect-internal rootid
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Test zstd compression support on a prebuilt btrfs image
|
# Test zstd compression support on a prebuilt btrfs image
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
check_global_prereq md5sum
|
check_global_prereq md5sum
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# check that sanitized names with matching crc do not contain unprintable
|
# check that sanitized names with matching crc do not contain unprintable
|
||||||
# characters, namely 0x7f
|
# characters, namely 0x7f
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# check that the toplevel subvolume is not listed as regular or deleted
|
# check that the toplevel subvolume is not listed as regular or deleted
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -4,13 +4,20 @@
|
|||||||
|
|
||||||
LANG=C
|
LANG=C
|
||||||
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
||||||
|
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
|
||||||
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
||||||
|
if ! [ -f "$TOP/btrfs" ];then
|
||||||
|
TOP=$(dirname `which btrfs`)
|
||||||
|
fi
|
||||||
TEST_DEV=${TEST_DEV:-}
|
TEST_DEV=${TEST_DEV:-}
|
||||||
RESULTS="$TOP/tests/mkfs-tests-results.txt"
|
RESULTS="$TEST_TOP/mkfs-tests-results.txt"
|
||||||
IMAGE="$TOP/tests/test.img"
|
IMAGE="$TEST_TOP/test.img"
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
|
export INTERNAL_BIN
|
||||||
|
export TEST_TOP
|
||||||
export TOP
|
export TOP
|
||||||
export RESULTS
|
export RESULTS
|
||||||
export LANG
|
export LANG
|
||||||
@ -25,7 +32,7 @@ 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 "$TEST_TOP/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)"
|
||||||
@ -40,5 +47,5 @@ do
|
|||||||
_fail "test failed for case $(basename $i)"
|
_fail "test failed for case $(basename $i)"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
cd "$TOP"
|
cd "$TEST_TOP"
|
||||||
done
|
done
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# test various blockgroup profile combinations, use loop devices as block
|
# test various blockgroup profile combinations, use loop devices as block
|
||||||
# devices
|
# devices
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Verify that we do not force mixed block groups on small volumes anymore
|
# Verify that we do not force mixed block groups on small volumes anymore
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Mixed mode needs equal sectorsize and nodesize
|
# Mixed mode needs equal sectorsize and nodesize
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# make sure that mkfs.btrfs --rootsize does not change size of the image
|
# make sure that mkfs.btrfs --rootsize does not change size of the image
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
|
||||||
@ -16,7 +16,7 @@ test_mkfs_with_size() {
|
|||||||
run_check truncate -s$size $TEST_DEV
|
run_check truncate -s$size $TEST_DEV
|
||||||
imgsize=$(run_check_stdout stat --format=%s $TEST_DEV)
|
imgsize=$(run_check_stdout stat --format=%s $TEST_DEV)
|
||||||
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
|
||||||
--rootdir $TOP/Documentation \
|
--rootdir $INTERNAL_BIN/Documentation \
|
||||||
$TEST_DEV
|
$TEST_DEV
|
||||||
tmp=$(run_check_stdout stat --format=%s $TEST_DEV)
|
tmp=$(run_check_stdout stat --format=%s $TEST_DEV)
|
||||||
if ! [ "$imgsize" = "$tmp" ]; then
|
if ! [ "$imgsize" = "$tmp" ]; then
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# a long device name must pass the SSD test
|
# a long device name must pass the SSD test
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# recognize partitioned loop devices
|
# recognize partitioned loop devices
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
if ! losetup --help | grep -q 'partscan'; then
|
if ! losetup --help | grep -q 'partscan'; then
|
||||||
_not_run "losetup --partscan not available"
|
_not_run "losetup --partscan not available"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# iterate over nodesize and sectorsize combinations
|
# iterate over nodesize and sectorsize combinations
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# only do mkfs and fsck check, no mounting as
|
# only do mkfs and fsck check, no mounting as
|
||||||
# sub/multi-pagesize is not supported yet
|
# sub/multi-pagesize is not supported yet
|
||||||
|
|
||||||
source $TOP/tests/common
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
#
|
#
|
||||||
# Note: sock type is skipped in this test
|
# Note: sock type is skipped in this test
|
||||||
|
|
||||||
source "$TOP/tests/common"
|
source "$TEST_TOP/common"
|
||||||
|
|
||||||
check_prereq mkfs.btrfs
|
check_prereq mkfs.btrfs
|
||||||
check_prereq btrfs
|
check_prereq btrfs
|
||||||
|
Loading…
Reference in New Issue
Block a user