2016-07-04 11:45:15 +00:00
|
|
|
#!/bin/bash
|
2015-05-25 14:08:46 +00:00
|
|
|
# remove all intermediate files from tests
|
|
|
|
|
2018-02-08 17:34:40 +00:00
|
|
|
LANG=C
|
2016-11-11 09:12:05 +00:00
|
|
|
SCRIPT_DIR=$(dirname $(readlink -f "$0"))
|
2018-02-08 17:34:40 +00:00
|
|
|
if [ -z "$TOP" ]; then
|
|
|
|
TOP=$(readlink -f "$SCRIPT_DIR/../")
|
|
|
|
if [ -f "$TOP/configure.ac" ]; then
|
|
|
|
# inside git
|
|
|
|
TEST_TOP="$TOP/tests/"
|
|
|
|
INTERNAL_BIN="$TOP"
|
|
|
|
else
|
|
|
|
# external, defaults to system binaries
|
|
|
|
TOP=$(dirname `which btrfs`)
|
|
|
|
TEST_TOP="$SCRIPT_DIR"
|
|
|
|
INTERNAL_BIN="$TEST_TOP"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
# assume external, TOP set from commandline
|
|
|
|
TEST_TOP="$SCRIPT_DIR"
|
|
|
|
INTERNAL_BIN="$TEST_TOP"
|
|
|
|
fi
|
|
|
|
if ! [ -x "$TOP/btrfs" ]; then
|
|
|
|
echo "ERROR: cannot execute btrfs from TOP=$TOP"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
TEST_DEV=${TEST_DEV:-}
|
|
|
|
RESULTS="$TEST_TOP/cli-tests-results.txt"
|
|
|
|
IMAGE="$TEST_TOP/test.img"
|
|
|
|
|
2018-02-13 15:21:20 +00:00
|
|
|
source "$TEST_TOP/common"
|
2015-08-31 05:04:38 +00:00
|
|
|
|
|
|
|
setup_root_helper
|
|
|
|
|
2015-05-25 14:08:46 +00:00
|
|
|
if [ "$BUILD_VERBOSE" = 1 ]; then
|
|
|
|
verbose=-print
|
|
|
|
fi
|
|
|
|
|
2015-08-31 05:04:38 +00:00
|
|
|
$SUDO_HELPER umount "$TEST_MNT" &>/dev/null
|
2015-05-25 14:08:46 +00:00
|
|
|
|
2018-02-13 15:21:20 +00:00
|
|
|
if ! cd "$TEST_TOP"; then
|
|
|
|
echo "ERROR: cannot cd to $TEST_TOP"
|
2015-05-25 14:08:46 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
find fsck-tests -type f -name '*.restored' $verbose -delete
|
|
|
|
|
|
|
|
# do not remove, the file could have special permissions set
|
|
|
|
echo -n > test.img
|