Skip to content

Commit

Permalink
Fix symbol checking test when compiled with debug symbols (#1474)
Browse files Browse the repository at this point in the history
* 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 <jrivero@osrfoundation.org>

* Update test/integration/all_symbols_have_version.bash.in

Co-authored-by: Steve Peters <scpeters@openrobotics.org>
Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>

---------

Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>
Co-authored-by: Steve Peters <scpeters@openrobotics.org>
(cherry picked from commit 904706c)
  • Loading branch information
j-rivero authored and mergify[bot] committed Aug 27, 2024
1 parent ba1bf8f commit e26c523
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/integration/all_symbols_have_version.bash.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 <length, id> 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
Expand All @@ -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 ]
Expand Down

0 comments on commit e26c523

Please sign in to comment.