Debian Codegraph @

egl/wayland-egl-symbols-check

raw
1 #!/bin/sh
2 set -eu
3
4 RET=0
5 LIB=${WAYLAND_EGL_LIB}
6
7 if ! test -f "$LIB"; then
8 echo "Test binary \"$LIB\" does not exist"
9 exit 99
10 fi
11
12 if ! test -n "$NM"; then
13 echo "nm environment variable not set"
14 exit 99
15 fi
16
17 AVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')"
18
19 # Official ABI, taken from the header.
20 REQ_FUNCS="wl_egl_window_resize
21 wl_egl_window_create
22 wl_egl_window_destroy
23 wl_egl_window_get_attached_size
24 "
25
26 NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do
27 echo "$func" | grep -q "^_" && continue
28 echo "$REQ_FUNCS" | grep -q "^$func$" && continue
29
30 echo $func
31 done)
32
33 if test -n "$NEW_ABI"; then
34 echo "New ABI detected - If intentional, update the test."
35 echo "$NEW_ABI"
36 RET=1
37 fi
38
39 REMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do
40 echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue
41
42 echo $func
43 done)
44
45 if test -n "$REMOVED_ABI"; then
46 echo "ABI break detected - Required symbol(s) no longer exported!"
47 echo "$REMOVED_ABI"
48 RET=1
49 fi
50
51 exit $RET