From 68159a77525d3c78825e88c4fb256f130b7fb6fd Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 27 Aug 2024 21:32:34 +0200 Subject: [PATCH] Fix symbol checking test when compiled with debug symbols (#1474) * Fix symbol checking test The test that checks for prefixed binary symbols was broken when compiled with DebWithRelInfo since it was checking debugging symbols that broke the heuristics used. The commit fixes it doing a couple of actions: - Include the length of the namespace sdf: 3sdf - Check only dynamic symbols being exported Signed-off-by: Jose Luis Rivero * Update test/integration/all_symbols_have_version.bash.in Co-authored-by: Steve Peters Signed-off-by: Jose Luis Rivero --------- Signed-off-by: Jose Luis Rivero Co-authored-by: Steve Peters (cherry picked from commit 904706c2c02c5c333e916717e0a4ea6b3c74947e) --- test/integration/all_symbols_have_version.bash.in | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/integration/all_symbols_have_version.bash.in b/test/integration/all_symbols_have_version.bash.in index d69a58442..94912d34d 100644 --- a/test/integration/all_symbols_have_version.bash.in +++ b/test/integration/all_symbols_have_version.bash.in @@ -4,7 +4,13 @@ LIBPATH=$1 VERSIONED_NS=v@PROJECT_VERSION_MAJOR@ # Sanity check - there should be at least one symbol -NUM_SYMBOLS=$(nm $LIBPATH | grep -e "sdf" | wc -l) + +# nm options: +# -D to get only dynamic symbols exported +# 3 before the sdf is used by +# mangled symbols in C++ to check for the +# sdf namespace +NUM_SYMBOLS=$(nm -D $LIBPATH | grep -e "3sdf" | wc -l) if [ $NUM_SYMBOLS -eq 0 ] then @@ -13,7 +19,7 @@ then fi # There must be no unversioned symbols -UNVERSIONED_SYMBOLS=$(nm $LIBPATH | grep -e "sdf" | grep -e "$VERSIONED_NS" -v) +UNVERSIONED_SYMBOLS=$(nm -D $LIBPATH | grep -e "3sdf" | grep -e "$VERSIONED_NS" -v) UNVERSIONED_SYMBOL_CHARS=$(printf "$UNVERSIONED_SYMBOLS" | wc -m) if [ $UNVERSIONED_SYMBOL_CHARS -ne 0 ]