devtools: check flow API doc tables
[dpdk.git] / devtools / check-symbol-maps.sh
1 #! /bin/sh -e
2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2018 Mellanox Technologies, Ltd
4
5 cd $(dirname $0)/..
6
7 # speed up by ignoring Unicode details
8 export LC_ALL=C
9
10 ret=0
11
12 find_orphan_symbols ()
13 {
14     for map in $(find lib drivers -name '*.map') ; do
15         for sym in $(sed -rn 's,^([^}]*_.*);.*$,\1,p' $map) ; do
16             if echo $sym | grep -q '^per_lcore_' ; then
17                 symsrc=${sym#per_lcore_}
18             elif echo $sym | grep -q '^__rte_.*_trace_' ; then
19                 symsrc=${sym#__}
20             else
21                 symsrc=$sym
22             fi
23             if ! grep -q -r --exclude=$(basename $map) \
24                     -w $symsrc $(dirname $map) ; then
25                 echo "$map: $sym"
26             fi
27         done
28     done
29 }
30
31 orphan_symbols=$(find_orphan_symbols)
32 if [ -n "$orphan_symbols" ] ; then
33     echo "Found only in symbol map file:"
34     echo "$orphan_symbols" | sed 's,^,\t,'
35     ret=1
36 fi
37
38 exit $ret