scripts/image-fixes/20-network-tests.stNetNameResolver class>>localHostAddress, NetNameResolverTest>>testLocalHostAddress, ZnHTTPSTest>>testSNIPage, ZnHTTPSTest>>testGetPharoVersion, ZnClientTest>>testQueryGoogleNetwork works from the shell and from both VMs (DNS, HTTP, HTTPS through ZdcSecureSocketStream with the SSL plugin present), so no Apple network prompt blocked these runs. Four causes. (1) testLocalHostAddress was skipped as broken. The real defect is NetNameResolver class>>localHostAddress: stock Cog primitive (SocketPluginImpl.c sqResolverLocalAddress) looks only at interfaces eth0 and wlan0 so it answers 0.0.0.0 on macOS, and our VM primitiveResolverLocalAddress is a stub that always answers 127.0.0.1. The image method then answered loopback on a connected machine, which the test denies. Fix: when the primitive gives 0.0.0.0 or 127.x, use the address the host name resolves to (10.3.0.128 here), fall back to loopback; the skip is removed. (2) testSNIPage: the commented-out body works today (www.mnot.net redirects to mnot.net, ZnClient follows), so the body is restored with the other HTTPS tests' guards. (3) testGetPharoVersion was an empty skip; it now GETs https://get.pharo.org/64/stable and checks success and that the script text mentions Pharo. (4) testQueryGoogle: www.google.com answers a non-JavaScript client with an enablejs page (no results, no pharo.org), so the test fails on every VM; same test now queries https://www.bing.com/search?q=Pharo+Smalltalk with unchanged assertions (success, text/html, contains pharo.org). Search-engine dependence is as fragile as the original.
| Test | Defect in | State | Cause |
|---|---|---|---|
NetNameResolverTest>>testLocalHostAddress |
image-code | repaired | localHostAddress trusted a primitive that answers 0.0.0.0 (Cog on macOS) or a hardcoded 127.0.0.1 (our VM); test was skipped |
ZnHTTPSTest>>testGetPharoVersion |
test | repaired | empty skip stub; replaced by a real HTTPS GET of get.pharo.org/64/stable (content comes as ByteArray, decoded with asString) |
ZnHTTPSTest>>testSNIPage |
test | repaired | skipped with comment 'no longer works'; the commented body works (redirect followed), restored with ensureSocketStreamFactory and plugin guards |
ZnClientTest>>testQueryGoogle |
test | repaired | google.com serves a JavaScript-required page to non-JS clients, no 'pharo.org' in body; same assertions now against bing.com over https |
Regression check: Ran NetNameResolverTest, ZnHTTPSTest, ZnClientTest, TCPSocketEchoTest, UDPSocketEchoTest (UUIDGeneratorTest also requested; counted as whatever exists) on both VMs, base image vs fixed image (ours JIT build, Cog arm64). Ours: base 65 pass / 1 bad / 3 skip, fixed 69 pass / 0 bad / 0 skip. Cog: base 65 pass / 1 bad / 3 skip, fixed 69 pass / 0 bad / 0 skip. No test that passed before fails. Only the Pharo 14 image was tested; the guards are written to be idempotent for Pharo 13 but not run there.
VM change: Both VMs are wrong about the local address; the image fix above hides nothing because the VM answers are still wrong and should be repaired too. (a) Our VM: src/vm/Primitives.cpp, Interpreter::primitiveResolverLocalAddress (~line 33375) always returns 127.0.0.1 instead of a real interface address; implement it like Cog with getifaddrs, returning the first non-loopback AF_INET address of an up interface. (b) Cog (for the owner to review before anything goes upstream; I made no PR): pharo-vm/plugins/SocketPlugin/src/common/SocketPluginImpl.c sqResolverLocalAddress (line ~1716) accepts only interface names eth0 and wlan0 (its own TODO says it is incomplete), so on macOS (en0) and many Linux names it returns 0, and Pharo's image comment says 'On Mac the primitive is buggy'. Proposal: drop the name test, take the first AF_INET address that is not 127.x and whose interface is IFF_UP. Reproducer: NetNameResolver primLocalAddress. Output: Cog #[0 0 0 0], ours #[127 0 0 1]; expected a LAN address such as #[10 3 0 128] on a connected machine (NetNameResolver addressForName: NetNameResolver localHostName gives 10.3.0.128 on both).
Open points: None for the four tests. Caveats: testQueryGoogle, testSNIPage and testGetPharoVersion depend on live third-party servers (bing.com, mnot.net, get.pharo.org) and will fail offline, as the original tests did. testLocalHostAddress would still fail on a connected machine whose host name resolves only to loopback. The Apple network prompt did not appear in these runs, so I made no workaround for it and did not investigate the prompt on the GUI app.
Upstream note: Pharo PR candidate (Network-Kernel, Network-Tests, Zinc tests): 'NetNameResolver class>>localHostAddress: use the host name address when the primitive gives none or loopback; un-skip NetNameResolverTest>>testLocalHostAddress; restore ZnHTTPSTest>>testSNIPage; implement ZnHTTPSTest>>testGetPharoVersion; ZnClientTest>>testQueryGoogle queries a search engine that serves non-JavaScript clients'. Zinc is an external project (svenvc/zinc) for the Zn tests. Not opened; owner reviews first.
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 |
|---|---|---|---|---|---|
NetNameResolverTest>>testLocalHostAddress | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
ZnClientTest>>testQueryGoogle | FAIL | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
ZnHTTPSTest>>testGetPharoVersion | SKIP | repaired | PASS | PASS | PASS 3 of 3 (repair run) |
ZnHTTPSTest>>testSNIPage | 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)." ((NetNameResolverTest selector: #testLocalHostAddress) run) printString. ((ZnClientTest selector: #testQueryGoogle) run) printString. ((ZnHTTPSTest selector: #testGetPharoVersion) run) printString. ((ZnHTTPSTest selector: #testSNIPage) run) printString.
testLocalHostAddress self skip. "This test is currently broken" NetNameResolver isConnected ifTrue: [self deny: self localHostAddressIsLoopBackAddress] ifFalse: [self assert: self localHostAddressIsLoopBackAddress]
testQueryGoogle | client | (client := ZnClient new) http; host: 'www.google.com'; addPath: 'search'; queryAt: 'q' put: 'Pharo Smalltalk'; get. self assert: client isSuccess. self assert: (client response contentType matches: ZnMimeType textHtml). self assert: (client contents includesSubstring: 'pharo.org'). client close
testGetPharoVersion "Make sure to overwrite on older test" self skip
testSNIPage "| client | self ensureSocketStreamFactory. self isNativeSSLPluginPresent ifFalse: [ ^ self skip ]. self doesNativeSSLPluginSupportSNI ifFalse: [ ^ self skip ]." self skip. "This does no longer work, but we have to find out why" "(client := ZnClient new) get: 'https://www.mnot.net/blog/2014/05/09/if_you_can_read_this_youre_sniing'. self assert: client isSuccess. client close"
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.
"network-tests cluster. Entries only; see tools/fix_header.st." "N1. NetNameResolver class>>localHostAddress: the primitive answers 0.0.0.0 on macOS under stock Cog (the plugin looks only at the interfaces eth0 and wlan0) and always 127.0.0.1 under our VM (the primitive is a stub). The method then answers the loopback address on a connected machine, which NetNameResolverTest>>testLocalHostAddress denies. When the primitive gives no usable address, use the address that the name of this host resolves to." fix value: #'NetNameResolver class' value: #localHostAddress value: [ :source | (source includesSubstring: 'primAddress = #[0 0 0 0] ifTrue:') ] value: 'localHostAddress "Return the local address of this host." "NetNameResolver localHostAddress" "The primitive can answer an empty address (stock Cog looks only at the interfaces eth0 and wlan0, so it answers 0.0.0.0 on macOS) or the loopback address (a VM that stubs the primitive). In both cases use the address to which the name of this host resolves. When that fails too, or is a loopback address, use the loopback address." | primAddress hostAddress | self initializeNetwork. [ primAddress := self primLocalAddress ] on: PrimitiveFailed do: [ :err | primAddress := #[0 0 0 0] ]. (primAddress = #[0 0 0 0] or: [ primAddress first = 127 ]) ifTrue: [ hostAddress := [ self addressForName: self localHostName ] on: NameLookupFailure do: [ :err | nil ]. primAddress := (hostAddress notNil and: [ hostAddress size = 4 and: [ hostAddress first ~= 127 ] ]) ifTrue: [ hostAddress asByteArray ] ifFalse: [ #[127 0 0 1] ] ]. ^ SocketAddress fromOldByteAddress: primAddress'. "N2. NetNameResolverTest>>testLocalHostAddress: skipped as broken; the cause is N1, so the skip goes." fix value: #NetNameResolverTest value: #testLocalHostAddress value: [ :source | source includesSubstring: 'self skip' ] value: 'testLocalHostAddress NetNameResolver isConnected ifTrue: [self deny: self localHostAddressIsLoopBackAddress] ifFalse: [self assert: self localHostAddressIsLoopBackAddress]'. "N3. ZnHTTPSTest>>testSNIPage: the commented-out body works today (the page redirects from www.mnot.net to mnot.net and ZnClient follows the redirect); restore the body, with the guards of the other HTTPS tests." fix value: #ZnHTTPSTest value: #testSNIPage value: [ :source | source includesSubstring: 'self skip' ] value: 'testSNIPage | client | self ensureSocketStreamFactory. self isNativeSSLPluginPresent ifFalse: [ ^ self ]. (client := ZnClient new) get: ''https://www.mnot.net/blog/2014/05/09/if_you_can_read_this_youre_sniing''. self assert: client isSuccess. client close'. "N4. ZnHTTPSTest>>testGetPharoVersion: an empty skip. Fetch the zero-conf script of the Pharo download server over HTTPS (served as bytes, so decode with asString)." fix value: #ZnHTTPSTest value: #testGetPharoVersion value: [ :source | source includesSubstring: 'self skip' ] value: 'testGetPharoVersion | client | self ensureSocketStreamFactory. self isNativeSSLPluginPresent ifFalse: [ ^ self ]. (client := ZnClient new) get: ''https://get.pharo.org/64/stable''. self assert: client isSuccess. self assert: (client contents asString includesSubstring: ''Pharo''). client close'. "N5. ZnClientTest>>testQueryGoogle: www.google.com answers a client without JavaScript with a page that asks for JavaScript, with no search result, so the assertion on 'pharo.org' fails on every VM. The test checks that a query is sent and an HTML answer comes back; use a search engine that answers without JavaScript." fix value: #ZnClientTest value: #testQueryGoogle value: [ :source | source includesSubstring: 'www.google.com' ] value: 'testQueryGoogle | client | (client := ZnClient new) https; host: ''www.bing.com''; addPath: ''search''; queryAt: ''q'' put: ''Pharo Smalltalk''; get. self assert: client isSuccess. self assert: (client response contentType matches: ZnMimeType textHtml). self assert: (client contents includesSubstring: ''pharo.org''). client close'.
State of 2026-11-20. Made from the test records of the iospharo project (a second Pharo VM). The fixes are proposals for review.