From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <nhorman@tuxdriver.com>
Received: from smtp.tuxdriver.com (charlotte.tuxdriver.com [70.61.120.58])
 by dpdk.org (Postfix) with ESMTP id 5C807199B0
 for <dev@dpdk.org>; Mon, 22 Jan 2018 02:48:56 +0100 (CET)
Received: from cpe-2606-a000-111b-4011-eaa3-4b92-4a68-8f24.dyn6.twc.com
 ([2606:a000:111b:4011:eaa3:4b92:4a68:8f24] helo=hmswarspite.think-freely.org)
 by smtp.tuxdriver.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63)
 (envelope-from <nhorman@tuxdriver.com>)
 id 1edRE5-000688-Fm; Sun, 21 Jan 2018 20:48:52 -0500
Received: from hmswarspite.think-freely.org (localhost [127.0.0.1])
 by hmswarspite.think-freely.org (8.15.2/8.15.2) with ESMTP id w0M1mCxl024802; 
 Sun, 21 Jan 2018 20:48:12 -0500
Received: (from nhorman@localhost)
 by hmswarspite.think-freely.org (8.15.2/8.15.2/Submit) id w0M1mC6u024801;
 Sun, 21 Jan 2018 20:48:12 -0500
From: Neil Horman <nhorman@tuxdriver.com>
To: dev@dpdk.org
Cc: Neil Horman <nhorman@tuxdriver.com>, Thomas Monjalon <thomas@monjalon.net>,
 "Mcnamara, John" <john.mcnamara@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>
Date: Sun, 21 Jan 2018 20:48:03 -0500
Message-Id: <20180122014807.24654-2-nhorman@tuxdriver.com>
X-Mailer: git-send-email 2.14.3
In-Reply-To: <20180122014807.24654-1-nhorman@tuxdriver.com>
References: <20171201185628.16261-1-nhorman@tuxdriver.com>
 <20180122014807.24654-1-nhorman@tuxdriver.com>
X-Spam-Score: -2.9 (--)
X-Spam-Status: No
Subject: [dpdk-dev] [[PATCH v5] 1/5] buildtools: Add tool to check
	EXPERIMENTAL api exports
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Jan 2018 01:48:56 -0000

This tools reads the given version map for a directory, and checks to
ensure that, for each symbol listed in the export list, the corresponding
definition is tagged as __rte_experimental, erroring out if its not.  In this
way, we can ensure that the EXPERIMENTAL api is kept in sync with the tags

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
CC: Thomas Monjalon <thomas@monjalon.net>
CC: "Mcnamara, John" <john.mcnamara@intel.com>
CC: Bruce Richardson <bruce.richardson@intel.com>
---
 MAINTAINERS                           |  1 +
 buildtools/check-experimental-syms.sh | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100755 buildtools/check-experimental-syms.sh

diff --git a/MAINTAINERS b/MAINTAINERS
index b51c2d096..446d2545d 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -77,6 +77,7 @@ M: Neil Horman <nhorman@tuxdriver.com>
 F: lib/librte_compat/
 F: doc/guides/rel_notes/deprecation.rst
 F: devtools/validate-abi.sh
+F: buildtools/check-experimental-syms.sh
 
 Driver information
 F: buildtools/pmdinfogen/
diff --git a/buildtools/check-experimental-syms.sh b/buildtools/check-experimental-syms.sh
new file mode 100755
index 000000000..7d21de35c
--- /dev/null
+++ b/buildtools/check-experimental-syms.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+# SPDX-License-Identifier: BSD-3-Clause
+
+MAPFILE=$1
+OBJFILE=$2
+
+if [ -d $MAPFILE ]
+then
+	exit 0
+fi
+
+for i in `awk 'BEGIN {found=0}
+		/.*EXPERIMENTAL.*/ {found=1}
+		/.*}.*;/ {found=0}
+		/.*;/ {if (found == 1) print $1}' $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"
+	IN_EXP=$?
+	if [ $IN_TEXT -eq 0 -a $IN_EXP -ne 0 ]
+	then
+		echo "$SYM is not flagged as experimental"
+		echo "but is listed in version map"
+		echo "Please add __rte_experimental to the definition of $SYM"
+		exit 1
+	fi
+done
+exit 0
+
-- 
2.14.3