diff --git a/tests/gdb-tests/tests/test_command_libcinfo.py b/tests/gdb-tests/tests/test_command_libcinfo.py new file mode 100644 index 000000000..42ad57128 --- /dev/null +++ b/tests/gdb-tests/tests/test_command_libcinfo.py @@ -0,0 +1,27 @@ +from __future__ import annotations + +import gdb + +import tests + +REFERENCE_BINARY = tests.binaries.get("reference-binary.out") + + +def test_command_libcinfo(start_binary): + """ + Tests the libcinfo command + """ + start_binary(REFERENCE_BINARY) + + result = gdb.execute("libcinfo", to_string=True) + assert result == "Could not determine libc version.\n" + + # Continue until main, so the libc is actually loaded + gdb.execute("break main") + gdb.execute("continue") + + result = gdb.execute("libcinfo", to_string=True).splitlines() + assert len(result) == 2 + assert result[0].startswith("libc version: ") + assert result[1].startswith("libc source link: https://ftp.gnu.org/gnu/libc/glibc-") + assert result[1].endswith(".tar.gz")