Skip to content

Commit d03d45f

Browse files
committed
tests: add test to ensure we don't enable gdb in a release build
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]>
1 parent 1881187 commit d03d45f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

tests/integration_tests/functional/test_binary.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,22 @@ def test_release_debuginfo(microvm_factory):
4646
}
4747
missing_sections = needed_sections - matches
4848
assert missing_sections == set()
49+
50+
51+
def test_release_no_gdb(microvm_factory):
52+
"""Ensure the gdb feature is not enabled in releases"""
53+
fc_binary = microvm_factory.fc_binary_path
54+
# We use C++ demangle since there's no Rust support, but it's good enough
55+
# for our purposes.
56+
stdout = subprocess.check_output(
57+
["readelf", "-W", "--demangle", "-s", str(fc_binary)],
58+
encoding="ascii",
59+
)
60+
gdb_symbols = []
61+
for line in stdout.splitlines():
62+
parts = line.split(maxsplit=7)
63+
if len(parts) == 8:
64+
symbol_name = parts[-1]
65+
if "gdb" in symbol_name:
66+
gdb_symbols.append(symbol_name)
67+
assert not gdb_symbols

0 commit comments

Comments
 (0)