Skip to content

Fix root TestRunTests: PHP_BINARY child spawn, halt CRLF, opt-in drivers - #20

Merged
ctfang merged 4 commits into
mainfrom
cursor/fix-root-suite-pipe-halt-driver-1669
Nov 8, 2026
Merged

ctfang merged 4 commits into
mainfrom
cursor/fix-root-suite-pipe-halt-driver-1669

Conversation

@ctfang

@ctfang ctfang commented Nov 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes three related failures in root TestRunTests on Windows (and the same harness behavior elsewhere).

P1 — stream_get_contents_pipe_length_test.php

Root cause: PHP_BINARY is os.Executable(), which under go test is the test binary. proc_open([PHP_BINARY, $child]) does not pass -test.run=TestPHPFixtureProcess / ORIGAMI_SUITE_SCRIPT, so the child did not run the PHP script. On Unix the parent often blocked for the full timeout; on Windows the child exited quickly with no stdout, so stream_get_contents(..., 100) returned "".

Fix: TestMain detects a direct script argument (same rules as zy / IsDirectScriptArg) and runs RunScriptFile before the test framework, so [test.binary, script.php] behaves like the CLI.

P2 — halt_compiler_uppercase_test.php

Root cause: __COMPILER_HALT_OFFSET__ was correct; the on-disk fixture can use CRLF on Windows while the assertion expected LF-only bytes.

Fix: Normalize \r\n → \n in the compared payload tail; offset and __HALT_COMPILER case coverage unchanged.

P3 — mongodb/redis driver PHP regressions

Root cause: mongodb.Load / redis.Load are opt-in; package tests call them explicitly, root TestRunTests did not.

Fix: TestPHPFixtureProcess loads the matching extension for contract/regression scripts. Redis integration scripts (redis_driver_integration_test.php, redis_phpredis_features_test.php) are skipped at the harness level when ORIGAMI_REDIS_TEST_PORT is unset (aligned with std/php/redis/loading_test.go).

Verification

  • go test -count=1 -timeout 120s -run 'TestRunTests/tests/php/(stream_get_contents_pipe_length|halt_compiler_uppercase|mongodb_bson_driver|redis_driver_contract|redis_driver_integration|redis_phpredis_features)_test\.php' . — pass / skip as expected
  • go test -count=1 -run '^Test(PHPBinaryRunsChildScript|PHPFixtureProcess_streamPipeLength|DirectScriptArgDetection)$' .
  • go test -count=1 ./std/php/redis ./std/php/mongodb ./std/php/stream ./std/php/proc
  • No Redis server in this environment; integration cases skipped cleanly

Files

  • run_tests_test.go — TestMain, suite loader, Redis integration skips
  • runtime_loader.go + zy.go — shared loadDefaultRuntime
  • php_binary_child_test.go — regression for proc_open / PHP_BINARY child behavior
  • tests/php/halt_compiler_uppercase_test.php — CRLF-safe payload compare
Open in Web Open in Cursor 

cursoragent and others added 4 commits November 8, 2026 03:55
- TestMain: run .php/.zy script args so PHP_BINARY (go test binary) works in proc_open
- TestPHPFixtureProcess/TestRunTests: load mongodb/redis for opt-in PHP regressions; skip Redis integration without ORIGAMI_REDIS_TEST_PORT
- halt_compiler_uppercase: compare payload with CRLF normalized to LF
- Extract loadDefaultRuntime for suite and CLI; add focused proc_open child tests

Co-authored-by: selden <ctfang@users.noreply.github.com>
exit_status_test.php and docs use go build ./zy.go; splitting runtime_loader.go
broke that convention (undefined loadDefaultRuntime on darwin matrix).

Co-authored-by: selden <ctfang@users.noreply.github.com>
NewIntLiteral turned default permissions into mode 0o1411 (non-writable);
use NewNumberLiteral so omitted-arg mkdir matches PHP 0777.

Co-authored-by: selden <ctfang@users.noreply.github.com>
Wait for first handler to return before redialing; retry until the
replacement callback starts so CI does not hang for the package deadline.

Co-authored-by: selden <ctfang@users.noreply.github.com>
@ctfang
ctfang merged commit 5c6f936 into main Nov 8, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants