diff mbox

btrfs-progs: tests: Add testcase filter for misc-tests

Message ID 09dc1a986fea9d55b40095632d1efd8f4c050730.1440733418.git.zhaolei@cn.fujitsu.com (mailing list archive)
State Rejected
Headers show

Commit Message

Zhaolei Aug. 28, 2015, 3:43 a.m. UTC
Add testcase filter for misc-tests, so we can select to run necessary
test cases.

For example:
 # ./misc-tests.sh 002
    [TEST]   002-uuid-rewrite
 #
 # ./misc-tests.sh subvolume
    [TEST]   007-subvolume-sync
 #

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
---
 tests/misc-tests.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

David Sterba Aug. 28, 2015, 5:33 p.m. UTC | #1
On Fri, Aug 28, 2015 at 11:43:56AM +0800, Zhao Lei wrote:
> Add testcase filter for misc-tests, so we can select to run necessary
> test cases.
> 
> For example:
>  # ./misc-tests.sh 002
>     [TEST]   002-uuid-rewrite
>  #
>  # ./misc-tests.sh subvolume
>     [TEST]   007-subvolume-sync
>  #

I'm not sure this is is necessary, the TEST variable can be used for
that purpose:

 $ TEST='002*' ./misc-tests.sh
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/tests/misc-tests.sh b/tests/misc-tests.sh
index 1ed8850..f9c1152 100755
--- a/tests/misc-tests.sh
+++ b/tests/misc-tests.sh
@@ -12,6 +12,8 @@  TEST_MNT=${TEST_MNT:-$TOP/tests/mnt}
 RESULTS="$TOP/tests/misc-tests-results.txt"
 IMAGE="$TOP/tests/test.img"
 
+TEST_FILTER="$1"
+
 source $TOP/tests/common
 
 # Allow child test to use $TOP and $RESULTS
@@ -35,7 +37,7 @@  check_prereq btrfs
 # The tests are driven by their custom script called 'test.sh'
 
 for i in $(find $TOP/tests/misc-tests -maxdepth 1 -mindepth 1 -type d	\
-	${TEST:+-name "$TEST"} | sort)
+	${TEST:+-name "$TEST"} | sort | grep -e "$TEST_FILTER")
 do
 	echo "    [TEST]   $(basename $i)"
 	cd $i