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

Thomas Monjalon thomas at monjalon.net
Sun Jan 21 21:29:18 CET 2018


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""

> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> +export VALIDATE_NEW_API=$(dirname $(readlink -e $0))/validate-new-api.sh

Why export?

>  print_usage () {
>  	cat <<- END_OF_HELP
> +	$(dirname $0)
>  	usage: $(basename $0) [-q] [-v] [-nX|patch1 [patch2] ...]]

This dirname is a debug leftover?

> @@ -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?

> +
>  	$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.

> +	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.

> +		}' > ./$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.


More information about the dev mailing list