[Git][ghc/ghc][wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL] testsuite: add GHC build-system regression detection tests
Sven Tennie pushed to branch wip/romes/hadrian-cross-stage2-rebase_SVEN_FINAL at Glasgow Haskell Compiler / GHC Commits: f0e5999e by Sven Tennie at 2026-06-08T10:14:59+02:00 testsuite: add GHC build-system regression detection tests Pin arch-specific GHC config values so that build-system refactors that accidentally change compiler configuration are caught by the testsuite. Two tests: - GhcInfoPins: runs ghc --info and checks 18 pinned fields - TestsuiteConfigPins: checks 12 Hadrian-supplied config.* values Both tests print a ready-to-paste entry when run on an unknown platform. Tests are Python run_command (not compiled Haskell) because wasm32/WASI targets cannot call runInteractiveProcess from compiled binaries. - - - - - 4 changed files: - + testsuite/tests/driver/config-pins/ConfigPinsExpected.py - + testsuite/tests/driver/config-pins/GhcInfoPins.py - + testsuite/tests/driver/config-pins/TestsuiteConfigPins.py - + testsuite/tests/driver/config-pins/all.T Changes: ===================================== testsuite/tests/driver/config-pins/ConfigPinsExpected.py ===================================== @@ -0,0 +1,653 @@ +# Expected GHC config values, keyed by platform key. +# +# Platform key construction: +# base = "target platform string" from ghc --info (or config.platform) +# key = base +# + ("-cross" if cross-compiling) +# + ("-unreg" if Unregisterised, +# "-no_tntc" elif Tables-next-to-code == NO) +# +# When a new platform is encountered the test prints a ready-to-paste entry. + + +def platform_key(platform, is_cross, is_unreg, no_tntc): + key = platform + if is_cross: key += "-cross" + if is_unreg: key += "-unreg" + elif no_tntc: key += "-no_tntc" + return key + +PINNED_GHC_INFO_FIELDS = [ + "target arch", + "target os", + "target platform string", + "target word size", + "target word big endian", + "Tables next to code", + "Support SMP", + "Have interpreter", + "Use interpreter", + "Have native code generator", + "Unregisterised", + "Leading underscore", + "target has RTS linker", + "target RTS linker only supports shared libraries", + "cross compiling", + "target has GNU nonexec stack", + "target has subsections via symbols", + "Target default backend", +] + +GHC_INFO_EXPECTED = { + + # ── x86_64 Linux (all distros) ─────────────────────────────────────────── + "x86_64-unknown-linux": { + "target arch": "ArchX86_64", + "target os": "OSLinux", + "target platform string": "x86_64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── x86_64 Linux unregisterised ────────────────────────────────────────── + "x86_64-unknown-linux-unreg": { + "target arch": "ArchX86_64", + "target os": "OSLinux", + "target platform string": "x86_64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "NO", + "Support SMP": "NO", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "NO", + "Unregisterised": "YES", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "compiling via C", + }, + + # ── x86_64 Linux no tables-next-to-code ────────────────────────────────── + "x86_64-unknown-linux-no_tntc": { + "target arch": "ArchX86_64", + "target os": "OSLinux", + "target platform string": "x86_64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "NO", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── aarch64 Linux native ───────────────────────────────────────────────── + "aarch64-unknown-linux": { + "target arch": "ArchAArch64", + "target os": "OSLinux", + "target platform string": "aarch64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── aarch64 Linux cross ────────────────────────────────────────────────── + "aarch64-unknown-linux-cross": { + "target arch": "ArchAarch64", + "target os": "OSLinux", + "target platform string": "aarch64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── i386 Linux ─────────────────────────────────────────────────────────── + "i386-unknown-linux": { + "target arch": "ArchX86", + "target os": "OSLinux", + "target platform string": "i386-unknown-linux", + "target word size": "4", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── aarch64 macOS ──────────────────────────────────────────────────────── + "aarch64-apple-darwin": { + "target arch": "ArchAArch64", + "target os": "OSDarwin", + "target platform string": "aarch64-apple-darwin", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "YES", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── x86_64 macOS ───────────────────────────────────────────────────────── + "x86_64-apple-darwin": { + "target arch": "ArchX86_64", + "target os": "OSDarwin", + "target platform string": "x86_64-apple-darwin", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "YES", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "YES", + "Target default backend": "native code generator", + }, + + # ── x86_64 FreeBSD ─────────────────────────────────────────────────────── + "x86_64-portbld-freebsd": { + "target arch": "ArchX86_64", + "target os": "OSFreeBSD", + "target platform string": "x86_64-portbld-freebsd", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── x86_64 Windows native ──────────────────────────────────────────────── + "x86_64-unknown-mingw32": { + "target arch": "ArchX86_64", + "target os": "OSMinGW32", + "target platform string": "x86_64-unknown-mingw32", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "NO", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── aarch64 Windows cross ──────────────────────────────────────────────── + "aarch64-unknown-mingw32-cross": { + "target arch": "ArchAarch64", + "target os": "OSMinGW32", + "target platform string": "aarch64-unknown-mingw32", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── wasm32 cross ───────────────────────────────────────────────────────── + "wasm32-unknown-wasi-cross-no_tntc": { + "target arch": "ArchWasm32", + "target os": "OSWasi", + "target platform string": "wasm32-unknown-wasi", + "target word size": "4", + "target word big endian": "NO", + "Tables next to code": "NO", + "Support SMP": "NO", + "Have interpreter": "YES", + "Use interpreter": "YES", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── wasm32 cross unregisterised ────────────────────────────────────────── + "wasm32-unknown-wasi-cross-unreg": { + "target arch": "ArchWasm32", + "target os": "OSWasi", + "target platform string": "wasm32-unknown-wasi", + "target word size": "4", + "target word big endian": "NO", + "Tables next to code": "NO", + "Support SMP": "NO", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "NO", + "Unregisterised": "YES", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "compiling via C", + }, + + # ── JavaScript cross ───────────────────────────────────────────────────── + "javascript-unknown-ghcjs-cross": { + "target arch": "ArchJavaScript", + "target os": "OSGhcjs", + "target platform string": "javascript-unknown-ghcjs", + "target word size": "4", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "NO", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "NO", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "NO", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "NO", + "target has subsections via symbols": "NO", + "Target default backend": "compiling to JavaScript", + }, + + # ── riscv64 Linux cross ────────────────────────────────────────────────── + "riscv64-unknown-linux-cross": { + "target arch": "ArchRISCV64", + "target os": "OSLinux", + "target platform string": "riscv64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "YES", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, + + # ── loongarch64 Linux cross ────────────────────────────────────────────── + "loongarch64-unknown-linux-cross": { + "target arch": "ArchLoongArch64", + "target os": "OSLinux", + "target platform string": "loongarch64-unknown-linux", + "target word size": "8", + "target word big endian": "NO", + "Tables next to code": "YES", + "Support SMP": "YES", + "Have interpreter": "NO", + "Use interpreter": "NO", + "Have native code generator": "YES", + "Unregisterised": "NO", + "Leading underscore": "NO", + "target has RTS linker": "NO", + "target RTS linker only supports shared libraries": "NO", + "cross compiling": "YES", + "target has GNU nonexec stack": "YES", + "target has subsections via symbols": "NO", + "Target default backend": "native code generator", + }, +} + +TESTSUITE_CONFIG_EXPECTED = { + + # ── x86_64 Linux ───────────────────────────────────────────────────────── + "x86_64-unknown-linux": { + "platform": "x86_64-unknown-linux", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── x86_64 Linux unregisterised ────────────────────────────────────────── + "x86_64-unknown-linux-unreg": { + "platform": "x86_64-unknown-linux", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": False, + "have_interp": True, + "unregisterised": True, + "tables_next_to_code": False, + "leading_underscore": False, + "target_has_smp": False, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── x86_64 Linux no tables-next-to-code ────────────────────────────────── + "x86_64-unknown-linux-no_tntc": { + "platform": "x86_64-unknown-linux", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": False, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── aarch64 Linux native ───────────────────────────────────────────────── + "aarch64-unknown-linux": { + "platform": "aarch64-unknown-linux", + "arch": "aarch64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── aarch64 Linux cross ────────────────────────────────────────────────── + "aarch64-unknown-linux-cross": { + "platform": "aarch64-unknown-linux", + "arch": "aarch64", + "wordsize": "64", + "have_ncg": True, + "have_interp": False, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": True, + }, + + # ── i386 Linux ─────────────────────────────────────────────────────────── + "i386-unknown-linux": { + "platform": "i386-unknown-linux", + "arch": "i386", + "wordsize": "32", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── aarch64 macOS ──────────────────────────────────────────────────────── + "aarch64-apple-darwin": { + "platform": "aarch64-apple-darwin", + "arch": "aarch64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": True, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── x86_64 macOS ───────────────────────────────────────────────────────── + "x86_64-apple-darwin": { + "platform": "x86_64-apple-darwin", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": True, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── x86_64 FreeBSD ─────────────────────────────────────────────────────── + "x86_64-portbld-freebsd": { + "platform": "x86_64-portbld-freebsd", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── x86_64 Windows native ──────────────────────────────────────────────── + "x86_64-unknown-mingw32": { + "platform": "x86_64-unknown-mingw32", + "arch": "x86_64", + "wordsize": "64", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": False, + }, + + # ── aarch64 Windows cross ──────────────────────────────────────────────── + "aarch64-unknown-mingw32-cross": { + "platform": "aarch64-unknown-mingw32", + "arch": "aarch64", + "wordsize": "64", + "have_ncg": True, + "have_interp": False, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": True, + }, + + # ── wasm32 cross ───────────────────────────────────────────────────────── + "wasm32-unknown-wasi-cross-no_tntc": { + "platform": "wasm32-unknown-wasi", + "arch": "wasm32", + "wordsize": "32", + "have_ncg": True, + "have_interp": True, + "unregisterised": False, + "tables_next_to_code": False, + "leading_underscore": False, + "target_has_smp": False, + "have_RTS_linker": True, + "interp_force_dyn": True, + "cross": True, + }, + + # ── wasm32 cross unregisterised ────────────────────────────────────────── + "wasm32-unknown-wasi-cross-unreg": { + "platform": "wasm32-unknown-wasi", + "arch": "wasm32", + "wordsize": "32", + "have_ncg": False, + "have_interp": False, + "unregisterised": True, + "tables_next_to_code": False, + "leading_underscore": False, + "target_has_smp": False, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": True, + }, + + # ── JavaScript cross ───────────────────────────────────────────────────── + "javascript-unknown-ghcjs-cross": { + "platform": "javascript-unknown-ghcjs", + "arch": "javascript", + "wordsize": "32", + "have_ncg": False, + "have_interp": False, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": False, + "have_RTS_linker": False, + "interp_force_dyn": False, + "cross": True, + }, + + # ── riscv64 Linux cross ────────────────────────────────────────────────── + "riscv64-unknown-linux-cross": { + "platform": "riscv64-unknown-linux", + "arch": "riscv64", + "wordsize": "64", + "have_ncg": True, + "have_interp": False, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": True, + "interp_force_dyn": False, + "cross": True, + }, + + # ── loongarch64 Linux cross ────────────────────────────────────────────── + "loongarch64-unknown-linux-cross": { + "platform": "loongarch64-unknown-linux", + "arch": "loongarch64", + "wordsize": "64", + "have_ncg": True, + "have_interp": False, + "unregisterised": False, + "tables_next_to_code": True, + "leading_underscore": False, + "target_has_smp": True, + "have_RTS_linker": False, + "interp_force_dyn": False, + "cross": True, + }, +} ===================================== testsuite/tests/driver/config-pins/GhcInfoPins.py ===================================== @@ -0,0 +1,70 @@ +#!/usr/bin/env python3 +"""Check that ghc --info output matches pinned expected values.""" +import ast +import subprocess +import sys + +sys.path.insert(0, '.') +from ConfigPinsExpected import GHC_INFO_EXPECTED, PINNED_GHC_INFO_FIELDS, platform_key + + +def info_platform_key(info_map): + return platform_key( + info_map.get("target platform string", "<unknown>"), + info_map.get("cross compiling", "NO") == "YES", + info_map.get("Unregisterised", "NO") == "YES", + info_map.get("Tables next to code", "YES") == "NO", + ) + + +def main(): + if len(sys.argv) != 2: + print("Usage: GhcInfoPins.py <compiler-path>") + sys.exit(1) + + compiler = sys.argv[1] + try: + result = subprocess.run([compiler, "--info"], capture_output=True, text=True) + except OSError as e: + print(f"Failed to run {compiler!r} --info: {e}") + sys.exit(1) + if result.returncode != 0: + print(f"Error running {compiler!r} --info:\n{result.stderr}") + sys.exit(1) + try: + info_map = dict(ast.literal_eval(result.stdout.strip())) + except (ValueError, SyntaxError) as e: + print(f"Failed to parse {compiler!r} --info output: {e}") + sys.exit(1) + key = info_platform_key(info_map) + + actual = {f: info_map.get(f, "<missing>") for f in PINNED_GHC_INFO_FIELDS} + + if key not in GHC_INFO_EXPECTED: + print(f"Platform key {key!r} not in ConfigPinsExpected.") + print("Add this entry to GHC_INFO_EXPECTED in ConfigPinsExpected.py:") + print() + print(f" {key!r}: {{") + for f, v in actual.items(): + print(f" {f!r}: {v!r},") + print(" },") + sys.exit(1) + + expected = GHC_INFO_EXPECTED[key] + mismatches = [ + (f, ev, actual.get(f, "<missing>")) + for f, ev in sorted(expected.items()) + if ev != actual.get(f, "<missing>") + ] + + if mismatches: + print(f"MISMATCH for {key!r}:") + for f, ev, av in mismatches: + print(f" {f!r}: expected {ev!r}, got {av!r}") + sys.exit(1) + + print(f"OK: {key}") + + +if __name__ == "__main__": + main() ===================================== testsuite/tests/driver/config-pins/TestsuiteConfigPins.py ===================================== @@ -0,0 +1,65 @@ +#!/usr/bin/env python3 +"""Check that Hadrian-supplied testsuite config values match pinned expected values.""" +import sys + +sys.path.insert(0, '.') +from ConfigPinsExpected import TESTSUITE_CONFIG_EXPECTED, platform_key + + +def main(): + if len(sys.argv) != 13: + print("Usage: TestsuiteConfigPins.py platform arch wordsize " + "have_ncg have_interp unreg tntc leading_us has_smp " + "rts_linker interp_dyn cross") + print(f"Got {len(sys.argv) - 1} args: {sys.argv[1:]}") + sys.exit(1) + + (platform, arch, wordsize, + have_ncg, have_interp, unreg, tntc, + lead_us, has_smp, rts_linker, interp_dyn, cross) = sys.argv[1:] + + b = lambda s: s == "1" + actual = { + "platform": platform, + "arch": arch, + "wordsize": wordsize, + "have_ncg": b(have_ncg), + "have_interp": b(have_interp), + "unregisterised": b(unreg), + "tables_next_to_code": b(tntc), + "leading_underscore": b(lead_us), + "target_has_smp": b(has_smp), + "have_RTS_linker": b(rts_linker), + "interp_force_dyn": b(interp_dyn), + "cross": b(cross), + } + key = platform_key(platform, b(cross), b(unreg), not b(tntc)) + + if key not in TESTSUITE_CONFIG_EXPECTED: + print(f"Platform key {key!r} not in ConfigPinsExpected.") + print("Add this entry to TESTSUITE_CONFIG_EXPECTED in ConfigPinsExpected.py:") + print() + print(f" {key!r}: {{") + for k, v in actual.items(): + print(f" {k!r}: {v!r},") + print(" },") + sys.exit(1) + + expected = TESTSUITE_CONFIG_EXPECTED[key] + mismatches = [ + (k, ev, actual[k]) + for k, ev in expected.items() + if ev != actual.get(k) + ] + + if mismatches: + print(f"MISMATCH for {key!r}:") + for k, ev, av in mismatches: + print(f" {k!r}: expected {ev!r}, got {av!r}") + sys.exit(1) + + print(f"OK: {key}") + + +if __name__ == "__main__": + main() ===================================== testsuite/tests/driver/config-pins/all.T ===================================== @@ -0,0 +1,30 @@ +import sys + +# Python run_command rather than compiled Haskell: wasm32/WASI targets cannot +# call runInteractiveProcess from compiled binaries (no process creation in +# WASI). Python scripts run on the host regardless of the target under test. + +test('GhcInfoPins', + [extra_files(['ConfigPinsExpected.py', 'GhcInfoPins.py']), + ignore_stdout], + run_command, + [sys.executable + ' GhcInfoPins.py "' + config.compiler + '"']) + +test('TestsuiteConfigPins', + [extra_files(['ConfigPinsExpected.py', 'TestsuiteConfigPins.py']), + ignore_stdout], + run_command, + [sys.executable + ' TestsuiteConfigPins.py ' + ' '.join([ + config.platform, + config.arch, + config.wordsize, + str(int(config.have_ncg)), + str(int(config.have_interp)), + str(int(config.unregisterised)), + str(int(config.tables_next_to_code)), + str(int(config.leading_underscore)), + str(int(config.target_has_smp)), + str(int(config.have_RTS_linker)), + str(int(config.interp_force_dyn)), + str(int(config.cross)), + ])]) View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f0e5999e4d808f57dec2655cb4476c98... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/f0e5999e4d808f57dec2655cb4476c98... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
Sven Tennie (@supersven)