From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A3844A046B for ; Thu, 27 Jun 2019 13:35:05 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 4B8DA44C3; Thu, 27 Jun 2019 13:34:37 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id F266D4C93 for ; Thu, 27 Jun 2019 13:34:32 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F3FB87620; Thu, 27 Jun 2019 11:34:30 +0000 (UTC) Received: from dmarchan.remote.csb (ovpn-204-76.brq.redhat.com [10.40.204.76]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D6761974B; Thu, 27 Jun 2019 11:34:28 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: nhorman@tuxdriver.com, aconole@redhat.com, thomas@monjalon.net Date: Thu, 27 Jun 2019 13:33:51 +0200 Message-Id: <1561635235-22238-6-git-send-email-david.marchand@redhat.com> In-Reply-To: <1561635235-22238-1-git-send-email-david.marchand@redhat.com> References: <1561635235-22238-1-git-send-email-david.marchand@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 27 Jun 2019 11:34:32 +0000 (UTC) Subject: [dpdk-dev] [PATCH 5/9] buildtools: detect discrepancies for experimental symbols X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" When promoting those symbols as stable, there is no check to ensure that the final result is consistent. Add a little script to get the symbols per section from the library map files. Validate that all experimental symbols in object files are referenced by library map files. Signed-off-by: David Marchand --- buildtools/check-experimental-syms.sh | 29 +++++++++++---- buildtools/map-list-symbol.sh | 70 +++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+), 7 deletions(-) create mode 100755 buildtools/map-list-symbol.sh diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-experimental-syms.sh index 7d1f3a5..653756e 100755 --- a/buildtools/check-experimental-syms.sh +++ b/buildtools/check-experimental-syms.sh @@ -5,6 +5,8 @@ MAPFILE=$1 OBJFILE=$2 +LIST_SYMBOL=$RTE_SDK/buildtools/map-list-symbol.sh + # added check for "make -C test/" usage if [ ! -e $MAPFILE ] || [ ! -f $OBJFILE ] then @@ -16,12 +18,9 @@ then exit 0 fi -for i in `awk 'BEGIN {found=0} - /.*EXPERIMENTAL.*/ {found=1} - /.*}.*;/ {found=0} - /.*;/ {if (found == 1) print $1}' $MAPFILE` +ret=0 +for SYM in `$LIST_SYMBOL -S EXPERIMENTAL $MAPFILE` do - SYM=`echo $i | sed -e"s/;//"` objdump -t $OBJFILE | grep -q "\.text.*$SYM$" IN_TEXT=$? objdump -t $OBJFILE | grep -q "\.text\.experimental.*$SYM$" @@ -33,8 +32,24 @@ do but is listed in version map Please add __rte_experimental to the definition of $SYM END_OF_MESSAGE - exit 1 + ret=1 fi done -exit 0 +for SYM in `objdump -t $OBJFILE |awk '{ + if ($2 != "l" && $4 == ".text.experimental") { + print $NF + } +}'` +do + $LIST_SYMBOL -S EXPERIMENTAL -s $SYM -q $MAPFILE || { + cat >&2 <<- END_OF_MESSAGE + $SYM is flagged as experimental + but is not listed in version map + Please add $SYM to the version map + END_OF_MESSAGE + ret=1 + } +done + +exit $ret diff --git a/buildtools/map-list-symbol.sh b/buildtools/map-list-symbol.sh new file mode 100755 index 0000000..5509b4a --- /dev/null +++ b/buildtools/map-list-symbol.sh @@ -0,0 +1,70 @@ +#!/bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 David Marchand + +section=all +symbol=all +quiet= + +while getopts 'S:s:q' name; do + case $name in + S) + [ $section = 'all' ] || { + echo 'Cannot list in multiple sections' + exit 1 + } + section=$OPTARG + ;; + s) + [ $symbol = 'all' ] || { + echo 'Cannot list multiple symbols' + exit 1 + } + symbol=$OPTARG + ;; + q) + quiet='y' + ;; + ?) + echo 'usage: $0 [-S section] [-s symbol] [-q]' + exit 1 + ;; + esac +done + +shift $(($OPTIND - 1)) + +for file in $@; do + cat "$file" |awk ' + BEGIN { + current_section = ""; + if ("'$section'" == "all" && "'$symbol'" == "all") { + ret = 0; + } else { + ret = 1; + } + } + /^.*{/ { + if ("'$section'" == "all" || $1 == "'$section'") { + current_section = $1; + } + } + /.*}/ { current_section = ""; } + /^[^}].*[^:*];/ { + if (current_section != "") { + gsub(";",""); + if ("'$symbol'" == "all" || $1 == "'$symbol'") { + ret = 0; + if ("'$quiet'" == "") { + print "'$file' "current_section" "$1; + } + if ("'$symbol'" != "all") { + exit 0; + } + } + } + } + END { + exit ret; + }' +done -- 1.8.3.1