Scripts: restore caller directory and list XCL_SAMPLE_FSPX in test.ps1 #2142

Closed
HumanlyDev wants to merge 1 commit from upstream-pr/2152 into main
HumanlyDev commented 2026-11-25 06:24:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by HumanlyDev on 2026-11-25T06:24:47Z.


Restore the caller's working directory on exit (including build/test failures) and list XCL_SAMPLE_FSPX in the skipped-samples notice in scripts/test.ps1, with unit test coverage in scripts/test-native-stderr.tests.ps1. Non-runtime change under scripts/.

What is in it

  • scripts/test.ps1:
    • Add 'XCL_SAMPLE_FSPX' to the $missing sample-variable list (matching crates/xcl/src/gpu/recomp/tests.rs gating on XCL_SAMPLE_FSPX).
    • Replace bare Set-Location with Push-Location (Join-Path $PSScriptRoot '..'); try { ... } finally { Pop-Location } so running scripts/test.ps1 from any directory restores the caller's location on both success and failure.
  • scripts/test-native-stderr.tests.ps1:
    • Verify test.ps1 restores the caller's working directory on both a passing run and a failing cargo build (XCL_TEST_CARGO_FAIL=1), and prints XCL_SAMPLE_FSPX in the skipped-samples notice when unset.

Tested

  • Hardware & toolchain: NVIDIA GeForce RTX 4060 (32.0.16.1088), AMD Ryzen 5 7600, Windows 11 Pro 10.0.26200 (build 26200), Windows PowerShell 5.1, rustc 1.100.0 (0ef1bc386 2026-11-09), DXC 1.8.2502.11.
  • powershell -ExecutionPolicy Bypass -File .\scripts\test-native-stderr.tests.ps1: passed (exit code 0, all assertions ok).
  • .\scripts\test.ps1 (cargo build --workspace + cargo test --workspace -- --test-threads=4, RTX 4060, debug): 1154 passed, 0 failed, 46 ignored across 21 targets (25 SKIPPED GPU checks: 20 no wave64, 3 per-lane form #1426 refusals, 1 no heap windows, 1 cannot disable the driver cache (Windows Developer Mode is required)).

Regression run

  • Not needed: script/test-only change under scripts/ (no runtime files under crates/xcl/src/ modified).

Not tested

  • XCL_SAMPLE_* sample runs (no game/sample files on this machine), PowerShell 7 (pwsh) on CI, AMD RDNA3/4, Linux / Wine.

AI use

  • Antigravity (Google DeepMind; Gemini 4): audited scripts/test.ps1, implemented the Push-Location/Pop-Location and XCL_SAMPLE_FSPX fixes and tests, ran the verification scripts, and drafted this PR description.
<!-- greyfinch-sync:ivall/xcl:issue:5486329040 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152). Originally posted by [HumanlyDev](https://github.com/HumanlyDev) on 2026-11-25T06:24:47Z. --- Restore the caller's working directory on exit (including build/test failures) and list `XCL_SAMPLE_FSPX` in the skipped-samples notice in `scripts/test.ps1`, with unit test coverage in `scripts/test-native-stderr.tests.ps1`. Non-runtime change under `scripts/`. **What is in it** - `scripts/test.ps1`: - Add `'XCL_SAMPLE_FSPX'` to the `$missing` sample-variable list (matching `crates/xcl/src/gpu/recomp/tests.rs` gating on `XCL_SAMPLE_FSPX`). - Replace bare `Set-Location` with `Push-Location (Join-Path $PSScriptRoot '..'); try { ... } finally { Pop-Location }` so running `scripts/test.ps1` from any directory restores the caller's location on both success and failure. - `scripts/test-native-stderr.tests.ps1`: - Verify `test.ps1` restores the caller's working directory on both a passing run and a failing `cargo build` (`XCL_TEST_CARGO_FAIL=1`), and prints `XCL_SAMPLE_FSPX` in the skipped-samples notice when unset. **Tested** - Hardware & toolchain: NVIDIA GeForce RTX 4060 (`32.0.16.1088`), AMD Ryzen 5 7600, Windows 11 Pro `10.0.26200` (build `26200`), Windows PowerShell 5.1, `rustc 1.100.0 (0ef1bc386 2026-11-09)`, DXC `1.8.2502.11`. - `powershell -ExecutionPolicy Bypass -File .\scripts\test-native-stderr.tests.ps1`: passed (exit code `0`, all assertions ok). - `.\scripts\test.ps1` (`cargo build --workspace` + `cargo test --workspace -- --test-threads=4`, RTX 4060, debug): 1154 passed, 0 failed, 46 ignored across 21 targets (25 SKIPPED GPU checks: 20 `no wave64`, 3 `per-lane form` `#1426` refusals, 1 `no heap windows`, 1 `cannot disable the driver cache (Windows Developer Mode is required)`). **Regression run** - Not needed: script/test-only change under `scripts/` (no runtime files under `crates/xcl/src/` modified). **Not tested** - `XCL_SAMPLE_*` sample runs (no game/sample files on this machine), PowerShell 7 (`pwsh`) on CI, AMD RDNA3/4, Linux / Wine. **AI use** - Antigravity (Google DeepMind; Gemini 4): audited `scripts/test.ps1`, implemented the `Push-Location`/`Pop-Location` and `XCL_SAMPLE_FSPX` fixes and tests, ran the verification scripts, and drafted this PR description.
DavidM1911 commented 2026-11-25 07:05:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T07:04:48Z.


Verification on RTX 3060 Ti (Windows 11), branch merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.)

Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7155464724 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7155464724). Originally posted by [DavidM1911](https://github.com/DavidM1911) on 2026-11-25T07:04:48Z. --- Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, ~26 ignored. (Intermittent single-test flake / 0xc0000005 abort under parallel scheduling — tracked in #1978; clean on single-threaded rerun.) Thanks!
raylitebull commented 2026-11-25 11:09:47 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T11:03:22Z.


Code review on 18e9f70 (scripts/test.ps1, scripts/test-native-stderr.tests.ps1):

  • Wrapping scripts/test.ps1 in Push-Location ... / try { ... } finally { Pop-Location } ensures caller working directory is restored on both pass and non-zero cargo build exits, XCL_SAMPLE_FSPX is included in $missing, and both CI checks are green.

Remaining before merge: Independent PowerShell 5.1/7 verification of scripts/test-native-stderr.tests.ps1 on 18e9f70 (the prior --lib run did not execute the PowerShell test).

<!-- greyfinch-sync:ivall/xcl:comment:7160527105 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7160527105). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T11:03:22Z. --- Code review on `18e9f70` (`scripts/test.ps1`, `scripts/test-native-stderr.tests.ps1`): - Wrapping `scripts/test.ps1` in `Push-Location ... / try { ... } finally { Pop-Location }` ensures caller working directory is restored on both pass and non-zero `cargo build` exits, `XCL_SAMPLE_FSPX` is included in `$missing`, and both CI checks are green. **Remaining before merge:** Independent PowerShell 5.1/7 verification of `scripts/test-native-stderr.tests.ps1` on `18e9f70` (the prior `--lib` run did not execute the PowerShell test).
RavenCurseBurg commented 2026-11-25 14:09:55 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T13:05:33Z.


Following the bracketed-checkout feedback, here is a standalone fix and regression test directly on this PR's 18e9f70. The mock Cargo prints its actual working directory with both checkout [a] and checkout a present. On the original runner, the new assertion failed in both Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. With Push-Location -LiteralPath, scripts/test-native-stderr.tests.ps1 passed in both, including the existing caller restoration, exit 42 and sample-notice assertions. Tested with a synthetic Cargo process on Windows 11; no dual-vendor GPU run. OpenAI Codex (GPT-6) adapted the previous fix to this head and ran the checks.

Tested 18e9f7065726ac12879e5f6919da64b5415cbd18 on Windows 11 24H2, build 26100.9711 (i7-13700). This used a temporary mock Cargo executable.

Tested

  • powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts/test-native-stderr.tests.ps1 and the same command with pwsh.exe both exited 0. This covers a successful build/test and a build returning 42, with the caller's directory restored. Versions were Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9.
  • I also ran the runner from a temporary path containing a space, with XCL_SAMPLE_FSPX set. Mock Cargo returned 0 for build and 17 for test. Both shells propagated 17, restored the caller's directory, forwarded an extra test argument, and omitted FSPX from the missing-samples list.

Not tested

Rust compilation, GPU tests or retail sample files.

AI use

OpenAI Codex (GPT-6) ran the fixture, wrote and ran the additional process-exit check, and drafted this report.

Follow-up on 18e9f7065726ac12879e5f6919da64b5415cbd18: bracketed checkout names. My earlier fixture checked restoration from a plain checkout. With the runner under checkout [A]\scripts and a sibling checkout A\scripts, native Cargo logged the sibling as its working directory, even though the caller's location was correctly restored. I ran the same eight cases in each shell (plain/bracketed path, success/build failure/test failure/missing Cargo). The three bracketed cases that invoked Cargo picked the wrong directory. Changing the existing call to Push-Location -LiteralPath (Join-Path $PSScriptRoot '..') fixed all eight in both shells. Equivalent fix and regression on the related #776 branch. Tested on Windows PowerShell 5.1 and PowerShell 7.6.9 with mock Cargo. OpenAI Codex (GPT-6) ran this follow-up.

<!-- greyfinch-sync:ivall/xcl:comment:7163279155 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7163279155). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-25T13:05:33Z. --- Following the bracketed-checkout feedback, here is a [standalone fix and regression test](https://github.com/RavenCurseBurg/xcl/commit/4ab5db72d883906118bad0b04b9745152c0f1856) directly on this PR's `18e9f70`. The mock Cargo prints its actual working directory with both `checkout [a]` and `checkout a` present. On the original runner, the new assertion failed in both Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. With `Push-Location -LiteralPath`, `scripts/test-native-stderr.tests.ps1` passed in both, including the existing caller restoration, exit 42 and sample-notice assertions. Tested with a synthetic Cargo process on Windows 11; no dual-vendor GPU run. OpenAI Codex (GPT-6) adapted the previous fix to this head and ran the checks. Tested `18e9f7065726ac12879e5f6919da64b5415cbd18` on Windows 11 24H2, build 26100.9711 (i7-13700). This used a temporary mock Cargo executable. **Tested** - `powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File scripts/test-native-stderr.tests.ps1` and the same command with `pwsh.exe` both exited 0. This covers a successful build/test and a build returning 42, with the caller's directory restored. Versions were Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. - I also ran the runner from a temporary path containing a space, with `XCL_SAMPLE_FSPX` set. Mock Cargo returned 0 for build and 17 for test. Both shells propagated 17, restored the caller's directory, forwarded an extra test argument, and omitted FSPX from the missing-samples list. **Not tested** Rust compilation, GPU tests or retail sample files. **AI use** OpenAI Codex (GPT-6) ran the fixture, wrote and ran the additional process-exit check, and drafted this report. **Follow-up on `18e9f7065726ac12879e5f6919da64b5415cbd18`: bracketed checkout names.** My earlier fixture checked restoration from a plain checkout. With the runner under `checkout [A]\scripts` and a sibling `checkout A\scripts`, native Cargo logged the sibling as its working directory, even though the caller's location was correctly restored. I ran the same eight cases in each shell (plain/bracketed path, success/build failure/test failure/missing Cargo). The three bracketed cases that invoked Cargo picked the wrong directory. Changing the existing call to `Push-Location -LiteralPath (Join-Path $PSScriptRoot '..')` fixed all eight in both shells. [Equivalent fix and regression on the related #776 branch](https://github.com/RavenCurseBurg/xcl/commit/de2547cea7512fda0d3a923d650220cc34ca0b28). Tested on Windows PowerShell 5.1 and PowerShell 7.6.9 with mock Cargo. OpenAI Codex (GPT-6) ran this follow-up.
raylitebull commented 2026-11-25 19:09:05 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-25T18:28:32Z.


Review note on 18e9f70: @RavenCurseBurg caught a genuine edge case on bracketed checkout directories (Push-Location -LiteralPath (Join-Path $PSScriptRoot '..') needed instead of bare Push-Location). Fixing that and getting fresh PowerShell 5.1/7 + dual-vendor verification will unblock merge.

<!-- greyfinch-sync:ivall/xcl:comment:7170957712 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7170957712). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-25T18:28:32Z. --- Review note on `18e9f70`: `@RavenCurseBurg` caught a genuine edge case on bracketed checkout directories (`Push-Location -LiteralPath (Join-Path $PSScriptRoot '..')` needed instead of bare `Push-Location`). Fixing that and getting fresh PowerShell 5.1/7 + dual-vendor verification will unblock merge.
RavenCurseBurg commented 2026-11-28 04:29:36 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-28T04:29:36Z.


The benchmark smoke step on main now overlaps this PR’s directory-restoration change. I prepared a current-main integration candidate on e429936c, including the earlier literal-path fix for bracketed checkout directories.

On Windows PowerShell 5.1 and PowerShell 7, the previous fixture returned 127 when it reached the new benchmark command. On the candidate, both shells passed the fake-Cargo fixture for success, build failure (42) and benchmark failure (43). The fixture checks that Cargo receives the benchmark smoke arguments, that a failed benchmark stops the tests and that the caller gets its working directory back. Both shells also rejected controls that removed literal-path handling or omitted the benchmark’s --test argument.

I ran scripts/test-native-stderr.tests.ps1 and git diff --check. No Rust build, GPU or game run. AI use — OpenAI Codex (GPT-6) prepared the integration and ran the checks.

<!-- greyfinch-sync:ivall/xcl:comment:7234073574 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7234073574). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-28T04:29:36Z. --- The benchmark smoke step on main now overlaps this PR’s directory-restoration change. I prepared a [current-main integration candidate](https://github.com/RavenCurseBurg/xcl/commit/604ab745ed4daf1117be6ba23cbc96af5ae4c4e4) on `e429936c`, including the earlier literal-path fix for bracketed checkout directories. On Windows PowerShell 5.1 and PowerShell 7, the previous fixture returned 127 when it reached the new benchmark command. On the candidate, both shells passed the fake-Cargo fixture for success, build failure (42) and benchmark failure (43). The fixture checks that Cargo receives the benchmark smoke arguments, that a failed benchmark stops the tests and that the caller gets its working directory back. Both shells also rejected controls that removed literal-path handling or omitted the benchmark’s `--test` argument. I ran `scripts/test-native-stderr.tests.ps1` and `git diff --check`. No Rust build, GPU or game run. AI use — OpenAI Codex (GPT-6) prepared the integration and ran the checks.
raylitebull commented 2026-11-28 21:14:09 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by raylitebull on 2026-11-28T21:14:09Z.


Closing as a duplicate of #776 (confirmed by 2+ contributors in #1607, group D145). Thanks for the contribution — feel free to comment if this covers something #776 does not.

<!-- greyfinch-sync:ivall/xcl:comment:7245870070 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7245870070). Originally posted by [raylitebull](https://github.com/raylitebull) on 2026-11-28T21:14:09Z. --- Closing as a duplicate of #776 (confirmed by 2+ contributors in #1607, group D145). Thanks for the contribution — feel free to comment if this covers something #776 does not.

Pull request closed

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
xcl-dev/xcl!2142
No description provided.