summaryrefslogtreecommitdiff
path: root/tests/integration/jt9
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
committerChristoph Berg <myon@debian.org>2026-10-09 14:12:35 +0200
commitffc62c792c9a5196cb4ce7a353287dfe20db6524 (patch)
tree1269efa852935b183daae4bb33a58d1b4d2ffb53 /tests/integration/jt9
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
New upstream version 3.3.0~beta1+dfsgupstream/3.3.0_beta1+dfsg
Diffstat (limited to 'tests/integration/jt9')
-rw-r--r--tests/integration/jt9/verify_loaded_libraries.cmake39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/integration/jt9/verify_loaded_libraries.cmake b/tests/integration/jt9/verify_loaded_libraries.cmake
new file mode 100644
index 00000000..7354fecd
--- /dev/null
+++ b/tests/integration/jt9/verify_loaded_libraries.cmake
@@ -0,0 +1,39 @@
+# Fails if EXECUTABLE loads Boost, Qt or ICU, which the release tarballs'
+# decoder programs use no symbol from: they load them only when linked
+# without --as-needed (Linux) or -dead_strip_dylibs (macOS).
+foreach (required_variable LISTER EXECUTABLE)
+ if (NOT DEFINED ${required_variable} OR "${${required_variable}}" STREQUAL "")
+ message (FATAL_ERROR "${required_variable} is required")
+ endif ()
+endforeach ()
+
+if (LISTER MATCHES "otool$")
+ set (lister_arguments -L)
+else ()
+ set (lister_arguments -dW)
+endif ()
+execute_process (
+ COMMAND "${LISTER}" ${lister_arguments} "${EXECUTABLE}"
+ RESULT_VARIABLE lister_result
+ OUTPUT_VARIABLE lister_stdout
+ ERROR_VARIABLE lister_stderr)
+if (NOT "${lister_result}" STREQUAL "0")
+ message (FATAL_ERROR
+ "${LISTER} exited with ${lister_result}\n"
+ "stdout:\n${lister_stdout}\n"
+ "stderr:\n${lister_stderr}")
+endif ()
+
+if (LISTER MATCHES "otool$")
+ # The first line names the file itself.
+ string (FIND "${lister_stdout}" "\n" first_newline)
+ string (SUBSTRING "${lister_stdout}" ${first_newline} -1 libraries)
+else ()
+ string (REGEX MATCHALL "\\(NEEDED\\)[^\n]*" libraries "${lister_stdout}")
+ string (REPLACE ";" "\n" libraries "${libraries}")
+endif ()
+string (REGEX MATCHALL "[^\n]*(boost|QtCore|Qt5Core|libicu)[^\n]*" unused "${libraries}")
+if (unused)
+ string (REPLACE ";" "\n" unused "${unused}")
+ message (FATAL_ERROR "${EXECUTABLE} loads libraries it uses no symbol from:\n${unused}")
+endif ()