Message ID | 163062678708.1579659.15462141943907232473.stgit@magnolia (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | fstests: document all test groups | expand |
On Fri, Sep 3, 2021 at 5:14 AM Darrick J. Wong <djwong@kernel.org> wrote: > > From: Darrick J. Wong <djwong@kernel.org> > > Now that we require all group names to be listed in doc/group-names.txt, > we can use that (instead of running mkgroupfile) to check if the group > name(s) supplied by the user actually exist. This has the secondary > effect of being a second nudge towards keeping the description of groups > up to date. > > Signed-off-by: Darrick J. Wong <djwong@kernel.org> > Reviewed-by: Christoph Hellwig <hch@lst.de> > --- > new | 24 +++++++++++------------- > 1 file changed, 11 insertions(+), 13 deletions(-) > > > diff --git a/new b/new > index 2097a883..6b7dc5d4 100755 > --- a/new > +++ b/new > @@ -83,6 +83,14 @@ then > exit 1 > fi > > +# Extract group names from the documentation. > +group_names() { > + awk '/^[[:lower:][:digit:]_]/ { > + if ($1 != "" && $1 != "Group" && $2 != "Name:" && $1 != "all") > + printf("%s\n", $1); > + }' doc/group-names.txt > +} > + > if [ $# -eq 0 ] > then > > @@ -93,16 +101,7 @@ then > [ -z "$ans" ] && ans=other > if [ "X$ans" = "X?" ] > then > - for d in $SRC_GROUPS; do > - (cd "tests/$d/" ; ../../tools/mkgroupfile "$tmpfile") > - l=$(sed -n < "$tmpfile" \ > - -e 's/#.*//' \ > - -e 's/$/ /' \ > - -e 's;\(^[0-9][0-9][0-9]\)\(.*$\);\2;p') > - grpl="$grpl $l" > - done > - lst=`for word in $grpl; do echo $word; done | sort| uniq ` > - echo $lst > + echo $(group_names) > else > # only allow lower cases, spaces, digits and underscore in group > inval=`echo $ans | tr -d '[:lower:][:space:][:digit:]_'` > @@ -120,11 +119,10 @@ then > else > # expert mode, groups are on the command line > # > - (cd "$tdir" ; ../../tools/mkgroupfile "$tmpfile") > for g in $* > do > - if ! grep -q "[[:space:]]$g" "$tmpfile"; then > - echo "Warning: group \"$g\" not defined in $tdir tests" > + if ! grep -q "^$g" doc/group-names.txt; then > + echo "Warning: group \"$g\" not defined in documentation" > fi Do you want to warn (or fail) on new uses of the group "other"? Thanks, Amir.
On Sat, Sep 04, 2021 at 11:43:58AM +0300, Amir Goldstein wrote: > On Fri, Sep 3, 2021 at 5:14 AM Darrick J. Wong <djwong@kernel.org> wrote: > > > > From: Darrick J. Wong <djwong@kernel.org> > > > > Now that we require all group names to be listed in doc/group-names.txt, > > we can use that (instead of running mkgroupfile) to check if the group > > name(s) supplied by the user actually exist. This has the secondary > > effect of being a second nudge towards keeping the description of groups > > up to date. > > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org> > > Reviewed-by: Christoph Hellwig <hch@lst.de> > > --- > > new | 24 +++++++++++------------- > > 1 file changed, 11 insertions(+), 13 deletions(-) > > > > > > diff --git a/new b/new > > index 2097a883..6b7dc5d4 100755 > > --- a/new > > +++ b/new > > @@ -83,6 +83,14 @@ then > > exit 1 > > fi > > > > +# Extract group names from the documentation. > > +group_names() { > > + awk '/^[[:lower:][:digit:]_]/ { > > + if ($1 != "" && $1 != "Group" && $2 != "Name:" && $1 != "all") > > + printf("%s\n", $1); > > + }' doc/group-names.txt > > +} > > + > > if [ $# -eq 0 ] > > then > > > > @@ -93,16 +101,7 @@ then > > [ -z "$ans" ] && ans=other > > if [ "X$ans" = "X?" ] > > then > > - for d in $SRC_GROUPS; do > > - (cd "tests/$d/" ; ../../tools/mkgroupfile "$tmpfile") > > - l=$(sed -n < "$tmpfile" \ > > - -e 's/#.*//' \ > > - -e 's/$/ /' \ > > - -e 's;\(^[0-9][0-9][0-9]\)\(.*$\);\2;p') > > - grpl="$grpl $l" > > - done > > - lst=`for word in $grpl; do echo $word; done | sort| uniq ` > > - echo $lst > > + echo $(group_names) > > else > > # only allow lower cases, spaces, digits and underscore in group > > inval=`echo $ans | tr -d '[:lower:][:space:][:digit:]_'` > > @@ -120,11 +119,10 @@ then > > else > > # expert mode, groups are on the command line > > # > > - (cd "$tdir" ; ../../tools/mkgroupfile "$tmpfile") > > for g in $* > > do > > - if ! grep -q "[[:space:]]$g" "$tmpfile"; then > > - echo "Warning: group \"$g\" not defined in $tdir tests" > > + if ! grep -q "^$g" doc/group-names.txt; then > > + echo "Warning: group \"$g\" not defined in documentation" > > fi > > Do you want to warn (or fail) on new uses of the group "other"? Yeah, I'll add a new patch on the end to do that. --D > Thanks, > Amir.
diff --git a/new b/new index 2097a883..6b7dc5d4 100755 --- a/new +++ b/new @@ -83,6 +83,14 @@ then exit 1 fi +# Extract group names from the documentation. +group_names() { + awk '/^[[:lower:][:digit:]_]/ { + if ($1 != "" && $1 != "Group" && $2 != "Name:" && $1 != "all") + printf("%s\n", $1); + }' doc/group-names.txt +} + if [ $# -eq 0 ] then @@ -93,16 +101,7 @@ then [ -z "$ans" ] && ans=other if [ "X$ans" = "X?" ] then - for d in $SRC_GROUPS; do - (cd "tests/$d/" ; ../../tools/mkgroupfile "$tmpfile") - l=$(sed -n < "$tmpfile" \ - -e 's/#.*//' \ - -e 's/$/ /' \ - -e 's;\(^[0-9][0-9][0-9]\)\(.*$\);\2;p') - grpl="$grpl $l" - done - lst=`for word in $grpl; do echo $word; done | sort| uniq ` - echo $lst + echo $(group_names) else # only allow lower cases, spaces, digits and underscore in group inval=`echo $ans | tr -d '[:lower:][:space:][:digit:]_'` @@ -120,11 +119,10 @@ then else # expert mode, groups are on the command line # - (cd "$tdir" ; ../../tools/mkgroupfile "$tmpfile") for g in $* do - if ! grep -q "[[:space:]]$g" "$tmpfile"; then - echo "Warning: group \"$g\" not defined in $tdir tests" + if ! grep -q "^$g" doc/group-names.txt; then + echo "Warning: group \"$g\" not defined in documentation" fi done ans="$*"