devtools: add acronyms in dictionary for commit checks
[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 find_orphan_windows_symbols ()
39 {
40     for def in $(find lib drivers -name '*_exports.def') ; do
41         map=$(dirname $def)/version.map
42         for sym in $(grep -v ^EXPORTS $def); do
43             grep -q $sym $map || echo $sym
44         done
45     done
46 }
47
48 orphan_windows_symbols=$(find_orphan_windows_symbols)
49 if [ -n "$orphan_windows_symbols" ] ; then
50     echo "Found only in Windows export file:"
51     echo "$orphan_windows_symbols" | sed 's,^,\t,'
52     ret=1
53 fi
54
55 exit $ret