Scripts: restore caller directory after tests #776

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

@⁠Bababoey7696 on GitHub · 2026-11-24 05:07 UTC · original
Bababoey7696:fix/test-location-pr → main · +16 −2 · 2 files · 1 commits · open

scripts/test.ps1 changes the current working directory to the repository root but does not restore the caller's original directory after execution.

This PR uses Push-Location and try/finally with Pop-Location to preserve the caller's working directory.

What is in it

  • scripts/test.ps1: Restore the caller's working directory after running the build and tests.
  • scripts/test-native-stderr.tests.ps1: Run the test from outside the repository and verify that the original directory is restored.

Tested

  • GitHub Actions on Windows Server 2025.
  • Regression tests passed under Windows PowerShell 5.1 and PowerShell 7.
  • Confirmed that the regression test fails before the fix and passes afterward.
  • Windows workspace build and tests passed: 701 passed, 0 failed, 41 ignored.
  • GPU skip reports: 86 (no wave64), 2 (no GPU UMA).
  • Validation branch commit: 9f9770f.
  • Test run: https://github.com/Bababoey7696/xcl/actions/runs/45329542713

Regression run

  • Not required for this scripts-only change.

Not tested

  • Full test suite on a physical GPU.
  • Retail game execution.
  • Official CI on this PR's exact head commit (awaiting maintainer approval).

AI use

  • ChatGPT (GPT-6) assisted with identifying the issue, developing the fix and regression test, configuring validation workflows, and reviewing the test results.
  • The contributor reviewed the changes and performed the initial code edits.
**@⁠Bababoey7696** on GitHub · 2026-11-24 05:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/776) `Bababoey7696:fix/test-location-pr` → `main` · +16 −2 · 2 files · 1 commits · open `scripts/test.ps1` changes the current working directory to the repository root but does not restore the caller's original directory after execution. This PR uses `Push-Location` and `try/finally` with `Pop-Location` to preserve the caller's working directory. **What is in it** - `scripts/test.ps1`: Restore the caller's working directory after running the build and tests. - `scripts/test-native-stderr.tests.ps1`: Run the test from outside the repository and verify that the original directory is restored. **Tested** - GitHub Actions on Windows Server 2025. - Regression tests passed under Windows PowerShell 5.1 and PowerShell 7. - Confirmed that the regression test fails before the fix and passes afterward. - Windows workspace build and tests passed: 701 passed, 0 failed, 41 ignored. - GPU skip reports: 86 (no wave64), 2 (no GPU UMA). - Validation branch commit: `9f9770f`. - Test run: https://github.com/Bababoey7696/xcl/actions/runs/45329542713 **Regression run** - Not required for this scripts-only change. **Not tested** - Full test suite on a physical GPU. - Retail game execution. - Official CI on this PR's exact head commit (awaiting maintainer approval). **AI use** - ChatGPT (GPT-6) assisted with identifying the issue, developing the fix and regression test, configuring validation workflows, and reviewing the test results. - The contributor reviewed the changes and performed the initial code edits.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:32:15 +00:00
Author
Owner

@⁠milas6669 on GitHub · 2026-11-24 05:14 UTC · original

Test report on c49a0805 (PR head; base main 64b3f35, main is now d208e14, which does not touch scripts/).

Tested

  • Intel i9-10900KF, Windows 11 Pro 10.0.26200, Windows PowerShell 5.1
  • powershell -NoProfile -ExecutionPolicy Bypass -File scripts/test-native-stderr.tests.ps1 on this head: exit 0.
  • The new check fails without the test.ps1 change: with this PR's test script and test.ps1 taken from main, the run exits 1 with test.ps1 changed the caller working directory.

Not tested

  • pwsh (PowerShell 7)
  • a real scripts/test.ps1 run (it builds and runs the whole suite; the GPU was busy)
  • cargo test: the PR changes only scripts

AI use

  • Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
**@⁠milas6669** on GitHub · 2026-11-24 05:14 UTC · [original](https://github.com/xcl-dev/xcl/pull/776#issuecomment-7122754329) Test report on `c49a0805` (PR head; base `main` 64b3f35, `main` is now d208e14, which does not touch `scripts/`). **Tested** - Intel i9-10900KF, Windows 11 Pro 10.0.26200, Windows PowerShell 5.1 - `powershell -NoProfile -ExecutionPolicy Bypass -File scripts/test-native-stderr.tests.ps1` on this head: exit 0. - The new check fails without the `test.ps1` change: with this PR's test script and `test.ps1` taken from `main`, the run exits 1 with `test.ps1 changed the caller working directory.` **Not tested** - `pwsh` (PowerShell 7) - a real `scripts/test.ps1` run (it builds and runs the whole suite; the GPU was busy) - `cargo test`: the PR changes only scripts **AI use** - Claude Code, Claude Sonnet 5.5, ran the commands and wrote this report.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-25 11:08 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 11:08 UTC · [original](https://github.com/xcl-dev/xcl/pull/776#issuecomment-7160654819) 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

@⁠RavenCurseBurg on GitHub · 2026-11-25 17:36 UTC · original · edited 2026-11-25 17:42 UTC

On c49a080076cce5fc83bb4ca94070a7de44998f61, the caller got its original directory back, but Cargo sometimes ran in a different checkout. I put copies of the script under checkout [A]\scripts, created a sibling checkout A\scripts, and called the bracketed script from a third directory. The native Cargo stand-in logged its actual working directory: both build and test ran under checkout A. A successful run returned 0. This reproduced under Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9.

Fix and regression test. Using Push-Location -LiteralPath keeps the checkout name literal. The regression checks the directory printed by native Cargo as well as the directory returned to the caller. It failed on this head and passed after the change in both shells.

On the patched script, I ran eight cases per shell (plain and bracketed checkouts, each with success, build exit 17, test exit 101, or missing Cargo). All 16 selected the expected directory and restored the caller. Build failure stopped before test. scripts/test-native-stderr.tests.ps1 also passed in both shells.

Windows 11 26100.9711, i7-13700, RTX 4060. Mock Cargo and temporary directories only. OpenAI Codex (GPT-6) ran the checks and prepared the patch.

**@⁠RavenCurseBurg** on GitHub · 2026-11-25 17:36 UTC · [original](https://github.com/xcl-dev/xcl/pull/776#issuecomment-7169739993) · edited 2026-11-25 17:42 UTC On `c49a080076cce5fc83bb4ca94070a7de44998f61`, the caller got its original directory back, but Cargo sometimes ran in a different checkout. I put copies of the script under `checkout [A]\scripts`, created a sibling `checkout A\scripts`, and called the bracketed script from a third directory. The native Cargo stand-in logged its actual working directory: both build and test ran under `checkout A`. A successful run returned 0. This reproduced under Windows PowerShell 5.1.26100.9711 and PowerShell 7.6.9. [Fix and regression test](https://github.com/RavenCurseBurg/xcl/commit/de2547cea7512fda0d3a923d650220cc34ca0b28). Using `Push-Location -LiteralPath` keeps the checkout name literal. The regression checks the directory printed by native Cargo as well as the directory returned to the caller. It failed on this head and passed after the change in both shells. On the patched script, I ran eight cases per shell (plain and bracketed checkouts, each with success, build exit 17, test exit 101, or missing Cargo). All 16 selected the expected directory and restored the caller. Build failure stopped before test. `scripts/test-native-stderr.tests.ps1` also passed in both shells. Windows 11 26100.9711, i7-13700, RTX 4060. Mock Cargo and temporary directories only. OpenAI Codex (GPT-6) ran the checks and prepared the patch.
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/776/head:github-bot/gh-776'
git switch 'github-bot/gh-776'

Merge

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