[dpdk-dev] [PATCH v1] devtools: fix error propagation from check-forbidden-tokens.awk

David Marchand david.marchand at redhat.com
Tue Dec 18 15:49:16 CET 2018


On Tue, Dec 18, 2018 at 3:45 PM Arnon Warshavsky <arnon at qwilt.com> wrote:

> The reason I did not use the && approach is that if both checks have
> errors,
> only the first will be reported and we want all errors to be reported at
> once
> without discovering them one by one after every fix.
>
>
Ok, then:

 diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index ee8debe..7457f01 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -46,12 +46,13 @@ print_usage () {
 check_forbidden_additions() { # <patch>
        # refrain from new additions of rte_panic() and rte_exit()
        # multiple folders and expressions are separated by spaces
+       ret=0
        awk -v FOLDERS="lib drivers" \
                -v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \
                -v RET_ON_FAIL=1 \
                -v MESSAGE='Using rte_panic/rte_exit' \
                -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk \
-               "$1"
+               "$1" || ret=1
        # svg figures must be included with wildcard extension
        # because of png conversion for pdf docs
        awk -v FOLDERS='doc' \
@@ -59,7 +60,9 @@ check_forbidden_additions() { # <patch>
                -v RET_ON_FAIL=1 \
                -v MESSAGE='Using explicit .svg extension instead of .*' \
                -f $(dirname $(readlink -e $0))/check-forbidden-tokens.awk \
-               "$1"
+               "$1" || ret=1
+
+       return $ret
 }

 number=0


No need for all those checks on $? and the output saving.


-- 
David Marchand


More information about the dev mailing list