@@ -158,3 +158,10 @@ prepare_test_dev()
truncate -s "$size" "$TEST_DEV" || _not_run "create file for loop device failed"
}
+init_env()
+{
+ TEST_MNT="${TEST_MNT:-$TOP/tests/mnt}"
+ export TEST_MNT
+ mkdir -p "$TEST_MNT" || { echo "Failed mkdir -p $TEST_MNT"; exit 1; }
+}
+init_env
@@ -9,7 +9,6 @@ unset LANG
LANG=C
SCRIPT_DIR=$(dirname $(readlink -f $0))
TOP=$(readlink -f $SCRIPT_DIR/../)
-TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
RESULTS="$TOP/tests/convert-tests-results.txt"
IMAGE="$TOP/tests/test.img"
@@ -11,7 +11,6 @@ LANG=C
SCRIPT_DIR=$(dirname $(readlink -f $0))
TOP=$(readlink -f $SCRIPT_DIR/../)
TEST_DEV=${TEST_DEV:-}
-TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
RESULTS="$TOP/tests/fsck-tests-results.txt"
source $TOP/tests/common
@@ -20,11 +19,9 @@ source $TOP/tests/common
export TOP
export RESULTS
# For custom script needs to verfiy recovery
-export TEST_MNT
export LANG
rm -f $RESULTS
-mkdir -p $TEST_MNT || _fail "unable to create mount point on $TEST_MNT"
# test rely on corrupting blocks tool
check_prereq btrfs-corrupt-block
@@ -85,7 +85,6 @@ check_inode()
check_leaf_corrupt_no_data_ext()
{
image=$1
- mkdir -p $TEST_MNT || _fail "failed to create mount point"
$SUDO_HELPER mount -o loop $image -o ro $TEST_MNT
i=0
@@ -7,11 +7,6 @@ check_prereq mkfs.btrfs
setup_root_helper
prepare_test_dev 1G
-if [ -z $TEST_MNT ];then
- echo " [NOTRUN] extent tree rebuild, need TEST_MNT variant"
- exit 0
-fi
-
# test whether fsck can rebuild a corrupted extent tree
test_extent_tree_rebuild()
{
@@ -8,7 +8,6 @@ LANG=C
SCRIPT_DIR=$(dirname $(readlink -f $0))
TOP=$(readlink -f $SCRIPT_DIR/../)
TEST_DEV=${TEST_DEV:-}
-TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
RESULTS="$TOP/tests/misc-tests-results.txt"
IMAGE="$TOP/tests/test.img"
@@ -18,11 +17,9 @@ source $TOP/tests/common
export TOP
export RESULTS
# For custom script needs to verfiy recovery
-export TEST_MNT
export LANG
rm -f $RESULTS
-mkdir -p $TEST_MNT || _fail "unable to create mount point on $TEST_MNT"
# test rely on corrupting blocks tool
check_prereq btrfs-corrupt-block
@@ -9,11 +9,6 @@ check_prereq mkfs.btrfs
setup_root_helper
prepare_test_dev
-if [ -z $TEST_MNT ];then
- echo " [NOTRUN] extent tree rebuild, need TEST_MNT variant"
- exit 0
-fi
-
# test whether fsck can rebuild a corrupted extent tree
# parameters:
# - option for mkfs.btrfs -O, empty for defaults
@@ -9,11 +9,6 @@ check_prereq mkfs.btrfs
check_prereq btrfstune
prepare_test_dev
-if [ -z $TEST_MNT ];then
- echo " [NOTRUN] extent tree rebuild, need TEST_MNT variant"
- exit 0
-fi
-
get_fs_uuid() {
local image
@@ -8,11 +8,6 @@ check_prereq mkfs.btrfs
check_prereq btrfs
prepare_test_dev
-if [ -z $TEST_MNT ];then
- echo " [NOTRUN] extent tree rebuild, need TEST_MNT variant"
- exit 0
-fi
-
get_log_root()
{
local image