summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2015-05-25 16:08:46 +0200
committerDavid Sterba <dsterba@suse.cz>2015-05-25 16:10:58 +0200
commitb51cc1d32555082d02a68d946cbbed0983f82270 (patch)
treee938728cf5f1935ffd0f8ab1791cedaa3e6c36cd
parent1497c92e67233d7c467eb94203add879662272fd (diff)
btrfs-progs: tests: add script to clean intermediate images
Signed-off-by: David Sterba <dsterba@suse.cz>
-rw-r--r--Makefile.in4
-rwxr-xr-xtests/clean-tests.sh19
2 files changed, 23 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index 860a390b..14049b58 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -169,6 +169,10 @@ test-fsck: btrfs btrfs-image btrfs-corrupt-block btrfs-debug-tree mkfs.btrfs
@echo " [TEST] fsck-tests.sh"
$(Q)bash tests/fsck-tests.sh
+test-clean:
+ @echo "Cleaning tests"
+ $(Q)bash tests/clean-tests.sh
+
test: test-fsck test-convert
#
diff --git a/tests/clean-tests.sh b/tests/clean-tests.sh
new file mode 100755
index 00000000..c1dc56af
--- /dev/null
+++ b/tests/clean-tests.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# remove all intermediate files from tests
+
+if [ "$BUILD_VERBOSE" = 1 ]; then
+ verbose=-print
+fi
+
+SCRIPT_DIR=$(dirname $(readlink -f $0))
+TOP=$(readlink -f $SCRIPT_DIR/../)
+
+if ! cd $TOP/tests; then
+ echo "ERROR: cannot cd to $TOP/tests"
+ 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