wayland/egl/wayland-egl-symbols-check
Daniel Stone 3de11b8d79 wayland-egl: Make symbol test fail on failure
The previous rewrite of the wayland-egl ABI checker introduced checks
for removed symbols as well as added symbols, but broke some failure
conditions. Add an explict return-code variable set in failure paths,
rather than chaining or conditions.

If we cannot find the binary or nm, we regard this as an error
condition, rather than test failure.

v2: Don't test if we can execute $NM.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reported-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Fixes: 21b1f22eb0 ("wayland-egl: enhance the symbol test")
Cc: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
2018-03-19 11:44:28 -05:00

59 lines
1.1 KiB
Bash
Executable file

#!/bin/sh
set -eu
RET=0
LIB=${WAYLAND_EGL_LIB}
if ! test -f "$LIB"; then
echo "Test binary \"$LIB\" does not exist"
exit 99
fi
if ! test -n "$NM"; then
echo "nm environment variable not set"
exit 99
fi
AVAIL_FUNCS="$($NM -D --format=bsd --defined-only $LIB | awk '{print $3}')"
# Platform specific symbols.
PLAT_FUNCS="__bss_start
_edata
_end
_fini
_init
"
# Official ABI, taken from the header.
REQ_FUNCS="wl_egl_window_resize
wl_egl_window_create
wl_egl_window_destroy
wl_egl_window_get_attached_size
"
NEW_ABI=$(echo "$AVAIL_FUNCS" | while read func; do
echo "$REQ_FUNCS" | grep -q "^$func$" && continue
echo "$PLAT_FUNCS" | grep -q "^$func$" && continue
echo $func
done)
if test -n "$NEW_ABI"; then
echo "New ABI detected - If intentional, update the test."
echo "$NEW_ABI"
RET=1
fi
REMOVED_ABI=$(echo "$REQ_FUNCS" | while read func; do
echo "$AVAIL_FUNCS" | grep -q "^$func$" && continue
echo $func
done)
if test -n "$REMOVED_ABI"; then
echo "ABI break detected - Required symbol(s) no longer exported!"
echo "$REMOVED_ABI"
RET=1
fi
exit $RET