From 7267c16affd3d1c80aeeed6cf6273f863e4c2416 Mon Sep 17 00:00:00 2001 From: sw Date: Thu, 2 Apr 2026 20:00:25 +1100 Subject: [PATCH] tests: add test to check for no stb_conflict --- meson.build | 10 ++++++ .../makefile | 0 .../one.s | 0 tests/STB_GLOBAL_NOCONFLICT/tester.py | 35 +++++++++++++++++++ .../two.s | 0 5 files changed, 45 insertions(+) rename tests/{STB_GLOBAL_PASS => STB_GLOBAL_NOCONFLICT}/makefile (100%) rename tests/{STB_GLOBAL_PASS => STB_GLOBAL_NOCONFLICT}/one.s (100%) create mode 100755 tests/STB_GLOBAL_NOCONFLICT/tester.py rename tests/{STB_GLOBAL_PASS => STB_GLOBAL_NOCONFLICT}/two.s (100%) diff --git a/meson.build b/meson.build index 2a7fd30..1bb3fe7 100644 --- a/meson.build +++ b/meson.build @@ -28,3 +28,13 @@ test( depends: [bin], workdir: meson.project_source_root() / 'tests/STB_GLOBAL_CONFLICT' ) + +test( + 'stb_global_noconflict', + find_program('python3'), + args : [ + files('tests/STB_GLOBAL_NOCONFLICT/tester.py'), bin + ], + depends: [bin], + workdir: meson.project_source_root() / 'tests/STB_GLOBAL_NOCONFLICT' +) diff --git a/tests/STB_GLOBAL_PASS/makefile b/tests/STB_GLOBAL_NOCONFLICT/makefile similarity index 100% rename from tests/STB_GLOBAL_PASS/makefile rename to tests/STB_GLOBAL_NOCONFLICT/makefile diff --git a/tests/STB_GLOBAL_PASS/one.s b/tests/STB_GLOBAL_NOCONFLICT/one.s similarity index 100% rename from tests/STB_GLOBAL_PASS/one.s rename to tests/STB_GLOBAL_NOCONFLICT/one.s diff --git a/tests/STB_GLOBAL_NOCONFLICT/tester.py b/tests/STB_GLOBAL_NOCONFLICT/tester.py new file mode 100755 index 0000000..fcf945f --- /dev/null +++ b/tests/STB_GLOBAL_NOCONFLICT/tester.py @@ -0,0 +1,35 @@ +#!/bin/python3 + +import subprocess +import os +import sys + +linker_bin = sys.argv[1] + +def main(): + cwd = os.path.dirname(os.path.abspath(__file__)) + + result = subprocess.run( + ["make", "all", "-C", cwd], + capture_output = True, text = True + ) + if result.returncode != 0: + print("make failed:", result.stderr) + sys.exit(1) + + # checking prom against binaries + result = subprocess.run( + [linker_bin, "one.o", "two.o"], + capture_output=True, text=True, + cwd=cwd + ) + if result.returncode != 0: + print("ERROR returned when there are no STB_GLOBAL conflicts") + print(result.stdout) + print(result.stderr) + + exit(1) + print("pass") + + +main() diff --git a/tests/STB_GLOBAL_PASS/two.s b/tests/STB_GLOBAL_NOCONFLICT/two.s similarity index 100% rename from tests/STB_GLOBAL_PASS/two.s rename to tests/STB_GLOBAL_NOCONFLICT/two.s