Scripts: restore caller directory after tests #771
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/776"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ivall/xcl. Originally posted by Bababoey7696 on 2026-11-24T05:07:45Z.
scripts/test.ps1changes the current working directory to the repository root but does not restore the caller's original directory after execution.This PR uses
Push-Locationandtry/finallywithPop-Locationto 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
9f9770f.Regression run
Not tested
AI use
Imported from ivall/xcl. Originally posted by milas6669 on 2026-11-24T05:14:08Z.
Test report on
c49a0805(PR head; basemain64b3f35,mainis nowd208e14, which does not touchscripts/).Tested
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/test-native-stderr.tests.ps1on this head: exit 0.test.ps1change: with this PR's test script andtest.ps1taken frommain, the run exits 1 withtest.ps1 changed the caller working directory.Not tested
pwsh(PowerShell 7)scripts/test.ps1run (it builds and runs the whole suite; the GPU was busy)cargo test: the PR changes only scriptsAI use
Imported from ivall/xcl. Originally posted by DavidM1911 on 2026-11-25T11:08:49Z.
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!
Imported from ivall/xcl. Originally posted by RavenCurseBurg on 2026-11-25T17:36:15Z.
On
c49a080076cce5fc83bb4ca94070a7de44998f61, the caller got its original directory back, but Cargo sometimes ran in a different checkout. I put copies of the script undercheckout [A]\scripts, created a siblingcheckout 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 undercheckout 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 -LiteralPathkeeps 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.ps1also 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.
Imported from ivall/xcl. Originally posted by github-actions[bot] on 2026-11-29T07:44:04Z.
Nothing has happened on this PR for 3 days, so it is marked
staleand will be closed in 4 days. A push or a comment takes the mark off: rebase it ontomainif it conflicts, and say in one line what it still fixes. If it only waits for a maintainer, a comment saying so is enough.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-01T04:06:34Z.
Triage (#1607) – head
c49a080#2152 (duplicate group D145) wrapped
scripts/test.ps1in the samePush-Location/try/finally Pop-Location, but it is closed, so this is the only open PR for it. Main'stest.ps1still callsSet-Location.No problems found in the diff. The new check in
test-native-stderr.tests.ps1covers the successful run only, not the earlyexitafter a failed build. Main has since added acargo benchstep totest.ps1, so this needs a rebase.Recommendation: keep open.
AI review: Claude Code (Claude Opus 5.5), diffs read only, not built or run; not checked by a human.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.