Skip to content

Commit

Permalink
tests: add test to ensure we don't enable gdb in a release build
Browse files Browse the repository at this point in the history
While the gdb feature can be optionally enabled, we want to ensure that
in the future it is not enabled by mistake in a release build.

Signed-off-by: Pablo Barbáchano <[email protected]>
  • Loading branch information
pb8o committed Oct 21, 2024
1 parent 1881187 commit d03d45f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/integration_tests/functional/test_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,22 @@ def test_release_debuginfo(microvm_factory):
}
missing_sections = needed_sections - matches
assert missing_sections == set()


def test_release_no_gdb(microvm_factory):
"""Ensure the gdb feature is not enabled in releases"""
fc_binary = microvm_factory.fc_binary_path
# We use C++ demangle since there's no Rust support, but it's good enough
# for our purposes.
stdout = subprocess.check_output(
["readelf", "-W", "--demangle", "-s", str(fc_binary)],
encoding="ascii",
)
gdb_symbols = []
for line in stdout.splitlines():
parts = line.split(maxsplit=7)
if len(parts) == 8:
symbol_name = parts[-1]
if "gdb" in symbol_name:
gdb_symbols.append(symbol_name)
assert not gdb_symbols

0 comments on commit d03d45f

Please sign in to comment.