btrfs-progs: Add make testsuite command for export tests
authorGu Jinxiang <gujx@cn.fujitsu.com>
Thu, 8 Feb 2018 06:34:18 +0000 (14:34 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 13 Feb 2018 14:41:32 +0000 (15:41 +0100)
Export the testsuite files to a separate tar.  Since fsck tests depend
on btrfs-corrupt-block, and misc tests depends on both
btrfs-corrupt-block and fssum, so set it as prerequisites for package
commad.

Because, althougth fssum can be generated by source that are all in
tests directory, and has no rely on the btrfs's structure.  But
btrfs-corrupt-block deeply relys on btrfs's structure.  For consistency,
at the present stage, generete the two when create test tar.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
[ applied without changes, the generated tarball will be different from
  the one after the follow up commits ]
Signed-off-by: David Sterba <dsterba@suse.com>
.gitignore
Makefile
tests/export-tests.sh [new file with mode: 0755]
testsuites-list [new file with mode: 0644]

index 8e607f6..a41ad8c 100644 (file)
@@ -43,6 +43,7 @@ libbtrfs.so.0.1
 library-test
 library-test-static
 /fssum
+testsuites-id
 
 /tests/*-tests-results.txt
 /tests/test-console.txt
index 39d1d77..3a5e01d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -331,6 +331,10 @@ test-inst: all
 
 test: test-fsck test-mkfs test-convert test-misc test-fuzz test-cli
 
+testsuite: btrfs-corrupt-block fssum
+       @echo "Export tests as a package"
+       $(Q)bash tests/export-tests.sh
+
 #
 # NOTE: For static compiles, you need to have all the required libs
 #      static equivalent available
diff --git a/tests/export-tests.sh b/tests/export-tests.sh
new file mode 100755 (executable)
index 0000000..0ed7dd9
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/bash
+# export the testsuite files to a separate tar
+
+TESTSUITES_LIST_FILE=$PWD/testsuites-list
+if ! [ -f $TESTSUITES_LIST_FILE ];then
+       echo "testsuites list file is not exsit."
+       exit 1
+fi
+
+TESTSUITES_LIST=$(cat $TESTSUITES_LIST_FILE)
+if [ -z "$TESTSUITES_LIST" ]; then
+       echo "no file be list in testsuites-list"
+       exit 1
+fi
+
+DEST="btrfs-progs-tests.tar.gz"
+if [ -f $DEST ];then
+       echo "remove exsit package: " $DEST
+       rm $DEST
+fi
+
+TEST_ID=$PWD/testsuites-id
+if [ -f $TEST_ID ];then
+       rm $TEST_ID
+fi
+VERSION=`./version.sh`
+TIMESTAMP=`date -u "+%Y-%m-%d %T %Z"`
+
+echo "git version: " $VERSION > $TEST_ID
+echo "this tar is created in: " $TIMESTAMP >> $TEST_ID
+
+echo "begin create tar:  " $DEST
+tar --exclude-vcs-ignores -zScf $DEST -C ../ $TESTSUITES_LIST
+if [ $? -eq 0 ]; then
+       echo "create tar successfully."
+fi
+rm $TEST_ID
diff --git a/testsuites-list b/testsuites-list
new file mode 100644 (file)
index 0000000..a24591f
--- /dev/null
@@ -0,0 +1,22 @@
+btrfs-progs/testsuites-id
+btrfs-progs/fssum
+btrfs-progs/btrfs-corrupt-block
+btrfs-progs/Documentation/
+btrfs-progs/tests/cli-tests
+btrfs-progs/tests/cli-tests.sh
+btrfs-progs/tests/common
+btrfs-progs/tests/common.convert
+btrfs-progs/tests/common.local
+btrfs-progs/tests/convert-tests
+btrfs-progs/tests/convert-tests.sh
+btrfs-progs/tests/fsck-tests
+btrfs-progs/tests/fsck-tests.sh
+btrfs-progs/tests/fuzz-tests/
+btrfs-progs/tests/fuzz-tests.sh
+btrfs-progs/tests/misc-tests/
+btrfs-progs/tests/misc-tests.sh
+btrfs-progs/tests/mkfs-tests/
+btrfs-progs/tests/mkfs-tests.sh
+btrfs-progs/tests/README.md
+btrfs-progs/tests/scan-results.sh
+btrfs-progs/tests/test-console.sh