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:
Gu Jinxiang 2018-02-08 14:34:19 +08:00 committed by David Sterba
parent 04cd2c0bca
commit cebf3b3722
88 changed files with 186 additions and 146 deletions

View File

@ -4,13 +4,18 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/cli-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/cli-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TEST_TOP/common"
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -24,7 +29,7 @@ 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 "$TEST_TOP/cli-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
name=$(basename "$i")
@ -40,5 +45,5 @@ do
_fail "test failed for case $(basename $i)"
fi
fi
cd "$TOP"
cd "$TEST_TOP"
done

View File

@ -1,7 +1,7 @@
#!/bin/bash
# test commands of btrfs
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# coverage of balance --full-balance
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# test parsing of various resize arguments
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# 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 btrfs

View File

@ -2,7 +2,7 @@
#
# qgroup show behaviour when quotas are not enabled
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# simple test of qgroup show --sync option
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# test 'btrfs check --force' on a mounted filesystem
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -10,7 +10,7 @@ check_default_id()
fi
}
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -290,8 +290,12 @@ run_mustfail_stdout()
check_prereq()
{
if ! [ -f "$TOP/$1" ]; then
_fail "Failed prerequisites: $1";
if [ "$1" = "btrfs-corrupt-block" -o "$1" = "fssum" ]; then
if ! [ -f "$INTERNAL_BIN/$1" ]; then
_fail "Failed prerequisites: $INTERNAL_BIN/$1";
fi
elif ! [ -f "$TOP/$1" ]; then
_fail "Failed prerequisites: $TOP/$1";
fi
}
@ -449,9 +453,9 @@ prepare_test_dev()
return;
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"
TEST_DEV="$TOP/tests/test.img"
TEST_DEV="$TEST_TOP/test.img"
truncate -s 0 "$TEST_DEV"
truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed"
@ -632,11 +636,11 @@ cleanup_loopdevs()
init_env()
{
TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}"
TEST_MNT="${TEST_MNT:-$TEST_TOP/mnt}"
export TEST_MNT
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
echo "INCLUDE common.local" >> "$RESULTS"

View File

@ -5,14 +5,19 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/convert-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/convert-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -54,7 +59,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 "$TEST_TOP/convert-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
run_one_test "$i"

View File

@ -1,7 +1,7 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,7 +1,7 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,7 +1,7 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -10,7 +10,7 @@
# 4) Overlap file extents
# 5) Unable to rollback
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs-convert
check_prereq btrfs

View File

@ -2,8 +2,8 @@
# create a base image, convert to btrfs, remove all files, rollback the ext4 image
# note: ext4 only
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -5,8 +5,8 @@
# Fast pinpoint regression test. No options combination nor checksum
# verification
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Check if block sizes smaller than 4k expectedly fail to convert
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Check if the converted ext2 image is readonly
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -1,7 +1,7 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
if ! check_kernel_support_reiserfs >/dev/null; then
_not_run "no reiserfs support"

View File

@ -1,8 +1,8 @@
#!/bin/bash
# create a base image, convert to btrfs, remove all files, rollback the reiserfs image
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
if ! check_kernel_support_reiserfs >/dev/null; then
_not_run "no reiserfs support"

View File

@ -5,8 +5,8 @@
# Fast pinpoint regression test. No options combination nor checksum
# verification
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
if ! check_kernel_support_reiserfs >/dev/null; then
_not_run "no reiserfs support"

View File

@ -1,8 +1,8 @@
#!/bin/bash
# Check if btrfs-convert can copy common inode flags like SYNC/IMMUTABLE
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
if ! check_kernel_support_reiserfs >/dev/null; then
_not_run "no reiserfs support"

View File

@ -6,8 +6,8 @@
# We use separate inputs for tails and real blocks so we can determine
# if there was a failure in copying either.
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
if ! check_kernel_support_reiserfs >/dev/null; then
_not_run "no reiserfs support"

View File

@ -2,8 +2,8 @@
# Check if btrfs-convert refuses to rollback the filesystem, and leave the fs
# and the convert image untouched
source "$TOP/tests/common"
source "$TOP/tests/common.convert"
source "$TEST_TOP/common"
source "$TEST_TOP/common.convert"
setup_root_helper
prepare_test_dev

View File

@ -4,13 +4,20 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/fsck-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/fsck-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TEST_TOP/common"
export INTERNAL_BIN
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -46,7 +53,7 @@ run_one_test() {
# Type 1
check_all_images
fi
cd "$TOP"
cd "$TEST_TOP"
}
# 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
# 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)
do
run_one_test "$i"

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs-image

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs-corrupt-block
check_prereq mkfs.btrfs
@ -31,7 +31,7 @@ test_extent_tree_rebuild()
fi
# 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"
$SUDO_HELPER "$TOP/btrfs" check "$TEST_DEV" >& /dev/null && \

View File

@ -1,6 +1,6 @@
#!/bin/bash
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -11,7 +11,7 @@
#
# a buggy check leads to the above messages
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -15,7 +15,7 @@
# the beginning of leaf.
# Which caused false alert for lowmem mode.
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -2,7 +2,7 @@
# confirm whether 'btrfs check' supports check ing of a partially dropped
# snapshot
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# check whether btrfsck can detect running qgroup rescan
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -5,7 +5,7 @@
# Fixed by patch:
# btrfs-progs: Fix stack overflow for checking qgroup on tree reloc tree
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# confirm that clearing space cache works
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs
check_prereq mkfs.btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Confirm btrfs check can check file extents without causing false alert
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs
check_prereq mkfs.btrfs

View File

@ -2,7 +2,7 @@
#
# confirm whether check detects name and hash mismatch in dir_item
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -3,7 +3,7 @@
# An image with mis-aligned superblock total_bytes, that will be found and
# fixed by 'check' or fixed by 'rescue fix-device-size'
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs
setup_root_helper

View File

@ -4,13 +4,18 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/fuzz-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/fuzz-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TEST_TOP/common"
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -23,7 +28,7 @@ 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 "$TEST_TOP/fuzz-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
name=$(basename "$i")
@ -39,5 +44,5 @@ do
_fail "test failed for case $(basename $i)"
fi
fi
cd "$TOP"
cd "$TEST_TOP"
done

View File

@ -2,7 +2,7 @@
# iterate over all fuzzed images and run 'btrfs check'
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -15,6 +15,6 @@ 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

View File

@ -2,7 +2,7 @@
# iterate over all fuzzed images and run 'btrfs-image'
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs-image
@ -17,7 +17,7 @@ check_image() {
truncate -s0 target
}
check_all_images $TOP/tests/fuzz-tests/images
check_all_images $TEST_TOP/fuzz-tests/images
rm -- target

View File

@ -3,7 +3,7 @@
# iterate over all fuzzed images and run 'btrfs check', try various options to
# get more code coverage
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -21,6 +21,6 @@ check_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

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -13,6 +13,6 @@ check_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

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -14,6 +14,6 @@ check_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

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -13,6 +13,6 @@ check_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

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -15,6 +15,6 @@ check_image() {
rm -- "$image".scratch
}
check_all_images $TOP/tests/fuzz-tests/images
check_all_images $TEST_TOP/fuzz-tests/images
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -15,6 +15,6 @@ check_image() {
rm -- "$image".scratch
}
check_all_images $TOP/tests/fuzz-tests/images
check_all_images $TEST_TOP/fuzz-tests/images
exit 0

View File

@ -1,6 +1,6 @@
#!/bin/bash
source $TOP/tests/common
source "$TEST_TOP/common"
setup_root_helper
check_prereq btrfs
@ -15,6 +15,6 @@ check_image() {
rm -- "$image".scratch
}
check_all_images $TOP/tests/fuzz-tests/images
check_all_images $TEST_TOP/fuzz-tests/images
exit 0

View File

@ -4,13 +4,20 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/misc-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/misc-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TEST_TOP/common"
export INTERNAL_BIN
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -31,7 +38,7 @@ 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 "$TEST_TOP/misc-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
echo " [TEST/misc] $(basename $i)"
@ -46,5 +53,5 @@ do
_fail "test failed for case $(basename $i)"
fi
fi
cd "$TOP"
cd "$TEST_TOP"
done

View File

@ -1,7 +1,7 @@
#!/bin/bash
# test btrfstune options that enable filesystem features
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfstune

View File

@ -1,7 +1,7 @@
#!/bin/bash
# test btrfstune uuid rewriting options
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfstune
@ -25,7 +25,7 @@ test_uuid_random()
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
--uuid $origuuid \
--rootdir $TOP/Documentation \
--rootdir $INTERNAL_BIN/Documentation \
$TEST_DEV
run_check $TOP/btrfs inspect-internal dump-super "$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 \
--uuid $origuuid \
--rootdir $TOP/Documentation \
--rootdir $INTERNAL_BIN/Documentation \
$TEST_DEV
run_check $TOP/btrfs inspect-internal dump-super "$TEST_DEV"
run_check $TOP/btrfstune -f -U $newuuid \

View File

@ -1,7 +1,7 @@
#!/bin/bash
# test zero-log
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs
@ -27,7 +27,7 @@ test_zero_log()
{
# FIXME: we need an image with existing log_root
run_check $SUDO_HELPER $TOP/mkfs.btrfs -f \
--rootdir $TOP/Documentation \
--rootdir $INTERNAL_BIN/Documentation \
$TEST_DEV
run_check $TOP/btrfs inspect-internal dump-super $TEST_DEV
if [ "$1" = 'standalone' ]; then

View File

@ -4,7 +4,7 @@
# are able to resize (shrink) it to that size.
#
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# test convert-thread-conflict
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq btrfs-convert

View File

@ -4,7 +4,7 @@
# - btrfs-image must not loop indefinetelly
# - btrfs-image will expectedly fail to produce the dump
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq btrfs-image
check_prereq mkfs.btrfs

View File

@ -4,7 +4,7 @@
# - btrfs subvolume must not loop indefinitely
# - btrfs subvolume return 0 in normal case
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# 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

View File

@ -2,7 +2,7 @@
#
# Verify that subvolume sync waits until the subvolume is cleaned
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -3,7 +3,7 @@
# verify that convert rollback finds the ext2_subvolume intact and fails if it
# was partially deleted
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq btrfs-convert
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# make sure that 'missing' is accepted for device deletion
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -3,7 +3,7 @@
# recent fs or balanced fs, whose metadata chunk is the first chunk
# and the only metadata chunk
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq btrfs-find-root
check_prereq btrfs-image

View File

@ -3,7 +3,7 @@
# Verify that subvolume sync waits until the subvolume is cleaned and does not
# crash at the end
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# test label settings
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# let dump-super dump random data, must not crash
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq btrfs

View File

@ -3,7 +3,7 @@
# test for sending stream size of clone-src option, compare against a send
# stream generated by buggy version
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# test receiving stream that's not valid, simple cases
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -3,7 +3,7 @@
# end of stream conditions: test that no instructions in a stream are still
# received, at least the header must be present
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -5,7 +5,7 @@
# have an entry with the same name that corresponds to different inodes in each
# snapshot.
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs
@ -14,7 +14,7 @@ check_prereq fssum
setup_root_helper
prepare_test_dev
FSSUM_PROG="$TOP/fssum"
FSSUM_PROG="$INTERNAL_BIN/fssum"
srcdir=./send-test-dir
rm -rf "$srcdir"
mkdir -p "$srcdir"

View File

@ -2,7 +2,7 @@
#
# 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

View File

@ -2,7 +2,7 @@
# Test btrfs-image with multiple devices filesystem and verify that restoring
# the created image works against a single device.
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs-image
check_prereq mkfs.btrfs

View File

@ -2,7 +2,7 @@
#
# btrfs fi du should handle empty subvolumes (with ino == 2)
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# 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 mkfs.btrfs

View File

@ -2,7 +2,7 @@
#
# test commands of inspect-internal rootid
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# Test zstd compression support on a prebuilt btrfs image
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq btrfs
check_global_prereq md5sum

View File

@ -2,7 +2,7 @@
# check that sanitized names with matching crc do not contain unprintable
# characters, namely 0x7f
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# 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 btrfs

View File

@ -4,13 +4,20 @@
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
INTERNAL_BIN=$(readlink -f "$SCRIPT_DIR/../")
TEST_TOP=$(readlink -f "$SCRIPT_DIR/../tests/")
TOP=$(readlink -f "$SCRIPT_DIR/../")
if ! [ -f "$TOP/btrfs" ];then
TOP=$(dirname `which btrfs`)
fi
TEST_DEV=${TEST_DEV:-}
RESULTS="$TOP/tests/mkfs-tests-results.txt"
IMAGE="$TOP/tests/test.img"
RESULTS="$TEST_TOP/mkfs-tests-results.txt"
IMAGE="$TEST_TOP/test.img"
source "$TOP/tests/common"
source "$TEST_TOP/common"
export INTERNAL_BIN
export TEST_TOP
export TOP
export RESULTS
export LANG
@ -25,7 +32,7 @@ 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 "$TEST_TOP/mkfs-tests" -maxdepth 1 -mindepth 1 -type d \
${TEST:+-name "$TEST"} | sort)
do
echo " [TEST/mkfs] $(basename $i)"
@ -40,5 +47,5 @@ do
_fail "test failed for case $(basename $i)"
fi
fi
cd "$TOP"
cd "$TEST_TOP"
done

View File

@ -2,7 +2,7 @@
# test various blockgroup profile combinations, use loop devices as block
# devices
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -2,7 +2,7 @@
#
# 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

View File

@ -2,7 +2,7 @@
#
# Mixed mode needs equal sectorsize and nodesize
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# 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
@ -16,7 +16,7 @@ test_mkfs_with_size() {
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 $TOP/Documentation \
--rootdir $INTERNAL_BIN/Documentation \
$TEST_DEV
tmp=$(run_check_stdout stat --format=%s $TEST_DEV)
if ! [ "$imgsize" = "$tmp" ]; then

View File

@ -1,7 +1,7 @@
#!/bin/bash
# a long device name must pass the SSD test
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs

View File

@ -1,7 +1,7 @@
#!/bin/bash
# recognize partitioned loop devices
source $TOP/tests/common
source "$TEST_TOP/common"
if ! losetup --help | grep -q 'partscan'; then
_not_run "losetup --partscan not available"

View File

@ -1,7 +1,7 @@
#!/bin/bash
# iterate over nodesize and sectorsize combinations
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -4,7 +4,7 @@
# only do mkfs and fsck check, no mounting as
# sub/multi-pagesize is not supported yet
source $TOP/tests/common
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs

View File

@ -6,7 +6,7 @@
#
# Note: sock type is skipped in this test
source "$TOP/tests/common"
source "$TEST_TOP/common"
check_prereq mkfs.btrfs
check_prereq btrfs