From d03d45fcada2c0b0cb8fd987f05a0a65f80e03a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Sun, 20 Oct 2024 13:40:45 +0200 Subject: [PATCH 1/2] tests: add test to ensure we don't enable gdb in a release build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../functional/test_binary.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/integration_tests/functional/test_binary.py b/tests/integration_tests/functional/test_binary.py index 67181bd3edbb..dc0755d5a5a7 100644 --- a/tests/integration_tests/functional/test_binary.py +++ b/tests/integration_tests/functional/test_binary.py @@ -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 From a0f1c6f91cbc3a7e466492cb0d84e7f5ea659273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Mon, 19 Aug 2024 14:26:17 +0200 Subject: [PATCH 2/2] tests: add comment on generated MAC addresses MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Document that the 06:00 MAC prefix is just a locally defined one so it should not conflict with other devices. Also the choice seems arbitrary. Signed-off-by: Pablo Barbáchano --- tests/host_tools/network.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/host_tools/network.py b/tests/host_tools/network.py index 4aba89da6037..e876f3c4d85e 100644 --- a/tests/host_tools/network.py +++ b/tests/host_tools/network.py @@ -130,7 +130,8 @@ def mac_from_ip(ip_address): """Create a MAC address based on the provided IP. Algorithm: - - the first 2 bytes are fixed to 06:00 + - the first 2 bytes are fixed to 06:00, which is in an LAA range + - https://en.wikipedia.org/wiki/MAC_address#Ranges_of_group_and_locally_administered_addresses - the next 4 bytes are the IP address Example of function call: