scripts/image-fixes/20-BlockClosureTest.stBlockClosureTest>>testOnForkErrorTakesLessThanOneSecond, BlockClosureTest>>testOnForkSplitBoth tests called skip unconditionally ('too brittle on CI'). The code under test (on:fork:) works correctly on both VMs in 0-14 ms. The fix removes the skip and keeps all assertions and the flag text unchanged.
| Test | Defect in | State | Cause |
|---|---|---|---|
BlockClosureTest>>testOnForkErrorTakesLessThanOneSecond |
test | repaired | Unconditional skip left in the test method; on:fork: works and signals the semaphore in about 13 ms. |
BlockClosureTest>>testOnForkSplit |
test | repaired | Unconditional skip left in the test method; the forked and the caller context chains share no context on either VM. |
Regression check: Whole BlockClosureTest class run on both VMs. Ours without fix: 29 PASS, 2 SKIP; with fix: 31 PASS. Cog without fix: 29 PASS, 2 SKIP; with fix: 31 PASS. No other non-test method was changed, so no other class needs a run. I did not run the 3-run repeat for the whole class, only for the two repaired tests.
Upstream note: Title: BlockClosureTest: re-enable testOnForkErrorTakesLessThanOneSecond and testOnForkSplit. Project: pharo. Description: both tests call skip unconditionally because they were "too brittle on CI". They pass reliably (3 of 3 runs on stock Cog v12.0.6 arm64 and on a second VM, 0-14 ms each against a 1 s timeout). The patch removes the skip call. This is a measurement on headless macOS only; CI flakiness on Windows or Linux was not tested. Needs the owner's review before any upstream submission.
Last full sweeps of 2026-11-17: iospharo (sweep14-new14) and stock Cog with the Cog changes (sweepcogp14-new10), with all image fixes. "Before" is the state of the test before the repairs. The Stock Cog column has a value only where the record measured stock Cog: "PASS 3 of 3 (repair run)" is the check of each repair on stock Cog v12.0.6 with the fix entry; "-" is not measured separately.
| Test | Before | State | iospharo VM | Patched Cog | Stock Cog |
|---|---|---|---|---|---|
BlockClosureTest>>testOnForkErrorTakesLessThanOneSecond | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
BlockClosureTest>>testOnForkSplit | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
Run the tests in a Pharo 14 image (build 791). Before the fix they skip, fail or carry the expected-failure mark.
"Run in a Playground of a Pharo 14 image (Do it and print each line)." ((BlockClosureTest selector: #testOnForkErrorTakesLessThanOneSecond) run) printString. ((BlockClosureTest selector: #testOnForkSplit) run) printString.
testOnForkErrorTakesLessThanOneSecond "Test that if code runs with error, there is fork" | sema timeout | self flag: 'This test is too brittle, failing often on Windows CI'; skip. self flag: 'The following line makes the test pass under headless linux. Everywhere else this test works'. OSPlatform current isUnix ifTrue: [ (Delay forMilliseconds: 1) wait ]. sema := Semaphore new. [ 1 / 0 ] on: Exception fork: [ sema signal ]. timeout := sema waitTimeoutSeconds: 1. self assert: timeout identicalTo: false
testOnForkSplit "Test that when forking, the stack are split correctly (there is no any contexts referenced by both processes)" | sema timeout forkedContexts myContexts c | self flag: 'This test is too brittle, failing often on CI'; skip. sema := Semaphore new. [ 1/0 ] on: Exception fork: [ | ctx | forkedContexts := IdentitySet new. ctx := thisContext. [ ctx isNotNil ] whileTrue: [ forkedContexts add: ctx. ctx := ctx sender ]. sema signal ]. timeout := (sema waitTimeoutSeconds: 1). self assert: timeout == false description: 'fork lasted more than one second'. myContexts := IdentitySet new. c := thisContext. [ c isNotNil ] whileTrue: [ myContexts add: c. c := c sender ]. self assert: (myContexts noneSatisfy: [:b | forkedContexts includes: b ]) description: 'myContexts are not within forkedContexts'. self assert: (forkedContexts noneSatisfy: [:b | myContexts includes: b ]) description: 'forkedContexts are not within myContexts'
How to apply an entries file: file in 00-header.st and the entries file as one chunk (the iospharo script scripts/gen-image-fixes.py makes that chunk). Each entry checks for the defect first and prints FIXED, ADDED or SKIP. Download 00-header.st.
"BlockClosureTest: the two on:fork: tests skip themselves ('too brittle on CI').
Remove the skip; keep every assertion."
fix value: #BlockClosureTest value: #testOnForkErrorTakesLessThanOneSecond
value: [ :source | source includesSubstring: 'skip' ]
value:
'testOnForkErrorTakesLessThanOneSecond
"Test that if code runs with error, there is fork"
| sema timeout |
self flag: ''The following line makes the test pass under headless linux. Everywhere else this test works''.
OSPlatform current isUnix ifTrue: [ (Delay forMilliseconds: 1) wait ].
sema := Semaphore new.
[ 1 / 0 ] on: Exception fork: [ sema signal ].
timeout := sema waitTimeoutSeconds: 1.
self assert: timeout identicalTo: false'.
fix value: #BlockClosureTest value: #testOnForkSplit
value: [ :source | source includesSubstring: 'skip' ]
value:
'testOnForkSplit
"Test that when forking, the stack are split correctly (there is no any contexts referenced by both processes)"
| sema timeout forkedContexts myContexts c |
sema := Semaphore new.
[ 1/0 ] on: Exception fork: [ | ctx |
forkedContexts := IdentitySet new.
ctx := thisContext.
[ ctx isNotNil ] whileTrue: [ forkedContexts add: ctx. ctx := ctx sender ].
sema signal ].
timeout := (sema waitTimeoutSeconds: 1).
self assert: timeout == false description: ''fork lasted more than one second''.
myContexts := IdentitySet new.
c := thisContext.
[ c isNotNil ] whileTrue: [ myContexts add: c. c := c sender ].
self assert: (myContexts noneSatisfy: [:b | forkedContexts includes: b ]) description: ''myContexts are not within forkedContexts''.
self assert: (forkedContexts noneSatisfy: [:b | myContexts includes: b ]) description: ''forkedContexts are not within myContexts'''.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.