Skip to content

Commit 0bf03f5

Browse files
refactor(conformance): move the conformance suites into a library
Cargo builds each file in tests/ as its own test executable, which no other program can link. Move the conformance suites into src/ as modules of a library, so a test program can link them. Test code is unchanged; cargo test and nextest run the same 15 tests as the library's unit tests. Nextest now names them as binary `conformance`, test `<suite>::<fn>`, so filters that selected a suite by binary select it by test name instead. Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
1 parent 8a044e8 commit 0bf03f5

12 files changed

Lines changed: 25 additions & 8 deletions

File tree

‎CI.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ nextest filterset:
214214
nix run .#openshell-test-runner -- \
215215
--environment ubuntu-docker-rootful --installer deb \
216216
--family conformance --package conformance \
217-
--filter 'binary_id(=conformance::policy_advisor)'
217+
--filter 'test(/^policy_advisor::/)'
218218
```
219219

220220
A local run does not replace the required PR E2E gate.

‎e2e/policy-advisor/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test runner:
6969
nix run .#openshell-test-runner -- \
7070
--environment ubuntu-docker-rootful --installer deb \
7171
--family conformance --package conformance \
72-
--filter 'binary_id(=conformance::policy_advisor)'
72+
--filter 'test(/^policy_advisor::/)'
7373
```
7474

7575
The GitHub write test above and the regressions below still exercise distinct

‎tests/runner/src/main.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct Cli {
3737
#[arg(long = "package", short = 'p', value_name = "PACKAGE")]
3838
packages: Vec<String>,
3939
/// A nextest filterset narrowing the tests that run, e.g.
40-
/// `binary(smoke)`.
40+
/// `test(/^smoke::/)`.
4141
#[arg(long, value_name = "FILTERSET")]
4242
filter: Option<String>,
4343
/// The gateway name the installer registers with the CLI. The packaged

‎tests/suites/conformance/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# The conformance family is one crate; each file in `tests/` is a suite.
4+
# The conformance family is one crate; each module in `src/` is a suite.
55
[package]
66
name = "conformance"
77
description = "Conformance suite: sandbox behavior on every compute driver"

‎tests/suites/conformance/README.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
The `conformance` crate holds the testkit suites for sandbox behavior that every
44
compute driver must provide. The family is this one crate, its own workspace.
5-
Each file in `tests/` is one suite.
5+
It is a library: each module in `src/` is one suite, and `cargo test` and
6+
nextest run the tests as the library's unit tests.
67

78
| Suite | Covers |
89
|---|---|
@@ -28,9 +29,9 @@ gateway and in a tmachine VM, as CI does.
2829

2930
## Adding a test
3031

31-
Add a `#[testkit::test]` function to a suite, or a new file in `tests/` for a new
32-
area. No playbook, test archive or workflow entry is needed: the runner builds
33-
and runs every test in the crate.
32+
Add a `#[testkit::test]` function to a suite, or for a new area, a new file in
33+
`src/` and a `mod` line for it in `src/lib.rs`. No playbook, test archive or
34+
workflow entry is needed: the runner builds and runs every test in the crate.
3435

3536
## What a test may assert
3637

File renamed without changes.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
//! Conformance suite: sandbox behavior that every compute driver must
5+
//! provide. Each module is one suite.
6+
//!
7+
//! `cargo test` and nextest run the tests as this library's unit tests.
8+
//! `#[testkit::test]` also registers them, so a test program runs them by
9+
//! linking this crate.
10+
11+
mod cli;
12+
mod file_transfer;
13+
mod lifecycle;
14+
mod persistent_workspace;
15+
mod policy_advisor;
16+
mod smoke;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)