public inbox for fstests@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] check: factor out get_sub_group_list() helper
@ 2017-01-02 13:22 Amir Goldstein
  2017-01-02 13:22 ` [PATCH 2/2] check: support include/exclude of sub groups Amir Goldstein
  0 siblings, 1 reply; 5+ messages in thread
From: Amir Goldstein @ 2017-01-02 13:22 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

This helper gets a list of tests that belong to a group
under a specific tests subdir.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 check | 23 +++++++++++++++++------
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/check b/check
index cf6379b..faf6281 100755
--- a/check
+++ b/check
@@ -87,19 +87,30 @@ testlist options
 	    exit 0
 }
 
+get_sub_group_list()
+{
+	local d=$1
+	local grp=$2
+
+	test -s "$SRC_DIR/$d/group" || return 1
+
+	local grpl=$(sed -n < $SRC_DIR/$d/group \
+		-e 's/#.*//' \
+		-e 's/$/ /' \
+		-e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
+	echo $grpl
+}
+
 get_group_list()
 {
-	grp=$1
+	local grp=$1
+	local grpl=""
 
 	for d in $SRC_GROUPS $FSTYP; do
 		if ! test -d "$SRC_DIR/$d" ; then
 			continue
 		fi
-		l=$(sed -n < $SRC_DIR/$d/group \
-			-e 's/#.*//' \
-			-e 's/$/ /' \
-			-e "s;^\($VALID_TEST_NAME\).* $grp .*;$SRC_DIR/$d/\1;p")
-		grpl="$grpl $l"
+		grpl="$grpl $(get_sub_group_list $d $grp)"
 	done
 	echo $grpl
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] check: support include/exclude of sub groups
  2017-01-02 13:22 [PATCH 1/2] check: factor out get_sub_group_list() helper Amir Goldstein
@ 2017-01-02 13:22 ` Amir Goldstein
  2017-01-03  5:06   ` Eryu Guan
  2017-01-03  9:15   ` [PATCH 3/3] check: document tests include/exclude options Amir Goldstein
  0 siblings, 2 replies; 5+ messages in thread
From: Amir Goldstein @ 2017-01-02 13:22 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

Allow including and/or excluding tests by test dir and group.
-g and -x command line arguments can take the form of
<subdir>/<group>.

For example:

./check -n -g xfs/quick
./check -n -g stress -x xfs/stress
./check -n -g xfs/punch -x dangerous_fuzzers

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 check | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/check b/check
index faf6281..8d1ec71 100755
--- a/check
+++ b/check
@@ -105,6 +105,14 @@ get_group_list()
 {
 	local grp=$1
 	local grpl=""
+	local sub=$(dirname $grp)
+
+	if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
+		# group is given as <subdir>/<group> (e.g. xfs/quick)
+		grp=$(basename $grp)
+		get_sub_group_list $sub $grp
+		return
+	fi
 
 	for d in $SRC_GROUPS $FSTYP; do
 		if ! test -d "$SRC_DIR/$d" ; then
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] check: support include/exclude of sub groups
  2017-01-02 13:22 ` [PATCH 2/2] check: support include/exclude of sub groups Amir Goldstein
@ 2017-01-03  5:06   ` Eryu Guan
  2017-01-03  9:10     ` Amir Goldstein
  2017-01-03  9:15   ` [PATCH 3/3] check: document tests include/exclude options Amir Goldstein
  1 sibling, 1 reply; 5+ messages in thread
From: Eryu Guan @ 2017-01-03  5:06 UTC (permalink / raw)
  To: Amir Goldstein; +Cc: fstests

On Mon, Jan 02, 2017 at 03:22:59PM +0200, Amir Goldstein wrote:
> Allow including and/or excluding tests by test dir and group.
> -g and -x command line arguments can take the form of
> <subdir>/<group>.
> 
> For example:
> 
> ./check -n -g xfs/quick
> ./check -n -g stress -x xfs/stress
> ./check -n -g xfs/punch -x dangerous_fuzzers
> 
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>

This looks handy to me! Mention this usage in usage() function too?

Thanks,
Eryu

> ---
>  check | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/check b/check
> index faf6281..8d1ec71 100755
> --- a/check
> +++ b/check
> @@ -105,6 +105,14 @@ get_group_list()
>  {
>  	local grp=$1
>  	local grpl=""
> +	local sub=$(dirname $grp)
> +
> +	if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
> +		# group is given as <subdir>/<group> (e.g. xfs/quick)
> +		grp=$(basename $grp)
> +		get_sub_group_list $sub $grp
> +		return
> +	fi
>  
>  	for d in $SRC_GROUPS $FSTYP; do
>  		if ! test -d "$SRC_DIR/$d" ; then
> -- 
> 2.7.4
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] check: support include/exclude of sub groups
  2017-01-03  5:06   ` Eryu Guan
@ 2017-01-03  9:10     ` Amir Goldstein
  0 siblings, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2017-01-03  9:10 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

On Tue, Jan 3, 2017 at 7:06 AM, Eryu Guan <eguan@redhat.com> wrote:
> On Mon, Jan 02, 2017 at 03:22:59PM +0200, Amir Goldstein wrote:
>> Allow including and/or excluding tests by test dir and group.
>> -g and -x command line arguments can take the form of
>> <subdir>/<group>.
>>
>> For example:
>>
>> ./check -n -g xfs/quick
>> ./check -n -g stress -x xfs/stress
>> ./check -n -g xfs/punch -x dangerous_fuzzers
>>
>> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
>
> This looks handy to me! Mention this usage in usage() function too?
>

usage() is so far behind and cryptic (what is the difference between -E and -X?)
I will send a separate patch to address these and the new subgroup as well.

> Thanks,
> Eryu
>
>> ---
>>  check | 8 ++++++++
>>  1 file changed, 8 insertions(+)
>>
>> diff --git a/check b/check
>> index faf6281..8d1ec71 100755
>> --- a/check
>> +++ b/check
>> @@ -105,6 +105,14 @@ get_group_list()
>>  {
>>       local grp=$1
>>       local grpl=""
>> +     local sub=$(dirname $grp)
>> +
>> +     if [ -n "$sub" -a "$sub" != "." -a -d "$SRC_DIR/$sub" ]; then
>> +             # group is given as <subdir>/<group> (e.g. xfs/quick)
>> +             grp=$(basename $grp)
>> +             get_sub_group_list $sub $grp
>> +             return
>> +     fi
>>
>>       for d in $SRC_GROUPS $FSTYP; do
>>               if ! test -d "$SRC_DIR/$d" ; then
>> --
>> 2.7.4
>>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] check: document tests include/exclude options
  2017-01-02 13:22 ` [PATCH 2/2] check: support include/exclude of sub groups Amir Goldstein
  2017-01-03  5:06   ` Eryu Guan
@ 2017-01-03  9:15   ` Amir Goldstein
  1 sibling, 0 replies; 5+ messages in thread
From: Amir Goldstein @ 2017-01-03  9:15 UTC (permalink / raw)
  To: Eryu Guan; +Cc: fstests

Add argument description and examples to usage() for the
various tests include and exclude options.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 check | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/check b/check
index 8d1ec71..5a93c94 100755
--- a/check
+++ b/check
@@ -80,9 +80,36 @@ check options
 testlist options
     -g group[,group...]	include tests from these groups
     -x group[,group...]	exclude tests from these groups
-    -X file		exclude individual tests
+    -X exclude_file	exclude individual tests
     -E external_file	exclude individual tests
     [testlist]		include tests matching names in testlist
+
+testlist argument is a list of tests in the form of <test dir>/<test name>.
+
+<test dir> is a directory under tests that contains a group file,
+with a list of the names of the tests in that directory.
+
+<test name> may be either a specific test file name (e.g. xfs/001) or
+a test file name match pattern (e.g. xfs/*).
+
+group argument is either a name of a tests group to collect from all
+the test dirs (e.g. quick) or a name of a tests group to collect from
+a specific tests dir in the form of <test dir>/<group name> (e.g. xfs/quick).
+
+exclude_file argument refers to a name of a file inside each test directory.
+for every test dir where this file is found, the listed test names are
+excluded from the list of tests to run from that test dir.
+
+external_file argument is a path to a single file containing a list of tests
+to exclude in the form of <test dir>/<test name>.
+
+examples:
+ check xfs/001
+ check -g quick
+ check -g xfs/quick
+ check -x stress xfs/*
+ check -X .exclude -g auto
+ check -E ~/.xfstests.exclude
 '
 	    exit 0
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-03  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-02 13:22 [PATCH 1/2] check: factor out get_sub_group_list() helper Amir Goldstein
2017-01-02 13:22 ` [PATCH 2/2] check: support include/exclude of sub groups Amir Goldstein
2017-01-03  5:06   ` Eryu Guan
2017-01-03  9:10     ` Amir Goldstein
2017-01-03  9:15   ` [PATCH 3/3] check: document tests include/exclude options Amir Goldstein

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox