A9: audit tests/ and CI #369
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 brcly/TuxBox. Originally posted by snoozedDev on 2026-11-28T04:28:48Z.
Taking audit A9 (
tests/and CI) from ROADMAP.md, following "How an audit runs".TUXBOX_XSHADERandDXC, and the Windows provider unit tests (tuxbox-d3d12,tuxbox-xmem,tuxbox-xgameruntime) that CI typechecks or does not build at all.tuxbox.py check --no-gpusay it covers, including Python versions and platforms (Python 3.10 is #366).The findings list comes here first, under the roadmap's headings, with no changes. Then small PRs, one kind of change each.
This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-11-28T04:28:50Z.
These are the findings for A9. Nothing is changed yet, per the roadmap. Measured on
mainat7bafe6b, CPU only, on Linux.What runs
TUXBOX_XSHADERorDXC: 521 tests, 21 skipped.python -m unittest discover -s tests -vgives the reasons.test_half_rounding9,test_float_to_integer7, and one each intest_fp16_overflow,test_fract_f32,test_rpi_rounding,test_large_dispatchandtest_dxc_worker(the last also needs a C++ compiler). They are the tests that check the translator's numeric results through DXC: float-to-integer saturation and rounding, half rounding, fract, fp16 overflow, the large-dispatch group base, and the DXC worker.TUXBOX_XSHADERset to the debugxshaderthat the Rust job'scargo testalready builds, andDXCset to Microsoft's Linux releaselinux_dxc_2026_09_28(dxcompiler 1.9.2609.5): 521 tests OK, 0 skipped. The seven modules take 2.9 s; the whole suite 7.6 s.cargo xwin test --no-run --target x86_64-pc-windows-msvc -p tuxbox-d3d12 -p tuxbox-xmem -p tuxbox-xgameruntimeand run under plain Wine with a scratch prefix: d3d12 214 passed and 10 failed, xmem 13/13, xgameruntime 2/2. The 10 are thememory_waitgpu_*tests. Plain Wine lists the GPU, butD3D12XboxCreateDevicereturnsE_INVALIDARG, so they panic instead of skipping. I haven't checked how they behave on a GitHub Windows runner, which has no hardware adapter.Findings per heading
tuxbox-d3d12) or not built at all (tuxbox-xmem,tuxbox-xgameruntime). All of them that don't need a device also passed at 11 earlier commits back to 2026-11-27, so I can't point to a regression CI would have caught.hashlib.file_digest; #366 fixes it. A 3.10 CI run would keep it fixed.tests/test_*.pyfound 17 of the 521 test methods with no assert of their own. All 17 check through a helper (check_conversion,check_inline_results,self.failpassed as a callback), so none of them is a real finding.6. The Rust job's cache doesn't hold the build.
Swatinem/rust-cachesavestarget/andtools/shader-compiler/target/, but.cargo/config.tomlsetstarget-dir = "build/cargo". The cache restores ("full match: true" in run 46105691898), yet every step compiles its dependencies again, thewindowscrates included. The Rust job took 64 s and the Python job 16 s. I haven't measured how much a working cache would save.7. No test is slow. The whole suite takes 5.3 s without the tools and 7.6 s with them.
8.
tuxbox.py check --no-gpuand CI run nearly the same list, written twice (project_tuxbox/check.pyandci.yml). They differ:checkalso typecheckstuxbox-bvhfor Windows and builds a releasexshaderfor the Python tests, and CI does neither.9. CONTRIBUTING's "Code checks" block matches
ci.yml. It doesn't say that CI skips the DXC tests, or thatcheck --no-gpuruns more than CI does, and the docstring ofproject_tuxbox/check.pysays its first group "is what CI runs".tests/or the workflow. I didn't look for duplicate tests beyond the assertion scan.Proposed PRs, one kind each, safest first
ci: run the DXC-dependent Python tests: download Microsoft's Linux DXC release, pinned by URL and SHA-256, and run the Python suite in the Rust job with the debugxshader, so the 21 tests run. The existing 3.12 job stays as it is, so the no-tools path stays tested. Measured cost: about 3 s, plus the download.ci: cache the directory cargo builds into: pointrust-cacheatbuild/cargo.ci: typecheck tuxbox-bvh for Windows, ascheck --no-gpudoes.For you to decide
gpu_*tests behave on a runner with no adapter.I'll start with PR 1 unless you'd rather I didn't.
This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-11-30T11:37:56Z.
@snoozedDev, sorry these sat without an answer. Please go ahead with the cleanup PRs. CI has changed since you measured, though (as of
e5d2e913), so please re-check those findings first:cargo fmt --check, rustdoc with warnings denied, and Miri on the providers' unit tests for x86_64-pc-windows-msvc (acphal, xapu, gameinput, xg, xcrdapi, xgameruntime, xmem, d3d12). So those Windows unit tests now run in CI under Miri, rather than only being typechecked. Tests Miri can't run carry anignorereason.xshader, downloads DXC 1.9.2609, and runs the whole Python suite withTUXBOX_XSHADERandDXCset. So the 21 numeric tests that skip in the plain Python job do run there.What's left from your list is mostly the slow, duplicate and can't-fail tests, and the gap between what CONTRIBUTING says CI covers and what it does.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-11-30T12:13:21Z.
Thanks. I re-checked against
mainat829b5355, with CI times from run 46408754090 (of3926959e, two commits earlier). PR 1 and PR 3 from my list are done: the translator job runs the DXC tests, andcargo check --workspacecoverstuxbox-bvh. Here's what changed or is still open.Slow tests. The suite is now 763 tests. It takes 56 s locally (60 s with
xshaderand DXC), and in CI 103 s on 3.12, 167 s on 3.10 and 136 s in the translator job, so it runs three times per push. About 49 s of the local run is the fivetest_native_rdna2_*modules (35 tests). The slowest single test,test_native_rdna2_approx'stest_model_reproduces_the_exact_forms, takes 15 s. cProfile puts almost all of that inFractionarithmetic intools/native_rdna2/ieee_float.py(rounded,encode,decode, withFraction(2) ** ninside loops), over 556,000approx()calls. Miri's 7.7 min still sets the length of a CI run, so a faster model would mostly shortencheck --no-gpuand local runs.No-GPU tests that no CI job runs. In the translator job, 12 skip:
test_scarlett_frames7,test_scarlett_first_visual_failure1). Pillow isn't inrequirements.txt. With it installed, all 8 pass locally.GameInputLayoutTestsneedclang-cland the Windows headers thatcargo xwinstages.test_stage_baselinetest needs the Vulkan headers.test_xcrdapi_abineeds a builtxcrdapi.dll.The CI log uses
-q, so it doesn't name the skipped tests. I worked out the middle two by comparing skip counts with a local run where they pass.Can't-fail tests. Same result as before: 16 of 763 tests have no assert of their own, and all 16 check through helpers that assert (
check_conversion,check_programs,check_inline_results,check_register_results).Duplicate tests. I didn't look for any.
Cache. The Rust and Miri jobs still cache
target/, while builds go tobuild/cargo. The translator job's. -> build/cargois right. The cost is small now: each run re-checkswindowsand the proc-macro crates. In the Miri job, compiling dependencies takes about 15 s.CONTRIBUTING vs CI. "Code checks" leaves out rustdoc, the translator job and the 3.10/3.12 matrix. Three other places also say less than CI does, or claim
check --no-gpumatches it: the PR template's "CI runs…" line,check.py's docstring, and the--no-gpuhelp.check --no-gpuruns neither Miri nor rustdoc. The docs PR that references this issue fixes all four, with no change in behaviour.Next, one kind each, if you want them:
ci: install Pillow in the translator job, so those 8 tests run. Optionally alsolibvulkan-devfor the timing-layer test.ieee_float.pywith integer arithmetic where it builds powers of two, keeping its results exact. The tests that compare it with the recorded words would catch any change. This is Jeffrey C's recent code, so I'd hold off unless you want it.ci: cache the directory cargo builds into(Rust and Miri jobs). It's a small saving.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-11-30T20:12:55Z.
Next cleanup from this list: the Miri job's time, which sets the length of a CI run (7 min 12 s on
58738995; the other jobs take 1.6 to 2.5 min).In that run's log the d3d12 tests take 347.86 s of the job. Locally at
d00006b2, with CI's flags and--report-time, six tests take 228 s of the 286 s of test time:heap_page_cachesweep_reaches_expired_key_behind_live_entriesrecorded_writeswhat_has_run_or_is_gone_is_droppedmemory_waitnamed_ranges_survive_an_unknown_write_and_mergingheap_page_cachefull_cache_replaces_same_key_without_duplicate_queue_entriesheap_page_cachefailed_imports_are_not_cached_and_live_entries_are_boundedplacement::pendingthe_index_finds_exactly_the_overlapping_rangesThey loop to production sizes: the page cache's
LIMIT,MAX_NAMED, 10,000 lists, 500 probes. With smaller counts under Miri only (LIMIT256,MAX_NAMED64, 2,000 lists, 50 probes), all 328 tests pass and the d3d12 run goes from 327 s to 114 s here. Normal builds and test runs keep today's values. Running each test in its own process on four cores (cargo miri nextest run -j4) only got to 231 s.Two of the four changes put
if cfg!(miri) { .. } else { .. }on a constant inheap_page_cache.rsandmemory_wait.rs. If you'd rather not have that in provider code, I can mark the sixignore = "takes too long under Miri"like the five you already skip. I'll open the PR with the smaller counts unless you say otherwise.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-01T15:14:27Z.
@snoozedDev sorry for the delay. Yes, please go ahead with the Miri time: six tests taking 228 s of 286 s is the right target. Shrinking their sizes under
cfg(miri)(as #599 did) keeps what they test. Note that main now runs Miri on more d3d12 tests than when you measured (today's PRs added a few, withignorereasons where Miri can't run a Windows call), so please re-time on current main first.Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-12-02T19:25:23Z.
One more test fix in
tuxbox-xmem, sent as its own PR right after this comment.Under GE-Proton11-14's Wine, the xmem unit tests fail about half the time with default test threads: 14 of 30 runs at
c1139ab2, with the test binary run from where cargo puts it.chunked_private_span_shares_allocation_and_scans_across_uncommitted_gapreserves a 16-page aperture wherever the OS puts it and expects one private span. Spans are cut at 64-page address boundaries, so an aperture that straddles one gets two. The failed assertion holdsPOOL, so four more tracking tests then fail on the poisoned lock. The PR keeps the test's aperture inside one chunk and changes no provider code.DrArroway, this is your test from
9f9266ec. Say if you'd rather it asserted something else.Main's red Miri job (two tests in
tests/physical_backing.rsreachingVirtualAlloc2) is fixed by #658, so I'm not sending that part.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-12-02T22:10:33Z.
One more
tuxbox-xmemtest fix; the PR follows right after this comment.On main at
a789a4e4the xmem unit tests fail on every run under GE-Proton11-14's Wine: 10 of 10 with--test-threads=1, and every default-thread run.gpu_tile_hold_keeps_the_whole_private_span_mapped(from #660) unmaps one page of its aperture, and its clean-up then unmaps all four. An unmap refuses a range with an unmapped page in it, so the lastmap(aperture, 4, null)returns NULL. The panic holdsPOOL, and six more tests fail on the poisoned lock.The assertions the test is about pass: the sibling page stays committed under the hold and is reserved again after release. The PR only changes the clean-up to unmap the three pages that are still mapped. No provider code changes.
This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.
Imported from brcly/TuxBox. Originally posted by snoozedDev on 2026-12-02T23:30:31Z.
Re-timed Miri on
a789a4e4, as you asked before a second round.The job took 7 min 28 s there (run 46975151989), and the d3d12 tests are 351 s of it. The time is spread out now: timed here, the ten longest tests take 135 s of 219 s, and the longest (
packed_structure, 28 s) needs its 2,049 leaves to cross a run boundary, so shrinking has less to give than in #599.Running the d3d12 tests as three groups at once does more, because Miri runs each test process on one core. With CI's command on four pinned cores here (local nightly, not CI's pinned one):
commands::,device::and everything else at once, beside the other providersNo test or size changes. The last group is whatever the first two leave, so a test in a new module still runs without editing the workflow. A failing test or a Miri error in any group fails the job, and each group's log prints in its own section. I have not timed it on a GitHub runner yet.
I'll send that as one PR to
ci.yml, with the job time from its own CI run. If you'd rather keep one process and shrink sizes undercfg(miri)instead, say so and I'll do that.This contribution was written by an AI agent (Claude Opus 5.5) operating under my supervision. I am accountable for it and will respond to review.