DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org, thomas@monjalon.net
Cc: nhorman@tuxdriver.com, adrien.mazarguil@6wind.com,
	stephen@networkplumber.org
Subject: [dpdk-dev] [PATCH v2 05/10] buildtools: detect discrepancies for experimental symbols
Date: Sat, 29 Jun 2019 13:58:48 +0200	[thread overview]
Message-ID: <1561809533-6545-6-git-send-email-david.marchand@redhat.com> (raw)
In-Reply-To: <1561809533-6545-1-git-send-email-david.marchand@redhat.com>

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 <david.marchand@redhat.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
---
 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 <david.marchand@redhat.com>
+
+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


  parent reply	other threads:[~2019-06-29 12:00 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27 11:33 [dpdk-dev] [PATCH 0/9] experimental tags fixes David Marchand
2019-06-27 11:33 ` [dpdk-dev] [PATCH 1/9] eal: hide internal hotplug symbol David Marchand
2019-06-28 16:25   ` Stephen Hemminger
2019-06-27 11:33 ` [dpdk-dev] [PATCH 2/9] devargs: remove incorrect experimental tags David Marchand
2019-06-28 16:23   ` Stephen Hemminger
2019-06-27 11:33 ` [dpdk-dev] [PATCH 3/9] vfio: remove incorrect experimental tag David Marchand
2019-06-28 16:24   ` Stephen Hemminger
2019-06-27 11:33 ` [dpdk-dev] [PATCH 4/9] raw/dpaa2_qdma: " David Marchand
2019-06-27 11:33 ` [dpdk-dev] [PATCH 5/9] buildtools: detect discrepancies for experimental symbols David Marchand
2019-06-27 11:33 ` [dpdk-dev] [PATCH 6/9] net/atlantic: add missing experimental api tags David Marchand
2019-06-27 11:33 ` [dpdk-dev] [PATCH 7/9] mem: remove incorrect experimental tag on static symbol David Marchand
2019-06-27 11:33 ` [dpdk-dev] [PATCH 8/9] remove experimental tags from all symbol definitions David Marchand
2019-06-28 15:56   ` Thomas Monjalon
2019-06-28 19:20     ` David Marchand
2019-06-29  5:57       ` David Marchand
2019-06-29  6:19         ` David Marchand
2019-07-01  9:57           ` Laatz, Kevin
2019-06-27 11:33 ` [dpdk-dev] [PATCH 9/9] enforce __rte_experimental at the start of symbol declarations David Marchand
2019-06-27 12:23   ` Adrien Mazarguil
2019-06-27 12:38     ` Gaëtan Rivet
2019-06-28 13:38       ` Thomas Monjalon
2019-06-28 19:58 ` [dpdk-dev] [PATCH 0/9] experimental tags fixes Neil Horman
2019-06-29 11:58 ` [dpdk-dev] [PATCH v2 00/10] " David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 01/10] eal: hide internal hotplug symbol David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 02/10] devargs: remove incorrect experimental tags David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 03/10] vfio: remove incorrect experimental tag David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 04/10] raw/dpaa2_qdma: " David Marchand
2019-06-29 11:58   ` David Marchand [this message]
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 06/10] net/atlantic: add missing experimental api tags David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 07/10] mem: remove incorrect experimental tag on static symbol David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 08/10] telemetry: add missing header include David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 09/10] remove experimental tags from all symbol definitions David Marchand
2019-06-29 11:58   ` [dpdk-dev] [PATCH v2 10/10] enforce __rte_experimental at the start of symbol declarations David Marchand
2019-06-29 16:13     ` Thomas Monjalon
2019-06-29 16:39       ` David Marchand
2019-07-01 12:05         ` Aaron Conole
2019-07-01 12:08           ` David Marchand
2019-06-29 17:06   ` [dpdk-dev] [PATCH v2 00/10] experimental tags fixes Thomas Monjalon
2019-07-01 14:15     ` Ferruh Yigit
2019-07-01 14:36       ` David Marchand
2019-07-01 15:30         ` Ferruh Yigit
2019-07-01 19:27           ` David Marchand
2019-07-01 21:12             ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561809533-6545-6-git-send-email-david.marchand@redhat.com \
    --to=david.marchand@redhat.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.org \
    --cc=nhorman@tuxdriver.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).