Allow test runner thread overrides #2676

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

@⁠luckyteagirl on GitHub · 2026-11-26 05:49 UTC · original
luckyteagirl:codex/test-respect-thread-option → main · +59 −5 · 2 files · 1 commits · open

scripts/test.ps1 always added --test-threads=4. On Rust 1.99.0, libtest rejected a caller's second option before running tests; on Rust 1.100.0, duplicate options are accepted with the last value winning. The runner now gives callers a consistent override without passing duplicates.

What is in it

  • Put the four-thread default in RUST_TEST_THREADS for cargo test and restore the caller's environment afterward.
  • Forward the arguments unchanged so libtest can distinguish options from filter values and arguments after --.

Tested

  • A standalone Rust 1.99.0 test binary rejected duplicate --test-threads=N and --test-threads N arguments with exit 101. Both explicit forms took precedence over the environment default.
  • An independent reviewer reproduced Rust 1.98.1's rejection and Rust 1.100.0's last-value behavior, and passed the real PowerShell 5.1 runner on 1.100.0 on both main and this patch (report).
  • scripts/test-test-threads.tests.ps1 and scripts/test-native-stderr.tests.ps1 passed on PowerShell 5.1 and 7.6.9. The mock Cargo fixture checks argument forwarding, the four-thread default, and restoration for both an unset and a previously set environment variable.
  • The expanded native stderr fixture from #296 at 29e66d46 passed with the patched runner on both shells for success, build failure, test failure, and missing Cargo.
  • git diff --check passed.

Regression run

  • Not applicable. The change affects only the PowerShell test runner and its test.

Not tested

  • The Rust workspace suite or GPU tests. The PowerShell regression uses mock Cargo and the libtest check uses a standalone binary.

AI use

  • Codex (GPT-6.2 Sol) implemented the change and fixtures, verified libtest behavior, and drafted this description.
**@⁠luckyteagirl** on GitHub · 2026-11-26 05:49 UTC · [original](https://github.com/xcl-dev/xcl/pull/2676) `luckyteagirl:codex/test-respect-thread-option` → `main` · +59 −5 · 2 files · 1 commits · open `scripts/test.ps1` always added `--test-threads=4`. On Rust 1.99.0, libtest rejected a caller's second option before running tests; on Rust 1.100.0, duplicate options are accepted with the last value winning. The runner now gives callers a consistent override without passing duplicates. **What is in it** - Put the four-thread default in `RUST_TEST_THREADS` for `cargo test` and restore the caller's environment afterward. - Forward the arguments unchanged so libtest can distinguish options from filter values and arguments after `--`. **Tested** - A standalone Rust 1.99.0 test binary rejected duplicate `--test-threads=N` and `--test-threads N` arguments with exit 101. Both explicit forms took precedence over the environment default. - An independent reviewer reproduced Rust 1.98.1's rejection and Rust 1.100.0's last-value behavior, and passed the real PowerShell 5.1 runner on 1.100.0 on both main and this patch ([report](https://git.gtahub.st/github/xcl-dev--xcl/pulls/2676)). - `scripts/test-test-threads.tests.ps1` and `scripts/test-native-stderr.tests.ps1` passed on PowerShell 5.1 and 7.6.9. The mock Cargo fixture checks argument forwarding, the four-thread default, and restoration for both an unset and a previously set environment variable. - The expanded native stderr fixture from #296 at `29e66d46` passed with the patched runner on both shells for success, build failure, test failure, and missing Cargo. - `git diff --check` passed. **Regression run** - Not applicable. The change affects only the PowerShell test runner and its test. **Not tested** - The Rust workspace suite or GPU tests. The PowerShell regression uses mock Cargo and the libtest check uses a standalone binary. **AI use** - Codex (GPT-6.2 Sol) implemented the change and fixtures, verified libtest behavior, and drafted this description.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:15:16 +00:00
Author
Owner

@⁠fromthemoonx on GitHub · 2026-11-26 06:07 UTC · original

The real runner works on Windows PowerShell 5.1, and the bug it fixes depends on the Rust version: Rust 1.98.1's libtest rejects a second --test-threads, Rust 1.100.0's accepts it (the last one wins). So on 1.100.0 main's runner already works with an explicit --test-threads; on 1.98.1 and older, this change is what makes it work.

Windows 11 Pro 26300, Windows PowerShell 5.1.26100, RTX 3060, main b49be18:

result
a one-test crate, cargo +1.98.1 test -- --test-threads=4 --test-threads=2 error: Option 'test-threads' given more than once
same with +stable (1.100.0), and XCL's lib test binary with = and space forms in any order runs, test result: ok
.\scripts\test.ps1 vfs::tests --test-threads=2 under PS 5.1 (real Cargo, Rust 1.100.0): main / this PR merged onto main both exit 0; 37 targets, 12 passed, 0 failed
scripts\test-test-threads.tests.ps1 and scripts\test-native-stderr.tests.ps1 under PS 5.1 on 23c12a4 both exit 0 (test-threads: ok)

Not tested: the whole workspace suite through the runner (only the vfs::tests filter), PowerShell 7.

AI use: Claude Code (Claude Opus 5.5) ran the checks and wrote this comment.

**@⁠fromthemoonx** on GitHub · 2026-11-26 06:07 UTC · [original](https://github.com/xcl-dev/xcl/pull/2676#issuecomment-7184118000) **The real runner works on Windows PowerShell 5.1, and the bug it fixes depends on the Rust version: Rust 1.98.1's libtest rejects a second `--test-threads`, Rust 1.100.0's accepts it (the last one wins).** So on 1.100.0 `main`'s runner already works with an explicit `--test-threads`; on 1.98.1 and older, this change is what makes it work. Windows 11 Pro 26300, Windows PowerShell 5.1.26100, RTX 3060, `main` `b49be18`: | | result | |---|---| | a one-test crate, `cargo +1.98.1 test -- --test-threads=4 --test-threads=2` | `error: Option 'test-threads' given more than once` | | same with `+stable` (1.100.0), and XCL's lib test binary with `=` and space forms in any order | runs, `test result: ok` | | `.\scripts\test.ps1 vfs::tests --test-threads=2` under PS 5.1 (real Cargo, Rust 1.100.0): `main` / this PR merged onto `main` | both exit 0; 37 targets, 12 passed, 0 failed | | `scripts\test-test-threads.tests.ps1` and `scripts\test-native-stderr.tests.ps1` under PS 5.1 on `23c12a4` | both exit 0 (`test-threads: ok`) | **Not tested:** the whole workspace suite through the runner (only the `vfs::tests` filter), PowerShell 7. **AI use:** Claude Code (Claude Opus 5.5) ran the checks and wrote this comment.
This pull request can be merged automatically.
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/2676/head:github-bot/gh-2676'
git switch 'github-bot/gh-2676'

Merge

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