test(tools): stop the validation gate cleanup test from racing Python start-up #25962

Merged
zedekvdb merged 1 commit from upstream-pr/25962 into main 2026-11-23 01:57:06 +00:00
zedekvdb commented 2026-11-23 01:15:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by zedekvdb on 2026-11-23T01:15:27Z.


What

test_command_cleanup_removes_descendant_after_parent_exit_and_timeout (ctest vulkan_validation_gate_commands) fails its timeout=True case on slower Windows machines with assertTrue(ready.exists()).

The case runs a Python parent that starts a Python child, and the child writes ready. gate.run gets a 0.5 s timeout, so the job is killed 0.5 s after the parent starts. On an i7-8750H laptop, one Python start-up that starts a second one takes 0.82 to 1.10 s (5 runs), so the job is often killed before the child has written ready.

The child now sleeps until a deadline the test sets 4 s ahead, instead of for 1 s after its own start. The timeout is 3 s. The test waits for the deadline before checking for the marker. The kill then comes before the child's marker write however long the start-ups take, as long as they stay under 3 s. The timeout=False case uses the same deadline.

Tested

Windows 11 Pro 10.0.26300, i7-8750H, Python 3.14.8, main a182406ffa. python tools/tests/test_vulkan_validation_gate.py CommandTests:

main this PR
Alone 1 of 5 pass 10 of 10 pass (whole class), then 10 of 10 (this test only, 8.8 to 11.1 s)
6 at once 0 of 6 pass 18 of 18 pass (3 rounds of 6)

With TerminateJobObject removed from drain in tools/vulkan_validation_gate.py, both subtests fail at assertFalse(marker.exists()), so the test still detects a descendant that survives the job. The whole file (python tools/tests/test_vulkan_validation_gate.py) passes: 50 tests, OK. python tools/check_conventions.py --base origin/main passes. Not tested on Linux or macOS, where run uses killpg instead of a job. The change there is the same deadline.

The test takes about 5 s longer: both subtests now wait for the 4 s deadline instead of 1.1 s.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt and the licence notice of code adapted from upstream (see AGENTS.md)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5445429032 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25962). Originally posted by [zedekvdb](https://github.com/zedekvdb) on 2026-11-23T01:15:27Z. --- ### What `test_command_cleanup_removes_descendant_after_parent_exit_and_timeout` (ctest `vulkan_validation_gate_commands`) fails its `timeout=True` case on slower Windows machines with `assertTrue(ready.exists())`. The case runs a Python parent that starts a Python child, and the child writes `ready`. `gate.run` gets a 0.5 s timeout, so the job is killed 0.5 s after the parent starts. On an i7-8750H laptop, one Python start-up that starts a second one takes 0.82 to 1.10 s (5 runs), so the job is often killed before the child has written `ready`. The child now sleeps until a deadline the test sets 4 s ahead, instead of for 1 s after its own start. The timeout is 3 s. The test waits for the deadline before checking for the marker. The kill then comes before the child's marker write however long the start-ups take, as long as they stay under 3 s. The `timeout=False` case uses the same deadline. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro 10.0.26300, i7-8750H, Python 3.14.8, main `a182406ffa`. `python tools/tests/test_vulkan_validation_gate.py CommandTests`: | | main | this PR | |---|---|---| | Alone | 1 of 5 pass | 10 of 10 pass (whole class), then 10 of 10 (this test only, 8.8 to 11.1 s) | | 6 at once | 0 of 6 pass | 18 of 18 pass (3 rounds of 6) | With `TerminateJobObject` removed from `drain` in `tools/vulkan_validation_gate.py`, both subtests fail at `assertFalse(marker.exists())`, so the test still detects a descendant that survives the job. The whole file (`python tools/tests/test_vulkan_validation_gate.py`) passes: 50 tests, OK. `python tools/check_conventions.py --base origin/main` passes. Not tested on Linux or macOS, where `run` uses `killpg` instead of a job. The change there is the same deadline. The test takes about 5 s longer: both subtests now wait for the 4 s deadline instead of 1.1 s. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) and the licence notice of code adapted from upstream (see AGENTS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-23 01:40:37 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:40:37Z.

Review: APPROVED


Reviewed — looks good

Nothing in the changed test logic blocks the PR; the test now gives the child a shared deadline and leaves time for the timeout path to terminate it.

What I ran

Reviewed head 88b485034b557268567f9f467652771a3e05f064. I read description.md, commits.md, manifest.json, diff.patch, review/README.md, all changed lines and relevant surrounding code in tools/tests/test_vulkan_validation_gate.py, plus the run and drain implementations in tools/vulkan_validation_gate.py. No tests or other commands were run.

Results

Check Result Note
Changed test lines read passed All four added lines reviewed
Relevant cleanup implementation passed Timeout invokes job termination
Automated checks not run Author reports Windows test results

Findings

Blocking

None.

Non-blocking

None.

Not verified

tools/tests/test_vulkan_validation_gate.py was the only changed file and was read at the relevant lines; the rest of that 903-line file was not read. tools/vulkan_validation_gate.py was read only around run and drain. The author reports passing Windows runs, the full test file, a negative control, and convention checks; these were not run in this review. Linux and macOS behavior was not tested. files.json was not available through the review reader, so no separate excluded-file list was checked; the manifest lists one included changed file.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015688436 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/25962#pullrequestreview-6015688436). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T01:40:37Z. **Review:** APPROVED --- # Reviewed — looks good Nothing in the changed test logic blocks the PR; the test now gives the child a shared deadline and leaves time for the timeout path to terminate it. ## What I ran Reviewed head `88b485034b557268567f9f467652771a3e05f064`. I read `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `review/README.md`, all changed lines and relevant surrounding code in `tools/tests/test_vulkan_validation_gate.py`, plus the `run` and `drain` implementations in `tools/vulkan_validation_gate.py`. No tests or other commands were run. ## Results | Check | Result | Note | |---|---|---| | Changed test lines read | passed | All four added lines reviewed | | Relevant cleanup implementation | passed | Timeout invokes job termination | | Automated checks | not run | Author reports Windows test results | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified `tools/tests/test_vulkan_validation_gate.py` was the only changed file and was read at the relevant lines; the rest of that 903-line file was not read. `tools/vulkan_validation_gate.py` was read only around `run` and `drain`. The author reports passing Windows runs, the full test file, a negative control, and convention checks; these were not run in this review. Linux and macOS behavior was not tested. `files.json` was not available through the review reader, so no separate excluded-file list was checked; the manifest lists one included changed file. ## To get this to a good state Nothing is required.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!25962
No description provided.