Skip to content

build(just): make just test cover the packages CI tests - #729

Merged
nihalpasham merged 2 commits into
NVIDIA:mainfrom
vyncint:fix/justfile-mirror-ci-tests
Aug 10, 2026
Merged

nihalpasham merged 2 commits into
NVIDIA:mainfrom
vyncint:fix/justfile-mirror-ci-tests

Conversation

@vyncint

@vyncint vyncint commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Closes #728.

check is the documented "run all checks" entry point, but test ran 5
packages where CI runs 22 (21 in the matrix + the rustc-codegen-cuda job).
The sixteen it never ran included the entire compiler middle-end:

mir-lower  mir-importer  mir-transforms  nvvm-transforms  cuda-oxide-codegen
cargo-oxide  oxide-artifacts  cuda-intrinsics  cuda-intrinsics-gen
reserved-oxide-symbols  libnvvm-sys  nvjitlink-sys  cuda-artifact-finalizer  ...

So you could edit a lowering pass, run just check, see green, push, and have CI
fail on tests you had no local way to run short of reading the matrix by hand.

Two smaller things came with it:

  • The comment said the recipe excluded "device-only crates", but two of the five
    it ran — cuda-host, cuda-macros — are exactly the ones CI marks
    needs_cuda.
  • --lib --tests dropped CI's deliberate per-package overrides:
    oxide-artifacts needs --features object (without it, eight ELF
    emit/extract tests never run) and cuda-core needs --lib (to skip the
    GPU-only tests/vmm_p2p.rs).

The split

test now runs the 16 packages that need no CUDA at all, with CI's
overrides, plus the rustc-codegen-cuda workspace that -p cannot reach from
the root.

The 5 that CI marks needs_cuda move to a new test-cuda. This is CI's own
annotation, not a partition I invented. They need cuda.h to build, and their
test binaries keep a DT_NEEDED on libcuda.so.1, so on a machine without a
driver they fail to load rather than fail a test:

error while loading shared libraries: libcuda.so.1: cannot open shared object
file: No such file or directory

CI runs them on driverless runners by shadowing the toolkit's link-time stub
under that name (see unit-tests.yml). Splitting keeps just test working on a
machine with no CUDA, rather than failing for a reason that has nothing to do
with the code.

Verified

All three test steps pass locally — 2938 tests, 0 failures. No GPU needed.

I found the split empirically first and it disagreed with a dependency-graph
guess (cuda-device reaches cuda-bindings through a dev-dependency but its
test binary loads fine), which is why this follows CI's needs_cuda flag rather
than either heuristic. Happy to fold the stub-shadow trick into test instead
if you would rather have one recipe cover all 22 driverless.

vyncint and others added 2 commits August 8, 2026 21:08
`check` is the documented "run all checks" entry point, but `test` ran five
packages where CI's matrix runs 21, plus a separate rustc-codegen-cuda job. The
sixteen it never ran included the whole compiler middle-end -- mir-lower,
mir-importer, mir-transforms, nvvm-transforms, cuda-oxide-codegen -- so editing
a lowering pass, running `just check`, and seeing green said nothing about the
tests CI would run on it.

Two smaller things came with that. The recipe's comment said it excluded
"device-only crates", but two of the five it ran, cuda-host and cuda-macros, are
exactly the ones CI marks `needs_cuda`. And `--lib --tests` dropped CI's
per-package overrides: `oxide-artifacts` needs `--features object` or eight
ELF emit/extract tests never run, and `cuda-core` needs `--lib` to skip the
GPU-only VMM/P2P test.

`test` now runs the sixteen packages that need no CUDA at all, with CI's
overrides, plus the rustc-codegen-cuda workspace that `-p` cannot reach from
the root. The five CI marks `needs_cuda` move to `test-cuda`: they need cuda.h
to build, and their test binaries keep a DT_NEEDED on `libcuda.so.1`, so on a
machine with no driver they fail to *load* rather than fail a test:

    error while loading shared libraries: libcuda.so.1: cannot open shared
    object file: No such file or directory

CI runs them on driverless runners by shadowing the toolkit's link-time stub
under that name. Splitting them keeps `just test` working on a machine with no
CUDA, instead of failing for a reason that is not about the code.

Verified locally: all three `test` steps pass, 2938 tests, 0 failures.

Closes NVIDIA#728

Signed-off-by: Vyncint Ng <[email protected]>
…plete

- The `test` header still said the recipe expects a CUDA toolkit and
  counted three exceptions; the split moved the needs_cuda packages to
  `test-cuda`, leaving a toolkit-free recipe with two exceptions.
- The `doc-check` comment still quoted `test`'s old `--lib --tests`
  flags; it now uses `--all-targets`, which also skips doctests.
- Add `test-cuda` to `check`: its `clippy` and `doc-check` legs already
  build cuda-bindings, so the toolkit requirement is unchanged, and the
  pre-split `test` already ran driver-linked cuda-host/cuda-macros test
  binaries. Without it the one-command gate would silently drop the five
  needs_cuda packages CI still tests.
@nihalpasham nihalpasham added bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup labels Aug 10, 2026
@nihalpasham

Copy link
Copy Markdown
Collaborator

Verified the partition against unit-tests.yml entry by entry, and ran both recipes green locally.

I pushed a follow-up fixing the stale header comments and adding test-cuda to check, so the one-command gate keeps full CI coverage (its clippy and doc-check legs already need the toolkit, so nothing new is required of the machine).

With that, this fully closes #728.

@nihalpasham
nihalpasham merged commit 91bbc35 into NVIDIA:main Aug 10, 2026
36 checks passed
nihalpasham pushed a commit that referenced this pull request Aug 11, 2026
…803)

The follow-up offered on #794. That PR added a Command reference table
because the book documented 11 of the CLI's 15 subcommands; `test`, `fmt`,
`update` and `emit-ltoir` appeared nowhere. Nothing stops the table falling
behind again -- adding a variant to the clap enum is a one-line change and
no build compares the two.

`scripts/check-cli-doc-coverage.sh` compares the `Commands` enum in
`crates/cargo-oxide/src/main.rs` against the rows under `### Command
reference`, in both directions. A missing row is the common case; a row for
a command that no longer exists is worse, because a reader trusts it and
gets `unrecognized subcommand`.

Subcommands come from the enum rather than from `cargo oxide --help`: the
enum is the definition, reading it needs no cargo and no build, and that
keeps the guard in the same source-only class as its siblings. A guard that
needed a backend build to answer a documentation question would not get
run. The parse is cross-checked against the built binary -- both report the
same 15 commands, with no disagreement.

Deliberately not required to appear: anything carrying `hide = true`
(`__materializer-provenance` today) and clap's generated `help`, which is
not in the enum at all. Descriptions are out of scope, because clap's short
help is the doc-comment first line while the table's cells add MyST
backticks around names like `cuda-gdb`; comparing them literally would fail
on correct prose.

While wiring it up: `check-guards` was running five of the seven guards.
The crate-inventory and toolchain-parity jobs went into status-guard.yml in
#793 and #790 without being added to the recipe, so `just check` could pass
while status-guard failed -- exactly the drift #729 and #788 built that
recipe to prevent. My omission; all three are in now, and the stale counts
in its comment ("the status-guard pair", "two of the four") are fixed.

Verified: passes on the clean tree (15 documented, 1 hidden excluded), and
seven mutations each fail naming the cause -- new subcommand, deleted row,
invented row, a row for the hidden command, a rename, and both parse
self-tests. `just check-guards` is green end to end.

Signed-off-by: Vyncint Ng <[email protected]>
nihalpasham added a commit that referenced this pull request Aug 11, 2026
…805)

* ci: guard the book's CLI command reference against subcommand drift

The follow-up offered on #794. That PR added a Command reference table
because the book documented 11 of the CLI's 15 subcommands; `test`, `fmt`,
`update` and `emit-ltoir` appeared nowhere. Nothing stops the table falling
behind again -- adding a variant to the clap enum is a one-line change and
no build compares the two.

`scripts/check-cli-doc-coverage.sh` compares the `Commands` enum in
`crates/cargo-oxide/src/main.rs` against the rows under `### Command
reference`, in both directions. A missing row is the common case; a row for
a command that no longer exists is worse, because a reader trusts it and
gets `unrecognized subcommand`.

Subcommands come from the enum rather than from `cargo oxide --help`: the
enum is the definition, reading it needs no cargo and no build, and that
keeps the guard in the same source-only class as its siblings. A guard that
needed a backend build to answer a documentation question would not get
run. The parse is cross-checked against the built binary -- both report the
same 15 commands, with no disagreement.

Deliberately not required to appear: anything carrying `hide = true`
(`__materializer-provenance` today) and clap's generated `help`, which is
not in the enum at all. Descriptions are out of scope, because clap's short
help is the doc-comment first line while the table's cells add MyST
backticks around names like `cuda-gdb`; comparing them literally would fail
on correct prose.

While wiring it up: `check-guards` was running five of the seven guards.
The crate-inventory and toolchain-parity jobs went into status-guard.yml in
#793 and #790 without being added to the recipe, so `just check` could pass
while status-guard failed -- exactly the drift #729 and #788 built that
recipe to prevent. My omission; all three are in now, and the stale counts
in its comment ("the status-guard pair", "two of the four") are fixed.

Verified: passes on the clean tree (15 documented, 1 hidden excluded), and
seven mutations each fail naming the cause -- new subcommand, deleted row,
invented row, a row for the hidden command, a rename, and both parse
self-tests. `just check-guards` is green end to end.

Signed-off-by: Vyncint Ng <[email protected]>

* ci: cover the codegen backend's own workspace in both license guards

The second pass asked for in the #662 review: "a second pass over
`crates/rustc-codegen-cuda` (its own workspace, invisible to both
cargo-deny and this guard today)". Still true, and it had already cost a
row.

That crate carries its own `[workspace]` for the rustc-private dylibs, so
it is a third resolution alongside the root and the examples, and neither
existing guard reached it. The inventory guard read the root workspace
through `cargo metadata`, which stops at that boundary; the policy side ran
`cargo deny check` on the root and a script over the examples.

**Inventory, and a live omission.** `rustc_codegen_cuda` had no row in
dependency-licenses.csv at all -- the largest first-party crate in the
tree, missing from the inventory, while every other member carried a
`1st Party (workspace)` row. Nothing could have caught it. The guard now
unions the declared crates of both first-party workspaces, which takes it
from 41 to 55, and the missing row is added.

**Policy.** `cargo deny` now runs over that workspace too, in the same job
as the root run so the install is shared. This is narrower than it looks
and worth stating precisely: all 82 of its third-party crate *names* also
appear in the root graph, so nothing is unlicensed today. What differs is
versions -- 17 (name, version) pairs resolve there and nowhere else,
including `anyhow 1.0.100`, `libc 0.2.187` and `linkme 0.3.35` -- and
advisory and license verdicts are per version, so an advisory against one
of those 17 is invisible to the root run.

Verified:

  * the inventory guard passes with the row (55 crates) and, with the row
    removed again, fails naming exactly `rustc_codegen_cuda`;
  * banning `anyhow =1.0.100`, a backend-only version, leaves the root run
    at `bans ok` and makes the backend run fail with `error[banned]` --
    the new leg covers crates the root one cannot see;
  * `cargo deny --manifest-path crates/rustc-codegen-cuda/Cargo.toml
    --locked check` is clean on the current tree, so the policy half is
    prevention rather than a fix;
  * `just check-guards` green end to end, and both workflow files parse.

No `--config` on the new run: cargo-deny walks up from the manifest
directory to the repository-root deny.toml, the same resolution the
example-policy script already relies on.

Stacked on #803, which adds the CLI-reference guard to the same
`check-guards` recipe -- review only the second commit.

Signed-off-by: Vyncint Ng <[email protected]>

---------

Signed-off-by: Vyncint Ng <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
nihalpasham added a commit that referenced this pull request Aug 12, 2026
* docs(contributing): point contributors at `just check`

CONTRIBUTING never mentions `just`, so the one-command gate that #729 and
#788 exist to provide is invisible to the person it was built for. The
Formatting and Style section lists the individual commands and even says of
clippy that "there is no single command covering them" -- true of that one
scope, but a reader comes away thinking hand-assembly is the only route,
and quietly skips the guards, the tests CI runs, and the docs gate.

Adds a short "Running the checks" section ahead of it: `just check`, what it
needs (a CUDA toolkit and cargo-deny, no GPU -- the CUDA-linked test
packages shadow the toolkit's libcuda stub themselves), and `just --list`
for the individual recipes.

It deliberately does not restate which CI jobs stay outside `just check`.
That list changes -- three PRs in flight move pieces in and out of it right
now -- and a copy here would rot the way the toolchain pin's copies did.
The `check` recipe's own comment is the single place that names them, so the
text points there instead. The hand commands below stay, since they are
worth knowing when you want one scope rather than the whole gate.

Verified: every claim checked against the Justfile -- `check` exists, 29
recipes carry the `--list` descriptions, the cargo-deny prerequisite and the
libcuda-stub shadowing are both real, and `check`'s comment does name the
CI-only jobs. `just --list` runs.

Signed-off-by: Vyncint Ng <[email protected]>

* docs(contributing): list python3 among the just check prerequisites

Signed-off-by: nihalpasham <[email protected]>

---------

Signed-off-by: Vyncint Ng <[email protected]>
Signed-off-by: nihalpasham <[email protected]>
Co-authored-by: nihalpasham <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working build-related Build scripts, toolchain discovery, or compilation setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

just test covers 5 of the 22 packages CI tests, so just check passes while CI fails

2 participants