[dpdk-dev] [PATCH v2] checkpatches.sh: Add checks for ABI symbol addition

Neil Horman nhorman at tuxdriver.com
Mon Jan 22 02:54:29 CET 2018


On Sun, Jan 21, 2018 at 09:29:18PM +0100, Thomas Monjalon wrote:
> Hi,
> 
> 16/01/2018 19:22, Neil Horman:
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> >  Developers and Maintainers Tools
> >  M: Thomas Monjalon <thomas at monjalon.net>
> > +M: Neil Horman <nhorman at tuxdriver.com>
> >  F: MAINTAINERS
> >  F: devtools/check-dup-includes.sh
> >  F: devtools/check-maintainers.sh
> > @@ -52,6 +53,7 @@ F: devtools/get-maintainer.sh
> >  F: devtools/git-log-fixes.sh
> >  F: devtools/load-devel-config
> >  F: devtools/test-build.sh
> > +F: devtools/validate-new-api.sh
> >  F: license/
> 
> I really think it should be in the section "ABI versioning""
> 
I can do that.

> > --- a/devtools/checkpatches.sh
> > +++ b/devtools/checkpatches.sh
> > +export VALIDATE_NEW_API=$(dirname $(readlink -e $0))/validate-new-api.sh
> 
> Why export?
> 
As I recall I had needed that in an earlier incantation of this script, but its
likely not needed any longer

> >  print_usage () {
> >  	cat <<- END_OF_HELP
> > +	$(dirname $0)
> >  	usage: $(basename $0) [-q] [-v] [-nX|patch1 [patch2] ...]]
> 
> This dirname is a debug leftover?
Yes.

> 
> > @@ -96,9 +100,25 @@ check () { # <patch> <commit> <title>
> >  	else
> >  		report=$($DPDK_CHECKPATCH_PATH $options - 2>/dev/null)
> >  	fi
> > -	[ $? -ne 0 ] || return 0
> > +	reta=$?
> 
> What means reta?
> 
just a subindex on a return code.

> > +
> >  	$verbose || printf '\n### %s\n\n' "$3"
> >  	printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
> > +
> > +	echo
> > +	echo "Checking API additions/removals:"
> 
> You should respect $verbose before printing such header.
> 
I can add a quiet/verbose mode option, but I didn't think it was needed here
since its being run automatically from within checkpatches.

> > +	if [ -n "$1" ] ; then
> > +		report=$($VALIDATE_NEW_API $1)
> > +	elif [ -n "$2" ] ; then
> > +		report=$(git format-patch \
> > +			 --find-renames --no-stat --stdout -1 $commit |
> > +			$VALIDATE_NEW_API -)
> > +	else
> > +		report=$($VALIDATE_NEW_API -)
> > +	fi
> > +	[ $? -ne 0 -o $reta -ne 0 ] || return 0
> > +	printf '%s\n' "$report" | sed -n '1,/^total:.*lines checked$/p'
> > +
> >  	status=$(($status + 1))
> >  }
> 
> > --- /dev/null
> > +++ b/devtools/validate-new-api.sh
> 
> About the file name, is it only for new API?
> You don't like check-symbol-change.sh ?
> It may be stupid, but I thought "validate" is more related to full test,
> like validate-abi.sh does for the ABI, and "check" can be a partial
> test like done in checkpatches.sh.
> 
I can change the name, but to answer your question, its realy meant to validate
any changes to a version map, so change.sh suffixes might be more appropriate.

> > +		}' > ./$mapdb
> > +
> > +		sort -u $mapdb > ./$mapdb.2
> > +		mv -f $mapdb.2 $mapdb
> [...]
> > +mapfile=`mktemp mapdb.XXXXXX`
> [...]
> > +rm -f $mapfile
> 
> If you create temporary file, you should remove it in a trap cleanup,
> in case of interrupted processing.
> The best is to avoid temp file, but use variables instead.
I'm not going to be able to avoid a temp file, since the number of changes in a
map are inditerminate.  I can trap and clean up the temp files though.

I'm still in transit, so it will likely be a few days before I can get to this.

Neil

> 


More information about the dev mailing list