Pharo test defects

Package: OSSubprocess (pharo-contributions/OSSubprocess, row 115)

State
Fixed (package repair)
Defect in
see the record
Tests
0
Fix
pharo-contributions-ossubprocess.st
Upstream repository
pharo-contributions/OSSubprocess

The record is the text of the repair. The Results table is the last run of the row.

Record

Test

Load the package into a Pharo 14 image (build 791) with the load expression of the test run, file in the fixes file of the row if there is one, and run the test classes of the package.

"row 115"
Metacello new baseline: 'OSSubprocess'; repository: 'github://pharo-contributions/OSSubprocess:master/repository'; onConflict: [:e | e useIncoming]; load: #('Core' 'Tests').

Results

Last result of the package run (stock Cog and iospharo on the same image).

RowLabelLoadStock Cogiospharo VM
115pharo-contributions-ossubprocessoktests=126 P=126 F=0 E=0 S=0 T=0 X=0tests=126 P=126 F=0 E=0 S=0 T=0 X=0

Fix

Fixes file (filed in after the load): pharo-contributions-ossubprocess.st (download)
"pharo-contributions/OSSubprocess (master): causes of the 26 errors, one entry group each.

1. OldFileStream class>>forceNewFileNamed: (and OldStandardFileStream, OldMultiByteFileStream)
 of the package send SessionManager default currentSession isReadOnlyAccessMode.
 Pharo 14 WorkingSession has no such method (the read-only session mode was removed),
 so each file-based subprocess that redirects a stream (temp file for stdout, stderr or
 stdin) raises MessageNotUnderstood: 18 tests, and the two testStopWaiting tests of the
 file-based class, where the error happens in the forked process (TestFailedByForkedProcess).
 The entry adds WorkingSession>>isReadOnlyAccessMode answering false: a Pharo 14 image
 session is never read-only.

2. OSSUnixSubprocessTest>>withNonAsciiDirectoryDo: sends UUIDGenerator next.
 Pharo 14 UUIDGenerator has no class-side next; the supported API is UUID new.
 4 tests (two methods, two test classes).  The entry uses UUID new asString.

3. testSigTerm and testSigTermInsideLoop send Smalltalk image changesName.
 Pharo 14 SmalltalkImage has no changesName (PharoFilesOpener>>changesName answers only
 the base name).  The error is inside the forked block for testSigTerm
 (TestFailedByForkedProcess) and in the test body for testSigTermInsideLoop.  The entry
 uses FileLocator changes fullName, the full path of the changes file, so tail -f finds
 the file whatever the working directory is.

Each entry has a guard that is true only for the old text, so a second file-in changes nothing."

add value: #WorkingSession value: #isReadOnlyAccessMode value: 'testing'
	value:
'isReadOnlyAccessMode
	"The package OSSubprocess (OldFileStream) asks the session whether files may be written.
	A Pharo 14 session is never read-only."

	^ false'.

fix value: #OSSUnixSubprocessTest value: #withNonAsciiDirectoryDo:
	value: [ :source | source includesSubstring: 'UUIDGenerator next asString' ]
	value: ((Smalltalk globals at: #OSSUnixSubprocessTest ifAbsent: [ nil ])
		ifNil: [ '' ]
		ifNotNil: [ :cls | (cls includesSelector: #withNonAsciiDirectoryDo:)
			ifTrue: [ (cls >> #withNonAsciiDirectoryDo:) sourceCode copyReplaceAll: 'UUIDGenerator next asString' with: 'UUID new asString' ]
			ifFalse: [ '' ] ]).
fix value: #OSSUnixSubprocessTest value: #testSigTerm
	value: [ :source | source includesSubstring: 'Smalltalk image changesName' ]
	value: ((Smalltalk globals at: #OSSUnixSubprocessTest ifAbsent: [ nil ])
		ifNil: [ '' ]
		ifNotNil: [ :cls | (cls includesSelector: #testSigTerm)
			ifTrue: [ (cls >> #testSigTerm) sourceCode copyReplaceAll: 'Smalltalk image changesName' with: 'FileLocator changes fullName' ]
			ifFalse: [ '' ] ]).
fix value: #OSSUnixSubprocessTest value: #testSigTermInsideLoop
	value: [ :source | source includesSubstring: 'Smalltalk image changesName' ]
	value: ((Smalltalk globals at: #OSSUnixSubprocessTest ifAbsent: [ nil ])
		ifNil: [ '' ]
		ifNotNil: [ :cls | (cls includesSelector: #testSigTermInsideLoop)
			ifTrue: [ (cls >> #testSigTermInsideLoop) sourceCode copyReplaceAll: 'Smalltalk image changesName' with: 'FileLocator changes fullName' ]
			ifFalse: [ '' ] ]).
fix value: #OSSFileBasedUnixSubprocessTest value: #testSigTerm
	value: [ :source | source includesSubstring: 'Smalltalk image changesName' ]
	value: ((Smalltalk globals at: #OSSFileBasedUnixSubprocessTest ifAbsent: [ nil ])
		ifNil: [ '' ]
		ifNotNil: [ :cls | (cls includesSelector: #testSigTerm)
			ifTrue: [ (cls >> #testSigTerm) sourceCode copyReplaceAll: 'Smalltalk image changesName' with: 'FileLocator changes fullName' ]
			ifFalse: [ '' ] ]).

State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.