wayland-egl-symbols-check 1000 B

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