[v5,1/2] devtools: add check on symbol maps format
Checks
Commit Message
Add a check on symbol maps format.
This will be required by a next commit.
Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v4:
- rebased,
- handled next abi version in the check,
Changes since v3:
- fixed Alpine build (same issue with { in awk expression than commit
e1ab26df4862 ("buildtools: fix build with busybox")),
Changes since v2:
- fixed FreeBSD build by replacing (|pattern) with (pattern)?,
Changes since v1:
- moved this check in a separate patch,
- fixed ethdev map file,
---
devtools/check-symbol-maps.sh | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
@@ -74,4 +74,27 @@ if [ -n "$empty_maps" ] ; then
ret=1
fi
+find_bad_format_maps ()
+{
+ abi_version=$(cut -d'.' -f 1 ABI_VERSION)
+ next_abi_version=$((abi_version + 1))
+ for map in $@ ; do
+ cat $map | awk '
+ /^(DPDK_('$abi_version'|'$next_abi_version')|EXPERIMENTAL|INTERNAL) \{$/ { next; } # start of a section
+ /^}( DPDK_'$abi_version')?;$/ { next; } # end of a section
+ /^$/ { next; } # empty line
+ /^\t(global:|local: \*;)$/ { next; } # qualifiers
+ /^\t[a-zA-Z_0-9]*;( # WINDOWS_NO_EXPORT)?$/ { next; } # symbols
+ /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+ { print $0; }' || echo $map
+ done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+ echo "Found badly formatted maps:"
+ echo "$bad_format_maps"
+ ret=1
+fi
+
exit $ret