btrfs-progs: Remove unused parameter
[platform/upstream/btrfs-progs.git] / tests / clean-tests.sh
1 #!/bin/bash
2 # remove all intermediate files from tests
3
4 LANG=C
5 SCRIPT_DIR=$(dirname $(readlink -f "$0"))
6 if [ -z "$TOP" ]; then
7         TOP=$(readlink -f "$SCRIPT_DIR/../")
8         if [ -f "$TOP/configure.ac" ]; then
9                 # inside git
10                 TEST_TOP="$TOP/tests/"
11                 INTERNAL_BIN="$TOP"
12         else
13                 # external, defaults to system binaries
14                 TOP=$(dirname `which btrfs`)
15                 TEST_TOP="$SCRIPT_DIR"
16                 INTERNAL_BIN="$TEST_TOP"
17         fi
18 else
19         # assume external, TOP set from commandline
20         TEST_TOP="$SCRIPT_DIR"
21         INTERNAL_BIN="$TEST_TOP"
22 fi
23 if ! [ -x "$TOP/btrfs" ]; then
24         echo "ERROR: cannot execute btrfs from TOP=$TOP"
25         exit 1
26 fi
27 TEST_DEV=${TEST_DEV:-}
28 RESULTS="$TEST_TOP/cli-tests-results.txt"
29 IMAGE="$TEST_TOP/test.img"
30
31 source "$TEST_TOP/common"
32
33 setup_root_helper
34
35 if [ "$BUILD_VERBOSE" = 1 ]; then
36         verbose=-print
37 fi
38
39 $SUDO_HELPER umount "$TEST_MNT" &>/dev/null
40
41 if ! cd "$TEST_TOP"; then
42         echo "ERROR: cannot cd to $TEST_TOP"
43         exit 1
44 fi
45
46 find fsck-tests -type f -name '*.restored' $verbose -delete
47
48 # do not remove, the file could have special permissions set
49 echo -n > test.img