From 8c30304c32d3dab18e36cfe8bfde09da42021071 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Tue, 22 Nov 2022 20:08:56 +0100 Subject: [PATCH] fix test_loads_binary_with_core_without_crashing on debian10 (#1389) * fix test_loads_binary_with_core_without_crashing on debian10 * fix test_loads_binary_without_crashing * fix lint --- tests/gdb-tests/tests/test_loads.py | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tests/gdb-tests/tests/test_loads.py b/tests/gdb-tests/tests/test_loads.py index 669b35d90..980e50880 100644 --- a/tests/gdb-tests/tests/test_loads.py +++ b/tests/gdb-tests/tests/test_loads.py @@ -26,13 +26,12 @@ def test_loads_binary_without_crashing(): compile_binary(BINARY_SOURCE, BINARY) output = run_gdb_with_script(binary=BINARY).splitlines() - expected = [ - "Reading symbols from %s..." % BINARY, - "(No debugging symbols found in %s)" % BINARY, - ] - expected += HELLO - - assert all(item in output for item in expected) + for h in HELLO: + assert h in output + assert any("Reading symbols from %s..." % BINARY in line for line in output) + # Old GDB says f"(no debugging symbols found)" + # New GDB says f"(No debugging symbols found in ${BINARY})" + assert any("(no debugging symbols found" in line.lower() for line in output) def test_loads_binary_with_core_without_crashing(): @@ -44,14 +43,13 @@ def test_loads_binary_with_core_without_crashing(): assert os.path.isfile(CORE) output = run_gdb_with_script(binary=BINARY, core=CORE).splitlines() - expected = [ - "Reading symbols from %s..." % BINARY, - "(No debugging symbols found in %s)" % BINARY, - "Program terminated with signal SIGFPE, Arithmetic exception.", - ] - expected += HELLO - - assert all(item in output for item in expected) + assert any("Reading symbols from %s..." % BINARY in line for line in output) + # Old GDB says f"(no debugging symbols found)" + # New GDB says f"(No debugging symbols found in ${BINARY})" + assert any("(no debugging symbols found" in line.lower() for line in output) + assert "Program terminated with signal SIGFPE, Arithmetic exception." in output + for h in HELLO: + assert h in output lwp_line = re.compile(r"^\[New LWP \d+\]$") assert any([lwp_line.match(line) for line in output])