scripts/image-fixes/20-StDebugger-skips.stStDebuggerContextPredicateTest>>testPrintDescription, StDebuggerContextPredicateTest>>testPrintPostMortemDescription, StDebuggerClientModelTest>>testComputeInitialTopContext, StDebuggerTest>>testGenerateAndProceed, StDebuggerTest>>testSaveReceiverRawInspectionSelection, StDebuggerTest>>testSaveReceiverRawInspectionSelectionAfterContextChange, StDebuggerTest>>testRestoreReceiverRawInspectionSelection, StDebuggerTest>>testRestoreReceiverRawInspectionSelectionAfterContextChange, StDebuggerTest>>testReturnEnteredValueAll 9 StDebugger skips are now real passing tests on both VMs. No VM defect was found. Defects: 2 obsolete expectations ('0' in the StDebuggerContextPredicate printDescription tests); 1 skip with no remaining reason (testComputeInitialTopContext); testGenerateAndProceed (test harness re-ran the test: the debugger session wraps a context whose sender chain is the test's own chain, so resuming it re-executes the test; plus CR vs LF in expected sources and an obsolete 'see:' expectation; the test also never checked the recompiled method, now it does); 5 empty DBG_TEST placeholders (now real tests of StDebuggerInspector save/restoreRawInspectionSelectionForContext: and StDebugger>>returnEnteredValue). All repairs are in the tests only; no image code under test was changed. Side findings not fixed: (a) StDebuggerInspector>>restoreRawInspectionSelectionForContext: has 'path ifEmpty: [ self rawInspectionSelectionCache at: receiverClass ifAbsent: [ #() ] ]' whose result is discarded, so the receiver-class-only fallback never takes effect (probable upstream bug; not changed because it alters debugger behaviour); (b) selecting the outer-temp nodes 2-4 of the session fixture in the raw inspector fails with SubscriptOutOfBounds when the home method context of StTestDebuggerProvider>>sessionForDebuggerTests is widowed (sp=0), which happens on both VMs from the second call of that method in an image on Cog (first call keeps sp=3), so the new tests select only paths 1 and 5.
| Test | Defect in | State | Cause |
|---|---|---|---|
StDebuggerContextPredicateTest>>testPrintDescription |
test | repaired | Skipped and expected '0'; StDebuggerContextPredicate>>printDescription answers the post-mortem prefix plus 'context printString' (source read in the image). Expectation changed to context printString. |
StDebuggerContextPredicateTest>>testPrintPostMortemDescription |
test | repaired | Same obsolete '0'; printPostMortemDescriptionOn: writes '[Post-mortem] ' then printDescription adds context printString. Expectation changed accordingly. |
StDebuggerClientModelTest>>testComputeInitialTopContext |
test | repaired | Skipped with the remark that it makes production CI fail. With the skip removed and the body unchanged it passes on both VMs. |
StDebuggerTest>>testGenerateAndProceed |
test | repaired | Resuming the DebugSession resumes the sender chain of the test itself in a new process, so the rest of the test runs a second time (measured: DNU #application: on StTestDebuggerProvider, then tearDown DNU). Debugger context is now created in a forked process. Also expected sources used LF while image method sources use CR, and the expected generated code was the obsolete 'see: ... equals: 111' instead of the 'assert: ... equals: 111' that StGenerateAssertEqualsCode>>generatedCodeFromDebugger: writes. The test now also asserts the recompiled method source, which it computed but never used. |
StDebuggerTest>>testSaveReceiverRawInspectionSelection |
test | repaired | Empty placeholder (self skip. self flag: #DBG_TEST). Now selects path #(1) in the raw inspector, calls saveRawInspectionSelectionForContext: and asserts both cache keys (class->selector and class) hold #(1). |
StDebuggerTest>>testSaveReceiverRawInspectionSelectionAfterContextChange |
test | repaired | Empty placeholder. Now steps once, selects path #(5), steps into another context and asserts the old context's selection was saved in the cache. Paths 2-4 avoided because they read temps of the returned (widowed) home context of the fixture method. |
StDebuggerTest>>testRestoreReceiverRawInspectionSelection |
test | repaired | Empty placeholder. Now puts #(5) in the cache for the context's receiver class->selector, calls restoreRawInspectionSelectionForContext: and asserts the raw inspector selected path is #(5). |
StDebuggerTest>>testRestoreReceiverRawInspectionSelectionAfterContextChange |
test | repaired | Empty placeholder. Now selects #(5) in the first context, steps into another context (selection no longer #(5)), selects the first stack item again and asserts #(5) is restored. |
StDebuggerTest>>testReturnEnteredValue |
test | repaired | Empty placeholder. StDebugger>>returnEnteredValue opens a modal request dialog, so the test gives the debugger an anonymous StPharoApplication subclass whose newRequest answers a stub request: first nil (user cancels: interruptedContext unchanged, the case the DBG_HowToTestNilIfUserCancels flag asks for), then '0' (the squared context is popped, interruptedContext is its sender and its top is 0). |
Regression check: Only test methods were changed (no non-test method), so the covering classes are the owner classes plus all 20 StDebugger*/StGenerate*Test classes (StDebuggerAssertionContextTest, ClientModelAnnouncementTest, ClientModelTest, CommandTest, CommandTreeBuilderTest, ContextInteractionModelTest, ContextPredicateTest, ContextTest, ExceptionExtensionsTest, ExtensionMechanismTest, InspectorTest, MNUExtensionTest, RawObjectInspectorTest, ToolCommandTreeBuilderTest, TreeTablePresenterTest, StDebuggerTest, and the four *CommandTreeBuilderTest classes). Totals of PASS over these classes, without fix vs with fix: ours VM 284 -> 294 (non-pass 10 -> 0); Cog (arm64 pharo-vm via runtest.sh cog) 285 -> 294 (non-pass 9 -> 0; the 9 are the 9 skips, the old 10th on ours/9th... base Cog also had testUpdateExtensionSubscription fail once in an earlier run, not in this run). No test that passed before failed after. Repeat runs: the 6 StDebuggerTest tests ran together 4 times on each VM, all pass; the 3 other tests ran 3 times on each VM, all pass. Earlier intermediate runs with an earlier version of the tests (selecting paths 2/3) failed intermittently with SubscriptOutOfBounds on both VMs; that version is replaced.
Upstream note: Pharo NewTools (StDebugger tests): un-skip the StDebugger tests. (1) StDebuggerContextPredicateTest: expect context printString (with the '[Post-mortem] ' prefix), not '0'. (2) StDebuggerClientModelTest>>testComputeInitialTopContext: remove skip, passes. (3) StDebuggerTest>>testGenerateAndProceed: create the generated-code debugger in its own process (resuming the session otherwise re-runs the test method), compare sources modulo line ends, expect 'assert: ... equals: 111' and assert the recompiled method. (4) Replace the five #DBG_TEST placeholders with tests of StDebuggerInspector>>save/restoreRawInspectionSelectionForContext: and StDebugger>>returnEnteredValue (using a stub application whose newRequest answers the expression). Possible upstream bug noticed, not changed here: StDebuggerInspector>>restoreRawInspectionSelectionForContext: discards the result of 'path ifEmpty: [ cache at: receiverClass ifAbsent: [ #() ] ]'. These changes need review by the owner before any PR.
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 |
|---|---|---|---|---|---|
StDebuggerClientModelTest>>testComputeInitialTopContext | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerContextPredicateTest>>testPrintDescription | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerContextPredicateTest>>testPrintPostMortemDescription | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testGenerateAndProceed | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testRestoreReceiverRawInspectionSelection | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testRestoreReceiverRawInspectionSelectionAfterContextChange | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testReturnEnteredValue | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testSaveReceiverRawInspectionSelection | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
StDebuggerTest>>testSaveReceiverRawInspectionSelectionAfterContextChange | 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)." ((StDebuggerClientModelTest selector: #testComputeInitialTopContext) run) printString. ((StDebuggerContextPredicateTest selector: #testPrintDescription) run) printString. ((StDebuggerContextPredicateTest selector: #testPrintPostMortemDescription) run) printString. ((StDebuggerTest selector: #testGenerateAndProceed) run) printString. ((StDebuggerTest selector: #testRestoreReceiverRawInspectionSelection) run) printString. ((StDebuggerTest selector: #testRestoreReceiverRawInspectionSelectionAfterContextChange) run) printString. ((StDebuggerTest selector: #testReturnEnteredValue) run) printString. ((StDebuggerTest selector: #testSaveReceiverRawInspectionSelection) run) printString. ((StDebuggerTest selector: #testSaveReceiverRawInspectionSelectionAfterContextChange) run) printString.
testComputeInitialTopContext | newSession dummyActionModel | self flag: 'We suspect this test to make the production CI fail so we skip it for now'. self skip. dummyActionModel := StTestDebuggerProvider new debuggerWithMissingSubclassResponsibilityContext debuggerClientModel. self changeSession: dummyActionModel session. dummyActionModel clear. self assert: debugActionModel topContext identicalTo: session exception signalContext. dummyActionModel := StTestDebuggerProvider new debuggerWithMissingSubclassResponsibilityContext debuggerClientModel. newSession := dummyActionModel session. dummyActionModel clear. newSession restart: newSession interruptedContext sender. self changeSession: newSession. self assert: debugActionModel topContext identicalTo: session interruptedContext
testPrintDescription self skip. self assert: predicate printDescription equals: '0'
testPrintPostMortemDescription self skip. predicate postMortem: true. self assert: predicate printDescription equals: '[Post-mortem] 0'
testGenerateAndProceed | baseSourceCode expectedSourceCode adapter | self skip: 'Does not work, I do not know why it looks like my test is executed several times with the same debugger'. baseSourceCode := 'methodThatGeneratesCode | asserter | asserter := TestAsserter new. asserter see: 42 + 66 + 3'. expectedSourceCode := 'methodThatGeneratesCode | asserter | asserter := TestAsserter new. asserter see: 42 + 66 + 3 equals: 111'. debugger := StTestDebuggerProvider new debuggerWithGeneratingCodeContext application: self debuggerClass currentApplication; initialize; yourself. "just things necessary to use debugger's code presenter, which we need in this test" adapter := SpMorphicCodeAdapter new. adapter adapt: debugger code. debugger code adapter: adapter. debugger code adapter buildWidget. self assert: debugger canGenerateAndProceed. self assert: debugger exception isGeneratingCode. self assert: debugger interruptedContext sender sourceCode equals: baseSourceCode. oldMethodToSourceDictionary at: debugger interruptedContext sender method put: baseSourceCode. debugger saveGeneratedCodeAndProceed "self assert: debugger interruptedContext isNil"
testRestoreReceiverRawInspectionSelection self skip. self flag: #DBG_TEST
testRestoreReceiverRawInspectionSelectionAfterContextChange self skip. self flag: #DBG_TEST
testReturnEnteredValue self skip. self flag: #DBG_TEST
testSaveReceiverRawInspectionSelection self skip. self flag: #DBG_TEST
testSaveReceiverRawInspectionSelectionAfterContextChange self skip. self flag: #DBG_TEST
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.
"StDebuggerContextPredicateTest>>testPrintDescription and testPrintPostMortemDescription skipped themselves and expected '0'. StDebuggerContextPredicate>>printDescription answers the post-mortem prefix (from printPostMortemDescriptionOn:) followed by 'context printString'. The '0' is a leftover from an older printDescription that printed a number. The tests now expect what printDescription is written to answer." fix value: #StDebuggerContextPredicateTest value: #testPrintDescription value: [ :source | source includesSubstring: 'self skip' ] value: 'testPrintDescription self assert: predicate printDescription equals: context printString'. fix value: #StDebuggerContextPredicateTest value: #testPrintPostMortemDescription value: [ :source | source includesSubstring: 'self skip' ] value: 'testPrintPostMortemDescription predicate postMortem: true. self assert: predicate printDescription equals: ''[Post-mortem] '' , context printString'. "StDebuggerClientModelTest>>testComputeInitialTopContext was skipped with the remark that it makes the production CI fail. It passes on both VMs; skip removed." fix value: #StDebuggerClientModelTest value: #testComputeInitialTopContext value: [ :source | source includesSubstring: 'self skip' ] value: 'testComputeInitialTopContext | newSession dummyActionModel | dummyActionModel := StTestDebuggerProvider new debuggerWithMissingSubclassResponsibilityContext debuggerClientModel. self changeSession: dummyActionModel session. dummyActionModel clear. self assert: debugActionModel topContext identicalTo: session exception signalContext. dummyActionModel := StTestDebuggerProvider new debuggerWithMissingSubclassResponsibilityContext debuggerClientModel. newSession := dummyActionModel session. dummyActionModel clear. newSession restart: newSession interruptedContext sender. self changeSession: newSession. self assert: debugActionModel topContext identicalTo: session interruptedContext'. "StDebuggerTest>>testGenerateAndProceed was skipped: 'it looks like my test is executed several times with the same debugger'. That is what happens: the debugger session wraps the context that signalled StGenerateCode, and the sender chain of that context is the chain of the test itself. Proceeding the session resumes the chain in a new process, which runs the rest of the test method again (measured: the second run fails with 'StTestDebuggerProvider does not understand #application:' and tearDown fails on the replaced debugger). The test now creates the context in a process of its own. Two more repairs: the method source of the image has CR line ends and the expected sources in the test had LF, and the expected generated code is the assert:equals: send that StGenerateAssertEqualsCode>>generatedCodeFromDebugger: writes in place of see: (the old expectation 'see: ... equals: 111' was never produced). The test also asserted nothing after proceeding although it computed expectedSourceCode; it now checks the recompiled method." fix value: #StDebuggerTest value: #testGenerateAndProceed value: [ :source | source includesSubstring: 'self skip' ] value: 'testGenerateAndProceed | baseSourceCode expectedSourceCode adapter provider created createdSignal normalized | "The image keeps method sources with CR line ends; compare without that difference." normalized := [ :text | text withLineEndings: String cr ]. baseSourceCode := ''methodThatGeneratesCode | asserter | asserter := TestAsserter new. asserter see: 42 + 66 + 3''. expectedSourceCode := ''methodThatGeneratesCode | asserter | asserter := TestAsserter new. asserter assert: 42 + 66 + 3 equals: 111''. "The debugger session wraps the context that signalled StGenerateCode. Its sender chain must not be the chain of this test: proceeding the session resumes that chain in a new process, which would run the rest of this test method a second time (this is why the test used to be skipped). So the context is created in a process of its own, and this method keeps the debugger in its own variable, which the resumed chain cannot reach." provider := StTestDebuggerProvider new. createdSignal := Semaphore new. [ created := provider debuggerWithGeneratingCodeContext. createdSignal signal ] forkAt: Processor userSchedulingPriority. (createdSignal wait: 10 seconds) ifTrue: [ self fail: ''debugger was not created'' ]. debugger := created. debugger application: self debuggerClass currentApplication; initialize. "just things necessary to use debugger''s code presenter, which we need in this test" adapter := SpMorphicCodeAdapter new. adapter adapt: debugger code. debugger code adapter: adapter. debugger code adapter buildWidget. self assert: debugger canGenerateAndProceed. self assert: debugger exception isGeneratingCode. self assert: (normalized value: debugger interruptedContext sender sourceCode) equals: (normalized value: baseSourceCode). oldMethodToSourceDictionary at: debugger interruptedContext sender method put: baseSourceCode. debugger saveGeneratedCodeAndProceed. "StGenerateAssertEqualsCode>>generatedCodeFromDebugger: replaces the see: send by assert:...equals: with the value that was seen." self assert: (normalized value: (StTestDebuggerProvider >> #methodThatGeneratesCode) sourceCode) equals: (normalized value: expectedSourceCode)'. "The five StDebuggerTest tests below were empty placeholders (self skip. self flag: #DBG_TEST). They now test StDebuggerInspector>>saveRawInspectionSelectionForContext: and restoreRawInspectionSelectionForContext:, which no other test covers." fix value: #StDebuggerTest value: #testSaveReceiverRawInspectionSelection value: [ :source | source includesSubstring: 'self skip' ] value: 'testSaveReceiverRawInspectionSelection | context | "Paths 1 (self) and 5 (the temporary i of the block) can be read in the context of the session; the nodes 2 to 4 are temporaries of the method that created the session, which has returned, and a returned context cannot be read." dbg := self debuggerOn: session. context := dbg currentContext. dbg inspector getRawInspectorPresenterOrNil selectPath: #( 1 ). dbg inspector saveRawInspectionSelectionForContext: context. self assert: (dbg inspector rawInspectionSelectionCache at: context receiver class -> context selector) equals: #( 1 ). self assert: (dbg inspector rawInspectionSelectionCache at: context receiver class) equals: #( 1 )'. fix value: #StDebuggerTest value: #testSaveReceiverRawInspectionSelectionAfterContextChange value: [ :source | source includesSubstring: 'self skip' ] value: 'testSaveReceiverRawInspectionSelectionAfterContextChange | context | dbg := self debuggerOn: session. dbg stepInto. "Still in the same context, the raw inspector is updated" context := dbg currentContext. dbg inspector getRawInspectorPresenterOrNil selectPath: #( 5 ). dbg stepInto. "We enter another context: the selection of the old one is saved" self deny: dbg currentContext identicalTo: context. self assert: (dbg inspector rawInspectionSelectionCache at: context receiver class -> context selector) equals: #( 5 )'. fix value: #StDebuggerTest value: #testRestoreReceiverRawInspectionSelection value: [ :source | source includesSubstring: 'self skip' ] value: 'testRestoreReceiverRawInspectionSelection | context | dbg := self debuggerOn: session. context := dbg currentContext. self assert: dbg inspector getRawInspectorSelectedPath equals: #( ). dbg inspector rawInspectionSelectionCache at: context receiver class -> context selector put: #( 5 ). dbg inspector restoreRawInspectionSelectionForContext: context. self assert: dbg inspector getRawInspectorSelectedPath equals: #( 5 )'. fix value: #StDebuggerTest value: #testRestoreReceiverRawInspectionSelectionAfterContextChange value: [ :source | source includesSubstring: 'self skip' ] value: 'testRestoreReceiverRawInspectionSelectionAfterContextChange | firstContext | dbg := self debuggerOn: session. dbg stepInto. "Still in the same context, the raw inspector is updated" firstContext := dbg currentContext. dbg inspector getRawInspectorPresenterOrNil selectPath: #( 5 ). dbg stepInto. "We enter another context" self deny: dbg currentContext identicalTo: firstContext. self deny: dbg inspector getRawInspectorSelectedPath equals: #( 5 ). "Back to the first context: its selection is restored" dbg stackTable selectItem: dbg stackTable items last. self assert: dbg currentContext identicalTo: firstContext. self assert: dbg inspector getRawInspectorSelectedPath equals: #( 5 )'. "StDebuggerTest>>testReturnEnteredValue: StDebugger>>returnEnteredValue asks the user for an expression with a modal request dialog. The test gives the debugger an application whose request answers the expression '0' and, in a second run, nil (the user cancelled), the case that the flag DBG_HowToTestNilIfUserCancels in returnEnteredValue asks for." fix value: #StDebuggerTest value: #testReturnEnteredValue value: [ :source | source includesSubstring: 'self skip' ] value: 'testReturnEnteredValue | requestClass applicationClass application context sender | requestClass := Object newAnonymousSubclass. requestClass addInstVarNamed: ''answer''. requestClass compile: ''answer: anObject answer := anObject''. requestClass compile: ''title: aString ^ self''. requestClass compile: ''openModal ^ answer''. applicationClass := StPharoApplication newAnonymousSubclass. applicationClass addInstVarNamed: ''request''. applicationClass compile: ''request: anObject request := anObject''. applicationClass compile: ''newRequest ^ request''. application := applicationClass new. dbg := self debugger session: session; application: application; initialize; yourself. dbg stepInto; stepInto. "We enter the squared method" context := dbg interruptedContext. sender := context sender. "a returned context has no sender any more" "The user cancels the request: nothing is returned" application request: (requestClass new answer: nil; yourself). dbg returnEnteredValue. self assert: dbg interruptedContext identicalTo: context. "The user enters an expression: its value is returned to the sender" application request: (requestClass new answer: ''0''; yourself). dbg returnEnteredValue. self assert: dbg interruptedContext identicalTo: sender. self assert: dbg interruptedContext top equals: 0'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.