Patchwork check: add support for an external test expunging file

login
register
mail settings
Submitter Theodore Ts'o
Date April 15, 2014, 2:52 a.m.
Message ID <1397530320-20579-1-git-send-email-tytso@mit.edu>
Download mbox | patch
Permalink /patch/339139/
State Superseded
Headers show

Comments

Theodore Ts'o - April 15, 2014, 2:52 a.m.
Currently the -X option is intended to specify a set of expunging
files which are stored in each test/* subdirectory.  As described in
the commit description for 0b1e8abd4, in order to exclude the test
generic/280, the -X option is used as follows:

    $ cat tests/generic/3.0-stable-avoid
    280
    $ sudo ./check -X 3.0-stable-avoid generic/280

However, it is sometimes useful to store the set of expunged tests in
a single file, outside of tests/* subdirectories.  This commit allows
the following:

    $ cat /root/conf/data_journal.exclude
    generic/068
    ext4/301
    $ sudo ./check -X /root/conf/data_journal.exclude -g auto

If the argument to the -X option is a pathname (that is, includes a
'/' character), treat it as the latter case.  If it the argument to
the -X option is just a bare filename (that is, does not include '/'
character), treat it as the former.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 check | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
Dave Chinner - April 16, 2014, 12:15 a.m.
On Mon, Apr 14, 2014 at 10:52:00PM -0400, Theodore Ts'o wrote:
> Currently the -X option is intended to specify a set of expunging
> files which are stored in each test/* subdirectory.  As described in
> the commit description for 0b1e8abd4, in order to exclude the test
> generic/280, the -X option is used as follows:
> 
>     $ cat tests/generic/3.0-stable-avoid
>     280
>     $ sudo ./check -X 3.0-stable-avoid generic/280
> 
> However, it is sometimes useful to store the set of expunged tests in
> a single file, outside of tests/* subdirectories.  This commit allows
> the following:
> 
>     $ cat /root/conf/data_journal.exclude
>     generic/068
>     ext4/301
>     $ sudo ./check -X /root/conf/data_journal.exclude -g auto
> 
> If the argument to the -X option is a pathname (that is, includes a
> '/' character), treat it as the latter case.  If it the argument to
> the -X option is just a bare filename (that is, does not include '/'
> character), treat it as the former.

Can you add a new option rather than overloading the existing one
with new meanings and semantics?

Cheers,

Dave.
Theodore Ts'o - April 16, 2014, 12:25 a.m.
On Wed, Apr 16, 2014 at 10:15:30AM +1000, Dave Chinner wrote:
> > If the argument to the -X option is a pathname (that is, includes a
> > '/' character), treat it as the latter case.  If it the argument to
> > the -X option is just a bare filename (that is, does not include '/'
> > character), treat it as the former.
> 
> Can you add a new option rather than overloading the existing one
> with new meanings and semantics?

If that's your preference, sure.  How does --expunge-list-file strike
you?  Or would you prefer something else?  I'm easy.  :-)

      	       	   	  	    	       - Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dave Chinner - April 16, 2014, 12:34 a.m.
On Tue, Apr 15, 2014 at 08:25:50PM -0400, Theodore Ts'o wrote:
> On Wed, Apr 16, 2014 at 10:15:30AM +1000, Dave Chinner wrote:
> > > If the argument to the -X option is a pathname (that is, includes a
> > > '/' character), treat it as the latter case.  If it the argument to
> > > the -X option is just a bare filename (that is, does not include '/'
> > > character), treat it as the former.
> > 
> > Can you add a new option rather than overloading the existing one
> > with new meanings and semantics?
> 
> If that's your preference, sure.  How does --expunge-list-file strike
> you?  Or would you prefer something else?  I'm easy.  :-)

-E/--expunge-file is fine by me.

Cheers,

Dave.

Patch

diff --git a/check b/check
index e7ace63..791a386 100755
--- a/check
+++ b/check
@@ -215,12 +215,22 @@  while [ $# -gt 0 ]; do
 		;;
 
 	-X)	xfile=$2; shift ;
-		for d in $SRC_GROUPS $FSTYP; do
-			[ -f $SRC_DIR/$d/$xfile ] || continue
-			for f in `cat $SRC_DIR/$d/$xfile`; do
-				echo $d/$f >> $tmp.xlist
+		case "$xfile" in
+		*/*)	if [ -f "$xfile" ]; then
+				cat "$xfile" >> $tmp.xlist
+			else
+				echo "Exclusion file $xfile not found"
+				exit 1
+			fi
+			;;
+		*)	for d in $SRC_GROUPS $FSTYP; do
+				[ -f $SRC_DIR/$d/$xfile ] || continue
+				for f in `cat $SRC_DIR/$d/$xfile`; do
+				    echo $d/$f >> $tmp.xlist
+				done
 			done
-		done
+			;;
+		esac
 		;;
 	-s)	RUN_SECTION="$RUN_SECTION $2"; shift ;;
 	-l)	diff="diff" ;;