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

Open
github-bot wants to merge 1 commit from github-bot/gh-2152 into main AGit
Owner

@⁠HumanlyDev on GitHub · 2026-11-25 06:24 UTC · original
HumanlyDev:scripts/test-ps1-cwd-and-fspx → main · +66 −30 · 2 files · 1 commits · open

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.
**@⁠HumanlyDev** on GitHub · 2026-11-25 06:24 UTC · [original](https://github.com/xcl-dev/xcl/pull/2152) `HumanlyDev:scripts/test-ps1-cwd-and-fspx` → `main` · +66 −30 · 2 files · 1 commits · open 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.
Use Push-Location/Pop-Location in try/finally so scripts/test.ps1 always restores the caller's working directory on both success and failure, and add XCL_SAMPLE_FSPX to the missing sample-variable check. Extend scripts/test-native-stderr.tests.ps1 to cover directory restoration on success and failed build plus XCL_SAMPLE_FSPX reporting.

Assisted-by: Antigravity (Gemini 4)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:20:41 +00:00
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 07:04 UTC · original

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!

**@⁠DavidM1911** on GitHub · 2026-11-25 07:04 UTC · [original](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7155464724) 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!
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 11:03 UTC · original

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).

**@⁠raylitebull** on GitHub · 2026-11-25 11:03 UTC · [original](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7160527105) 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).
Author
Owner

@⁠raylitebull on GitHub · 2026-11-25 18:28 UTC · original

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.

**@⁠raylitebull** on GitHub · 2026-11-25 18:28 UTC · [original](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7170957712) 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.
Author
Owner

@⁠RavenCurseBurg on GitHub · 2026-11-25 13:05 UTC · original · edited 2026-11-25 18:43 UTC

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.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 13:05 UTC · [original](https://github.com/xcl-dev/xcl/pull/2152#issuecomment-7163279155) · edited 2026-11-25 18:43 UTC 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.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2152/head:github-bot/gh-2152'
git switch 'github-bot/gh-2152'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2152'
git switch 'github-bot/gh-2152'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2152'
git switch 'github-bot/gh-2152'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2152'
git switch 'main'
git merge --squash 'github-bot/gh-2152'
git switch 'main'
git merge --ff-only 'github-bot/gh-2152'
git switch 'main'
git merge 'github-bot/gh-2152'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.