test: add comprehensive unit tests for write_wide_out #1255

Open
github-bot wants to merge 2 commits from github-bot/gh-1255 into main AGit
Owner

@⁠Ayoub-devv on GitHub · 2026-11-24 13:47 UTC · original
Ayoub-devv:main → main · +57 −0 · 1 files · 2 commits · open

What is in it

Adds 5 new unit tests for the write_wide_out helper in util.rs, covering:

  • null pointer / zero-size buffer (no crash, returns 0)
  • exact-fit buffer (correct length, null-terminated, no error)
  • truncation (returns size, null-terminated at size-1, sets ERROR_INSUFFICIENT_BUFFER)
  • oversized buffer (correct length, null-terminated)
  • empty string (returns 0, buffer contains only NUL)

This function is used by kernelx and previously had no direct test coverage.

Tested

  • hardware: Windows 10 x64, Rust stable-x86_64-pc-windows-msvc
  • cargo test util -- --test-threads=4: 10 passed; 0 failed; 0 ignored; 0 measured; 714 filtered out
    (5 new tests + 5 existing util tests, all ok in 0.01s)

Regression run

Not needed — this PR changes only crates/xcl/src/util.rs inside a #[cfg(test)] mod tests block. No runtime code is modified.

Not tested

  • (N/A, test-only change)

AI use

  • GitHub Copilot (frontier model) assisted with test generation from a specification prompt; all tests reviewed and verified manually against the function's documented behavior.
**@⁠Ayoub-devv** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255) `Ayoub-devv:main` → `main` · +57 −0 · 1 files · 2 commits · open **What is in it** Adds 5 new unit tests for the `write_wide_out` helper in `util.rs`, covering: - null pointer / zero-size buffer (no crash, returns 0) - exact-fit buffer (correct length, null-terminated, no error) - truncation (returns `size`, null-terminated at `size-1`, sets ERROR_INSUFFICIENT_BUFFER) - oversized buffer (correct length, null-terminated) - empty string (returns 0, buffer contains only NUL) This function is used by `kernelx` and previously had no direct test coverage. **Tested** - hardware: Windows 10 x64, Rust stable-x86_64-pc-windows-msvc - `cargo test util -- --test-threads=4`: 10 passed; 0 failed; 0 ignored; 0 measured; 714 filtered out (5 new tests + 5 existing util tests, all ok in 0.01s) **Regression run** Not needed — this PR changes only `crates/xcl/src/util.rs` inside a `#[cfg(test)] mod tests` block. No runtime code is modified. **Not tested** - (N/A, test-only change) **AI use** - GitHub Copilot (frontier model) assisted with test generation from a specification prompt; all tests reviewed and verified manually against the function's documented behavior.
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:36 +00:00
Author
Owner

@⁠Ayoub-devv on GitHub · 2026-11-24 13:54 UTC · original

Hi maintainers — this diff only adds a #[cfg(test)] mod tests block to crates/xcl/src/util.rs; no runtime code is changed. The PR-description check flags it as a runtime change because the file lives under src/, but every added line is inside the test module. Could a maintainer approve the workflow run and, if appropriate, apply the test-only label so the smoke requirement is waived per #452? Thanks!

**@⁠Ayoub-devv** on GitHub · 2026-11-24 13:54 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255#issuecomment-7133529272) Hi maintainers — this diff only adds a `#[cfg(test)] mod tests` block to `crates/xcl/src/util.rs`; no runtime code is changed. The PR-description check flags it as a runtime change because the file lives under `src/`, but every added line is inside the test module. Could a maintainer approve the workflow run and, if appropriate, apply the test-only label so the smoke requirement is waived per #452? Thanks!
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-24 14:02 UTC · original

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

  • cargo test -p xcl --lib lib util: 10 passed, 0 failed.

Thanks!

**@⁠DavidM1911** on GitHub · 2026-11-24 14:02 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255#issuecomment-7133732133) Verification on RTX 3060 Ti (Windows 11), branch merged with current `main`: - cargo test -p xcl --lib lib util: 10 passed, 0 failed. Thanks!
Author
Owner

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

Regression run of 5e78ffe6 on the retail title, for this PR's Regression run section. Both blocks are from scripts/smoke.ps1 as printed, not edited: main on 4178e888, this PR on its head commit with no uncommitted changes, same title and time.

xcl-smoke v1
commit: 4178e888c0b5be50a2887eda45cdb832763b68a4
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1618 (PresentX 1618)
presents per 2 s (last 3): 61 60 60
device removals: 0
crashes: 0
peak commit: 14831 MB
xcl-smoke v1
commit: 5e78ffe6b96371eb38e3e1c08030173ef3521b26
gpu: AMD Radeon RX 9070
title: game.exe
seconds: 60
exit: 0x0
frames shown: 1627 (PresentX 1627)
presents per 2 s (last 3): 60 60 60
device removals: 0
crashes: 0
peak commit: 14812 MB

Against the limits in CONTRIBUTING.md: 101 % of main's frames, 100 % of its peak commit, no crash, no device removal.

AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, cargo build --release -p xcl, 60 s, XCL_NETWORK=0. This is a regression check only: it does not show whether the run reaches the code this PR changes.

AI use: Claude Code (Claude Opus 5.5) built both trees and ran scripts/smoke.ps1; I checked the blocks before posting.

**@⁠Toons29** on GitHub · 2026-11-25 03:19 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255#issuecomment-7151810930) Regression run of `5e78ffe6` on the retail title, for this PR's **Regression run** section. Both blocks are from `scripts/smoke.ps1` as printed, not edited: `main` on `4178e888`, this PR on its head commit with no uncommitted changes, same title and time. ``` xcl-smoke v1 commit: 4178e888c0b5be50a2887eda45cdb832763b68a4 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1618 (PresentX 1618) presents per 2 s (last 3): 61 60 60 device removals: 0 crashes: 0 peak commit: 14831 MB ``` ``` xcl-smoke v1 commit: 5e78ffe6b96371eb38e3e1c08030173ef3521b26 gpu: AMD Radeon RX 9070 title: game.exe seconds: 60 exit: 0x0 frames shown: 1627 (PresentX 1627) presents per 2 s (last 3): 60 60 60 device removals: 0 crashes: 0 peak commit: 14812 MB ``` Against the limits in CONTRIBUTING.md: 101 % of `main`'s frames, 100 % of its peak commit, no crash, no device removal. AMD Radeon RX 9070 (RDNA4, driver 32.0.32029.2010), Ryzen 7 7800X3D, 32 GB, Windows 11 build 26300, Rust 1.100.0, `cargo build --release -p xcl`, 60 s, `XCL_NETWORK=0`. This is a regression check only: it does not show whether the run reaches the code this PR changes. AI use: Claude Code (Claude Opus 5.5) built both trees and ran `scripts/smoke.ps1`; I checked the blocks before posting.
Author
Owner

@⁠DavidM1911 on GitHub · 2026-11-26 04:40 UTC · original

Re-verification on RTX 3060 Ti (Windows 11), new head merged with current main:

  • cargo test -p xcl --lib: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved.

Thanks!

— Devin

**@⁠DavidM1911** on GitHub · 2026-11-26 04:40 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255#issuecomment-7182807476) Re-verification on RTX 3060 Ti (Windows 11), new head merged with current `main`: - `cargo test -p xcl --lib`: all passed, 0 failed, 27 ignored. The earlier merge conflict is resolved. Thanks! — Devin
Author
Owner

@⁠copilot-pull-request-reviewer[bot] on GitHub · 2026-11-24 13:47 UTC · original · reviewed

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

**@⁠copilot-pull-request-reviewer[bot]** on GitHub · 2026-11-24 13:47 UTC · [original](https://github.com/xcl-dev/xcl/pull/1255#pullrequestreview-6040343121) · **reviewed** Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
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/1255/head:github-bot/gh-1255'
git switch 'github-bot/gh-1255'

Merge

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