diff --git a/tools/test_linux_port.py b/tools/test_linux_port.py index 6ccdacd6..4793a0b2 100644 --- a/tools/test_linux_port.py +++ b/tools/test_linux_port.py @@ -314,7 +314,10 @@ def test_p2p_signatures_and_listings(tmp_path): pytest.skip("needs clang, ninja and a configured build") command = subprocess.run(["ninja", "-t", "commands", "build/linux/obj/port/linux/src/p2p_crypto.o"], capture_output=True, text=True, check=True).stdout.strip().splitlines()[-1] - words = shlex.split(command)[1:] + words = shlex.split(command) + # (the compiler, and whatever runs it, ccache in CI: up to the first flag) + while words and not words[0].startswith("-"): + words = words[1:] flags = [] skip = False for word in words: @@ -327,10 +330,12 @@ def test_p2p_signatures_and_listings(tmp_path): else: flags.append(word) program = tmp_path / "p2p_lobby_check" - subprocess.run(["clang", *flags, "-O1", "-no-pie", "-Wl,--unresolved-symbols=ignore-all", "-o", str(program), - "tools/p2p_lobby_check.c", "port/linux/src/p2p_crypto.c", "port/linux/src/p2p_lobby.c", - "port/third_party/monocypher/monocypher.c", "port/third_party/monocypher/monocypher-ed25519.c"], - check=True, capture_output=True) + built = subprocess.run(["clang", *flags, "-O1", "-no-pie", "-Wl,--unresolved-symbols=ignore-all", "-o", + str(program), "tools/p2p_lobby_check.c", "port/linux/src/p2p_crypto.c", + "port/linux/src/p2p_lobby.c", "port/third_party/monocypher/monocypher.c", + "port/third_party/monocypher/monocypher-ed25519.c"], + capture_output=True, text=True) + assert built.returncode == 0, built.stderr[-4000:] result = subprocess.run([str(program)], capture_output=True, text=True, timeout=60) assert result.returncode == 0, result.stdout assert "PASS" in result.stdout