Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC Commits: 4c784f00 by Cheng Shao at 2026-01-22T14:53:19-05:00 Fix testsuite run for +ipe flavour transformer This patch makes the +ipe flavour transformer pass the entire testsuite: - An RTS debug option `-DI` is added, the IPE trace information is now only printed with `-DI`. The test cases that do require IPE trace are now run with `-DI`. - The testsuite config option `ghc_with_ipe` is added, enabled when running the testsuite with `+ipe`, which skips a few tests that are sensitive to eventlog output, allocation patterns etc that can fail under `+ipe`. This is the first step towards #26799. Co-authored-by: Codex <codex@openai.com> - - - - - 12 changed files: - docs/users_guide/runtime_control.rst - hadrian/src/Flavour.hs - libraries/ghc-compact/tests/all.T - libraries/ghc-internal/tests/backtraces/all.T - rts/RtsFlags.c - rts/Trace.c - rts/include/rts/Flags.h - testsuite/driver/testglobals.py - testsuite/driver/testlib.py - testsuite/tests/rts/Makefile - testsuite/tests/rts/all.T - testsuite/tests/rts/ipe/all.T Changes: ===================================== docs/users_guide/runtime_control.rst ===================================== @@ -1588,6 +1588,7 @@ recommended for everyday use! .. rts-flag:: -Ds DEBUG: scheduler .. rts-flag:: -Di DEBUG: interpreter +.. rts-flag:: -DI DEBUG: IPE .. rts-flag:: -Dw DEBUG: weak .. rts-flag:: -DG DEBUG: gccafs .. rts-flag:: -Dg DEBUG: gc ===================================== hadrian/src/Flavour.hs ===================================== @@ -384,9 +384,15 @@ omitPragmas = addArgs -- | Build stage2 dependencies with options to enable IPE debugging -- information. enableIPE :: Flavour -> Flavour -enableIPE = addArgs - $ notStage0 ? builder (Ghc CompileHs) - ? pure ["-finfo-table-map", "-fdistinct-constructor-tables"] +enableIPE = + addArgs $ + mconcat + [ notStage0 + ? builder (Ghc CompileHs) + ? pure + ["-finfo-table-map", "-fdistinct-constructor-tables"], + builder Testsuite ? arg "--config=ghc_with_ipe=True" + ] enableLateCCS :: Flavour -> Flavour enableLateCCS = addArgs ===================================== libraries/ghc-compact/tests/all.T ===================================== @@ -20,7 +20,8 @@ test('compact_gc', [fragile_for(17253, ['ghci']), ignore_stdout], compile_and_ru # this test computes closure sizes and those are affected # by the ghci and prof ways, because of BCOs and profiling headers. # Optimization levels slightly change what is/isn't shared so only run in normal mode -test('compact_share', only_ways(['normal']), compile_and_run, ['']) +test('compact_share', [only_ways(['normal']), when(ghc_with_ipe(), skip)], # IPE changes allocation/layout affecting compactSize output. + compile_and_run, ['']) test('compact_bench', [ ignore_stdout, extra_run_opts('100') ], compile_and_run, ['']) test('T17044', normal, compile_and_run, ['']) ===================================== libraries/ghc-internal/tests/backtraces/all.T ===================================== @@ -2,5 +2,5 @@ test('T14532a', [], compile_and_run, ['']) test('T14532b', [], compile_and_run, ['']) test('T26507', [ when(have_profiling(), extra_ways(['prof'])) , when(js_arch(), skip) - , exit_code(1)], compile_and_run, ['']) - + , when(ghc_with_ipe(), skip) # IPE builds include an IPE backtrace section on stderr. + , exit_code(1)], compile_and_run, ['']) ===================================== rts/RtsFlags.c ===================================== @@ -209,6 +209,8 @@ void initRtsFlagsDefaults(void) RtsFlags.DebugFlags.numa = false; RtsFlags.DebugFlags.compact = false; RtsFlags.DebugFlags.continuation = false; + RtsFlags.DebugFlags.iomanager = false; + RtsFlags.DebugFlags.ipe = false; #if defined(PROFILING) RtsFlags.CcFlags.doCostCentres = COST_CENTRES_NONE; @@ -482,6 +484,7 @@ usage_text[] = { #if defined(DEBUG) " -Ds DEBUG: scheduler", " -Di DEBUG: interpreter", +" -DI DEBUG: IPE", " -Dw DEBUG: weak", " -DG DEBUG: gccafs", " -Dg DEBUG: gc", @@ -2311,6 +2314,9 @@ static void read_debug_flags(const char* arg) case 'o': RtsFlags.DebugFlags.iomanager = true; break; + case 'I': + RtsFlags.DebugFlags.ipe = true; + break; default: bad_option( arg ); } ===================================== rts/Trace.c ===================================== @@ -685,7 +685,8 @@ void traceHeapProfSampleString(const char *label, StgWord residency) void traceIPE(const InfoProvEnt *ipe) { #if defined(DEBUG) - if (RtsFlags.TraceFlags.tracing == TRACE_STDERR) { + if (RtsFlags.TraceFlags.tracing == TRACE_STDERR + && RtsFlags.DebugFlags.ipe) { ACQUIRE_LOCK(&trace_utx); char closure_desc_buf[CLOSURE_DESC_BUFFER_SIZE] = {}; ===================================== rts/include/rts/Flags.h ===================================== @@ -118,6 +118,7 @@ typedef struct _DEBUG_FLAGS { bool compact; /* 'C' */ bool continuation; /* 'k' */ bool iomanager; /* 'o' */ + bool ipe; /* 'I' */ } DEBUG_FLAGS; /* See Note [Synchronization of flags and base APIs] */ ===================================== testsuite/driver/testglobals.py ===================================== @@ -72,6 +72,10 @@ class TestConfig: # Was the compiler compiled with -debug? self.debug_rts = False + # Were the compiler + libraries built with IPE-related options + # (e.g. -finfo-table-map, -fdistinct-constructor-tables)? + self.ghc_with_ipe = False + # Was the compiler compiled with LLVM? self.ghc_built_by_llvm = False ===================================== testsuite/driver/testlib.py ===================================== @@ -1074,6 +1074,9 @@ def have_profiling( ) -> bool: def have_threaded( ) -> bool: return config.ghc_with_threaded_rts +def ghc_with_ipe( ) -> bool: + return config.ghc_with_ipe + def in_tree_compiler( ) -> bool: return config.in_tree_compiler ===================================== testsuite/tests/rts/Makefile ===================================== @@ -140,7 +140,7 @@ T20199: .PHONY: EventlogOutput_IPE EventlogOutput_IPE: "$(TEST_HC)" $(TEST_HC_OPTS) -debug -finfo-table-map -v0 EventlogOutput.hs - ./EventlogOutput +RTS -va 2> EventlogOutput_IPE.stderr.log + ./EventlogOutput +RTS -va -DI 2> EventlogOutput_IPE.stderr.log grep "IPE:" EventlogOutput_IPE.stderr.log .PHONY: T23142 ===================================== testsuite/tests/rts/all.T ===================================== @@ -535,6 +535,7 @@ test('T13676', test('InitEventLogging', [ only_ways(['normal']) , extra_run_opts('+RTS -RTS') + , when(ghc_with_ipe(), skip) # IPE builds can change eventlog writer call counts. , req_c ], compile_and_run, ['InitEventLogging_c.c']) @@ -588,6 +589,7 @@ test('cloneThreadStack', [req_c, only_ways(['threaded1']), extra_ways(['threaded test('decodeMyStack', [ omit_ghci, js_broken(22261) # cloneMyStack# not yet implemented + , when(ghc_with_ipe(), skip) # IPE builds can change decoded stack output. ], compile_and_run, ['-finfo-table-map']) # Options: @@ -595,6 +597,7 @@ test('decodeMyStack', test('decodeMyStack_underflowFrames', [ extra_run_opts('+RTS -kc8K -RTS') , omit_ghci, js_broken(22261) # cloneMyStack# not yet implemented + , when(ghc_with_ipe(), skip) # IPE builds can change decoded stack layout/length. ], compile_and_run, ['-finfo-table-map -rtsopts']) # -finfo-table-map intentionally missing @@ -602,6 +605,7 @@ test('decodeMyStack_emptyListForMissingFlag', [ ignore_stdout , ignore_stderr , js_broken(22261) # cloneMyStack# not yet implemented + , when(ghc_with_ipe(), skip) # IPE builds can populate IPE info even without -finfo-table-map on this module. ], compile_and_run, ['']) # Tests RTS flag parsing. Skipped on JS as it uses a distinct RTS. @@ -646,7 +650,7 @@ test('T25280', [unless(opsys('linux'),skip),req_process,js_skip], compile_and_ru test('T25560', [req_c_rts, ignore_stderr], compile_and_run, ['']) test('TestProddableBlockSet', [req_c_rts], multimod_compile_and_run, ['TestProddableBlockSet.c', '-no-hs-main']) -test('T22859', +test('T22859', [js_skip, # This test is vulnerable to changes in allocation behaviour, so we disable it in some ways when(arch('wasm32'), skip), ===================================== testsuite/tests/rts/ipe/all.T ===================================== @@ -8,7 +8,7 @@ test('ipeMap', [extra_files(['ipe_lib.c', 'ipe_lib.h']), c_src, omit_ghci], comp test('ipeEventLog', [ c_src, extra_files(['ipe_lib.c', 'ipe_lib.h']), - extra_run_opts('+RTS -va -RTS'), + extra_run_opts('+RTS -va -DI -RTS'), grep_errmsg('table_name_'), only_ways(debug_ways), normalise_errmsg_fun(noCapabilityOutputFilter), @@ -24,7 +24,7 @@ test('ipeEventLog', test('ipeEventLog_fromMap', [ c_src, extra_files(['ipe_lib.c', 'ipe_lib.h']), - extra_run_opts('+RTS -va -RTS'), + extra_run_opts('+RTS -va -DI -RTS'), grep_errmsg('table_name_'), only_ways(debug_ways), normalise_errmsg_fun(noCapabilityOutputFilter), @@ -34,4 +34,3 @@ test('ipeEventLog_fromMap', when(opsys('darwin'), fragile(0)) ], compile_and_run, ['ipe_lib.c']) - View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c784f00a47871cdda7f6fd49728a8cf... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/4c784f00a47871cdda7f6fd49728a8cf... You're receiving this email because of your account on gitlab.haskell.org.