repositories / smith

smith

There are many coding harnesses - but this one is fast

owned by bugabinga

test(gates): testing law, nextest tiers without retries, cargo x e2e and coverage, CI push and nightly jobs, plan DFOG846Z

6f5ecb2e2a968fe56f558644b0556a9c0fc83b5b

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Changed files (11)

+405 / −218 text lines

Diff layout

.ci/check.kdl

Modified

+5 / −0 text lines

11job "check" {
22 image "docker.io/library/rust:latest"
3 trigger {
4 push {
5 branch "trunk"
6 }
7 }
38 run "rustup component add rustfmt clippy"
49 run "cargo run -p xtask -- ci"
510}

.ci/e2e.kdl

Added
new file mode 100644

+11 / −0 text lines

1job "e2e" {
2 image "docker.io/library/rust:latest"
3 trigger {
4 push {
5 branch "trunk"
6 }
7 }
8 run "rustup component add rustfmt clippy"
9 run "cargo run -p xtask -- bootstrap"
10 run "cargo run -p xtask -- e2e"
11}

.ci/nightly.kdl

Added
new file mode 100644

+10 / −0 text lines

1job "nightly" {
2 image "docker.io/library/rust:latest"
3 trigger {
4 schedule "0 3 * * *"
5 }
6 run "rustup component add rustfmt clippy"
7 run "cargo run -p xtask -- bootstrap"
8 run "cargo run -p xtask -- coverage"
9 run "cargo run -p xtask -- mutants"
10}

.config/nextest.toml

Modified

+10 / −16 text lines

11# nextest configuration for smith.
2# Source of truth: .system/specs/SMH-SPEC-SPEC0001-smith-specification/index.md.
2# Source of truth: .system/RULES.md, Testing. No profile retries: a flaky
3# test is a bug, and a retry would hide exactly what the gate measures.
5# Every commit: unit, property, snapshot, and bound tests.
46[profile.default]
5retries = 3
7retries = 0
68slow-timeout = "30s"
79fail-fast = false
10default-filter = 'not binary(/^e2e_/)'
9[profile.fast]
12# Every push: the real binary through cli, eval, and rpc.
13[profile.e2e]
1014retries = 0
11fail-fast = true
12slow-timeout = "5s"
14[profile.integration]
15default-filter = 'test(integration::) or test(cli::) or test(tui::)'
16retries = 2
17slow-timeout = "30s"
19[profile.thorough]
20retries = 1
21slow-timeout = "120s"
15slow-timeout = "60s"
16fail-fast = false
17default-filter = 'binary(/^e2e_/)'
2319# Selected by cargo-mutants via additional_cargo_test_args.
24# Mutant detection: a failure is the signal; retries and slow timeouts
25# would mask exactly what mutation testing measures.
2620[profile.mutants]
2721retries = 0
2822fail-fast = true

.system/RULES.md

Modified

+19 / −0 text lines

5151- Every `cargo x` command accepts argument passthrough; `-p` scoping overrides workspace defaults. Lockfile-wide commands (`audit`, `bootstrap`, `ci`) reject scope explicitly.
5252- Build steps run `--locked`; lockfile drift fails instead of silently updating.
54## Testing
56- Every file with test code names the spec it proves (`SMH-SPEC-…`) in its header; `cargo x arch` rejects test code without one.
57- No retries; a flaky test is a bug. Tests never sleep or poll to wait for the system under test; time, cancellation, and readiness are injected or synchronized. Fixtures may pace input; every wait carries a deadline.
58- Regression first: a bug fix lands with the test that failed before it; a refactor starts with a test that pins the behavior it must keep; a security finding lands with the test that encodes the boundary.
59- Kinds, each where it is strong:
60 - end to end, core: the real binary through cli, eval, and rpc; real files, real sockets, scripted provider; every user-visible workflow has one; the acceptance gate for correctness.
61 - end to end, frontends: every `smith-ui` consumer owns a harness fit to its technology (tui: PTY driver with screen snapshots and terminal-state checks; mcp: a real MCP client over stdio; web: a browser driver); the intent vocabulary is the contract and degradation per the intent law is asserted, not assumed; the acceptance gate for usability.
62 - unit and behavior: core crates; one owner per spec sentence; mock `StreamFn`; isolated dirs.
63 - property: pure functions with algebraic laws (encode and decode, canonicalization, span and index math, masking); `proptest` with checked-in regression files.
64 - snapshot: rendered frames, RPC lines, traces, help text; `insta`, reviewed diffs, redacted ids and times.
65 - conformance kits: providers, plugin guests, frontends; fixtures in, vocabulary out.
66 - golden corpus: checked-in sessions; replay and trace byte-identical; regenerated only with a frame-version bump.
67 - bounds: allocation counts and type sizes; exact pins; tighten only.
68 - mutation: all first-party crates nightly; missed mutants become issues.
69 - coverage: `cargo-llvm-cov` over every tier; reported per push as a diff, never a percentage gate; uncovered spec sentences are the backlog.
70- Tiers: `cargo x test` (unit, property, snapshot, bounds; every commit) → `cargo x e2e` (binary; every push) → `cargo x coverage` (report) → nightly (`mutants`, golden regeneration check).
71- A dev dependency earns its place by a test that uses it.
5473## Architecture
5675```text

.system/plans/SMH-PLAN-DFOG846Z-testing-methodology/index.md

Added
new file mode 100644

+57 / −0 text lines

1---
2id: SMH-PLAN-DFOG846Z
3type: plan
4title: "Testing Methodology"
5spec: SMH-SPEC-SPEC0001
6status: approved
7depends_on: [SMH-PLAN-CORE0002]
8---
9
10# Testing Methodology
12## Entry
14- RULES `## Testing` names the kinds, the tiers, and the regression-first law.
15- 191 tests, ≈ 4 s, nextest process-per-test; conformance kit for providers; allocation bounds pinned.
16- Findings behind the plan: retries masked timing races; 26 of 30 test-bearing files cite no spec; mutation scope covered two crates and missed seven boundary comparisons in `config.rs`; `insta`, `proptest`, `expectrl`, `assert_fs`, `tokio` were declared and unused; `smith_core::trace::replay` had no corpus.
18## Decisions
20- End to end is the acceptance gate: core e2e drives the built binary through cli, eval, and rpc; each frontend owns a harness fit to its technology.
21- Retries are zero everywhere; waits are injected or synchronized with deadlines.
22- Every test file cites its spec; `cargo x arch` enforces it.
23- Property, snapshot, golden, bounds, mutation, coverage each have one home and one command; nothing is wired twice.
24- Fuzzing is deferred until its nightly-toolchain footprint is understood; decoders of untrusted bytes are listed as future targets.
26## Order
281. Law and wiring: RULES `## Testing`; nextest tiers (`default` excludes `e2e_*`, `e2e` selects them, `mutants` unchanged, all `retries = 0`); `cargo x e2e`, `cargo x coverage` (`cargo-llvm-cov`, lcov artifact, summary); CI: push runs `ci` and `e2e`; nightly runs `mutants` and `coverage`.
292. Core e2e in `smith-cli/tests/e2e_*.rs`: eval mock turn, eval `--json`, rpc over stdin/stdout (ping, prompt, abort, wait, malformed line, shutdown), auth round trip, session file survives a second run and replays its trace.
303. Spec-reference gate in `cargo x arch`; headers on every test-bearing file.
314. Sleep audit: rpc poll loops become settle signals with deadlines; remaining sites reviewed one by one.
325. Property tests: frame encode and decode, `canonical_json` idempotence and order independence, `Span` arithmetic, `EntryContent` and `EntryContentRef` byte equality, secret mask and unmask; regression files checked in.
336. Snapshots with `insta`: `eval --json`, rpc line sequences, `build_trace`, `--help`; ids and timestamps redacted.
347. Golden corpus: `smith-core/tests/golden/*.smh` plus `*.trace.json`; byte-identical replay; `SMITH_GOLDEN=regenerate` with a frame-version bump only.
358. Mutation: scope every first-party crate; fix the seven `config.rs` misses; nightly job.
369. Coverage: `cargo llvm-cov nextest` across tiers; lcov artifact and summary in the CI log; no threshold.
3710. Research: supersede RSCH0013 with the measured state; remove dev dependencies no test uses; fix the criterion bench.
3811. Frontend e2e stubs: one harness skeleton per `smith-ui` consumer, filled when the frontend lands (tui first, PTY via `expectrl`).
40## Interfaces
42- `xtask`: `e2e`, `coverage`; `arch` gains the spec-reference check.
43- `.config/nextest.toml`: profiles `default`, `e2e`, `mutants`.
44- `.ci/`: `check.kdl` (push), `e2e.kdl` (push), `nightly.kdl` (schedule).
45- `smith-cli/tests/e2e_*.rs`: the core e2e suite.
46- `smith-core/tests/golden/`: the replay corpus.
48## Risks
50- e2e tests spawn the binary; cold builds dominate CI time; `cargo x e2e` shares the target dir with `ci`.
51- Snapshot review needs discipline: a blind `INSTA_UPDATE=always` turns the gate into noise; snapshots are reviewed in the diff.
52- Golden regeneration is a deliberate, versioned act; an accidental regen hides a determinism break.
53- Coverage numbers vary with e2e process boundaries; the report is a map, not a score.
55## Exit
57- Every step green under `cargo x check`, `cargo x e2e`, `cargo x arch`; CI jobs observed running on the public repository.

smith-cli/tests/auth_cli.rs

Deleted
deleted file mode 100644

+0 / −101 text lines

1//! End-to-end credential store behavior through the `smith auth` CLI.
2
3use assert_cmd::Command;
4use std::path::PathBuf;
5
6fn scratch(name: &str) -> PathBuf {
7 std::env::temp_dir().join(format!("smith-auth-test-{name}-{}", std::process::id()))
8}
9
10fn smith(name: &str) -> Command {
11 let mut command = Command::cargo_bin("smith").unwrap();
12 command
13 .env("XDG_DATA_HOME", scratch(name))
14 .env_remove("ANTHROPIC_API_KEY")
15 .env_remove("OPENAI_API_KEY")
16 .env_remove("GEMINI_API_KEY");
17 command
18}
20#[test]
21fn add_list_remove_round_trips_with_user_only_permissions() {
22 let mut add = smith("roundtrip");
23 add.args(["auth", "add", "--provider", "anthropic"])
24 .write_stdin("sk-test-secret\n")
25 .assert()
26 .success()
27 .stdout("anthropic: stored\n");
29 let mut list = smith("roundtrip");
30 list.args(["auth", "list"])
31 .assert()
32 .success()
33 .stdout("anthropic: store\n");
35 let mut check = smith("roundtrip");
36 check
37 .args(["auth", "check", "--provider", "anthropic"])
38 .assert()
39 .success()
40 .stdout("anthropic: store\n");
42 let mut remove = smith("roundtrip");
43 remove
44 .args(["auth", "remove", "--provider", "anthropic"])
45 .assert()
46 .success()
47 .stdout("anthropic: removed\n");
49 let mut gone = smith("roundtrip");
50 gone.args(["auth", "check", "--provider", "anthropic"])
51 .assert()
52 .failure()
53 .stderr(predicates::str::contains(
54 "no credential for anthropic (tried store, env ANTHROPIC_API_KEY)",
55 ));
57 let mut empty = smith("roundtrip");
58 empty
59 .args(["auth", "remove", "--provider", "anthropic"])
60 .assert()
61 .failure()
62 .stderr(predicates::str::contains(
63 "no stored credential for anthropic",
64 ));
65}
67#[test]
68fn stored_secret_never_prints_and_permissions_are_user_only() {
69 let mut add = smith("hygiene");
70 add.args(["auth", "add", "--provider", "openai"])
71 .write_stdin("sk-super-secret-value\n")
72 .assert()
73 .success();
75 let secret_file = scratch("hygiene").join("smith/auth/openai");
76 #[cfg(unix)]
77 {
78 use std::os::unix::fs::PermissionsExt;
79 let mode = std::fs::metadata(&secret_file)
80 .unwrap()
81 .permissions()
82 .mode();
83 assert_eq!(mode & 0o777, 0o600);
84 }
86 let mut list = smith("hygiene");
87 list.args(["auth", "list"])
88 .assert()
89 .stdout("openai: store\n");
90}
92#[test]
93fn check_reports_environment_source() {
94 let mut check = smith("envsource");
95 check
96 .args(["auth", "check", "--provider", "google"])
97 .env("GEMINI_API_KEY", "sk-env")
98 .assert()
99 .success()
100 .stdout("google: env:GEMINI_API_KEY\n");
101}

smith-cli/tests/e2e_auth.rs

Added
new file mode 100644

+101 / −0 text lines

1//! End-to-end credential store behavior through the `smith auth` CLI.
2
3use assert_cmd::Command;
4use std::path::PathBuf;
5
6fn scratch(name: &str) -> PathBuf {
7 std::env::temp_dir().join(format!("smith-auth-test-{name}-{}", std::process::id()))
8}
9
10fn smith(name: &str) -> Command {
11 let mut command = Command::cargo_bin("smith").unwrap();
12 command
13 .env("XDG_DATA_HOME", scratch(name))
14 .env_remove("ANTHROPIC_API_KEY")
15 .env_remove("OPENAI_API_KEY")
16 .env_remove("GEMINI_API_KEY");
17 command
18}
20#[test]
21fn add_list_remove_round_trips_with_user_only_permissions() {
22 let mut add = smith("roundtrip");
23 add.args(["auth", "add", "--provider", "anthropic"])
24 .write_stdin("sk-test-secret\n")
25 .assert()
26 .success()
27 .stdout("anthropic: stored\n");
29 let mut list = smith("roundtrip");
30 list.args(["auth", "list"])
31 .assert()
32 .success()
33 .stdout("anthropic: store\n");
35 let mut check = smith("roundtrip");
36 check
37 .args(["auth", "check", "--provider", "anthropic"])
38 .assert()
39 .success()
40 .stdout("anthropic: store\n");
42 let mut remove = smith("roundtrip");
43 remove
44 .args(["auth", "remove", "--provider", "anthropic"])
45 .assert()
46 .success()
47 .stdout("anthropic: removed\n");
49 let mut gone = smith("roundtrip");
50 gone.args(["auth", "check", "--provider", "anthropic"])
51 .assert()
52 .failure()
53 .stderr(predicates::str::contains(
54 "no credential for anthropic (tried store, env ANTHROPIC_API_KEY)",
55 ));
57 let mut empty = smith("roundtrip");
58 empty
59 .args(["auth", "remove", "--provider", "anthropic"])
60 .assert()
61 .failure()
62 .stderr(predicates::str::contains(
63 "no stored credential for anthropic",
64 ));
65}
67#[test]
68fn stored_secret_never_prints_and_permissions_are_user_only() {
69 let mut add = smith("hygiene");
70 add.args(["auth", "add", "--provider", "openai"])
71 .write_stdin("sk-super-secret-value\n")
72 .assert()
73 .success();
75 let secret_file = scratch("hygiene").join("smith/auth/openai");
76 #[cfg(unix)]
77 {
78 use std::os::unix::fs::PermissionsExt;
79 let mode = std::fs::metadata(&secret_file)
80 .unwrap()
81 .permissions()
82 .mode();
83 assert_eq!(mode & 0o777, 0o600);
84 }
86 let mut list = smith("hygiene");
87 list.args(["auth", "list"])
88 .assert()
89 .stdout("openai: store\n");
90}
92#[test]
93fn check_reports_environment_source() {
94 let mut check = smith("envsource");
95 check
96 .args(["auth", "check", "--provider", "google"])
97 .env("GEMINI_API_KEY", "sk-env")
98 .assert()
99 .success()
100 .stdout("google: env:GEMINI_API_KEY\n");
101}

smith-cli/tests/e2e_selection.rs

Added
new file mode 100644

+99 / −0 text lines

1//! Provider selection and provenance behavior through the `smith` CLI.
2
3//! CLI tests assert on outcomes.
4
5use assert_cmd::Command;
6use predicates::prelude::PredicateBooleanExt;
7
8fn smith(name: &str) -> Command {
9 let mut command = Command::cargo_bin("smith").unwrap();
10 command
11 .env(
12 "XDG_DATA_HOME",
13 std::env::temp_dir().join(format!("smith-sel-test-{name}-{}", std::process::id())),
14 )
15 .env_remove("SMITH_PROVIDER")
16 .env_remove("SMITH_MODEL")
17 .env_remove("SMITH_BASE_URL")
18 .env_remove("ANTHROPIC_API_KEY")
19 .env_remove("OPENAI_API_KEY")
20 .env_remove("GEMINI_API_KEY");
21 command
22}
24#[test]
25fn eval_without_provider_fails_naming_the_selection_surfaces() {
26 smith("noprovider")
27 .args(["eval", "hi"])
28 .assert()
29 .failure()
30 .stderr(predicates::str::contains(
31 "no provider selected (tried --provider/SMITH_PROVIDER)",
32 ));
33}
35#[test]
36fn eval_missing_credential_names_store_and_env_without_leaking_secrets() {
37 let assert = smith("nocreds")
38 .args([
39 "eval",
40 "--provider",
41 "anthropic",
42 "--model",
43 "claude-sonnet-4-5",
44 "hi",
45 ])
46 .env("ANTHROPIC_API_KEY", "")
47 .assert()
48 .failure();
50 assert
51 .stderr(predicates::str::contains(
52 "no credential for anthropic (tried store, env ANTHROPIC_API_KEY)",
53 ))
54 .stderr(predicates::str::contains("sk-").not());
55}
57#[test]
58fn command_line_overrides_environment_and_reports_provenance() {
59 smith("provenance")
60 .args([
61 "eval",
62 "--provider",
63 "anthropic",
64 "--model",
65 "claude-sonnet-4-5",
66 "hi",
67 ])
68 .env("SMITH_PROVIDER", "google")
69 .env("SMITH_MODEL", "gemini-3-pro")
70 .env_remove("ANTHROPIC_API_KEY")
71 .assert()
72 .failure()
73 .stderr(predicates::str::contains(
74 "provider=anthropic(cli) model=claude-sonnet-4-5(cli)",
75 ))
76 .stderr(predicates::str::contains("provider=google").not());
77}
79#[test]
80fn environment_selection_reports_env_provenance() {
81 smith("envprov")
82 .args(["eval", "hi"])
83 .env("SMITH_PROVIDER", "google")
84 .env("SMITH_MODEL", "gemini-3-pro")
85 .assert()
86 .failure()
87 .stderr(predicates::str::contains(
88 "provider=google(env) model=gemini-3-pro(env)",
89 ));
90}
92#[test]
93fn mock_eval_still_runs_without_selection() {
94 smith("mock")
95 .args(["eval", "--mock", "hi"])
96 .assert()
97 .success()
98 .stdout("mock provider: no model configured\n");
99}

smith-cli/tests/selection_cli.rs

Deleted
deleted file mode 100644

+0 / −99 text lines

1//! Provider selection and provenance behavior through the `smith` CLI.
2
3//! CLI tests assert on outcomes.
4
5use assert_cmd::Command;
6use predicates::prelude::PredicateBooleanExt;
7
8fn smith(name: &str) -> Command {
9 let mut command = Command::cargo_bin("smith").unwrap();
10 command
11 .env(
12 "XDG_DATA_HOME",
13 std::env::temp_dir().join(format!("smith-sel-test-{name}-{}", std::process::id())),
14 )
15 .env_remove("SMITH_PROVIDER")
16 .env_remove("SMITH_MODEL")
17 .env_remove("SMITH_BASE_URL")
18 .env_remove("ANTHROPIC_API_KEY")
19 .env_remove("OPENAI_API_KEY")
20 .env_remove("GEMINI_API_KEY");
21 command
22}
24#[test]
25fn eval_without_provider_fails_naming_the_selection_surfaces() {
26 smith("noprovider")
27 .args(["eval", "hi"])
28 .assert()
29 .failure()
30 .stderr(predicates::str::contains(
31 "no provider selected (tried --provider/SMITH_PROVIDER)",
32 ));
33}
35#[test]
36fn eval_missing_credential_names_store_and_env_without_leaking_secrets() {
37 let assert = smith("nocreds")
38 .args([
39 "eval",
40 "--provider",
41 "anthropic",
42 "--model",
43 "claude-sonnet-4-5",
44 "hi",
45 ])
46 .env("ANTHROPIC_API_KEY", "")
47 .assert()
48 .failure();
50 assert
51 .stderr(predicates::str::contains(
52 "no credential for anthropic (tried store, env ANTHROPIC_API_KEY)",
53 ))
54 .stderr(predicates::str::contains("sk-").not());
55}
57#[test]
58fn command_line_overrides_environment_and_reports_provenance() {
59 smith("provenance")
60 .args([
61 "eval",
62 "--provider",
63 "anthropic",
64 "--model",
65 "claude-sonnet-4-5",
66 "hi",
67 ])
68 .env("SMITH_PROVIDER", "google")
69 .env("SMITH_MODEL", "gemini-3-pro")
70 .env_remove("ANTHROPIC_API_KEY")
71 .assert()
72 .failure()
73 .stderr(predicates::str::contains(
74 "provider=anthropic(cli) model=claude-sonnet-4-5(cli)",
75 ))
76 .stderr(predicates::str::contains("provider=google").not());
77}
79#[test]
80fn environment_selection_reports_env_provenance() {
81 smith("envprov")
82 .args(["eval", "hi"])
83 .env("SMITH_PROVIDER", "google")
84 .env("SMITH_MODEL", "gemini-3-pro")
85 .assert()
86 .failure()
87 .stderr(predicates::str::contains(
88 "provider=google(env) model=gemini-3-pro(env)",
89 ));
90}
92#[test]
93fn mock_eval_still_runs_without_selection() {
94 smith("mock")
95 .args(["eval", "--mock", "hi"])
96 .assert()
97 .success()
98 .stdout("mock provider: no model configured\n");
99}

xtask/src/main.rs

Modified

+93 / −2 text lines

1818};
2020const HELP: &str = concat!(
21 "usage: cargo x <check|lint|fmt|test|doc|arch|mutants [args...]|audit|ci|release|bootstrap>\n",
21 "usage: cargo x <check|lint|fmt|test|e2e|coverage|doc|arch|mutants [args...]|audit|ci|release|bootstrap>\n",
2222 " cargo x dev [args...] build and launch the dev smith binary\n",
2323);
3131const DENY_VERSION: &str = "0.20.2";
3232const AUDIT_VERSION: &str = "0.22.2";
3333const MUTANTS_VERSION: &str = "27.1.0";
34const LLVM_COV_VERSION: &str = "0.9.1";
3435const CRATES: &[&str] = &[
3536 "smith",
3637 "smith-core",
5960 Some("lint") => lint(&rest),
6061 Some("fmt") => cargo_fmt_step(&rest),
6162 Some("test") => cargo_nextest(&rest),
63 Some("e2e") => cargo_e2e(&rest),
64 Some("coverage") => cargo_coverage(&rest),
6265 Some("doc") => cargo_doc(&rest),
6366 Some("arch") => arch(&rest),
6467 Some("mutants") => cargo_mutants(&rest),
307310 nextest_run_os(&args)
313/// End-to-end tier: the built binary through cli, eval, and rpc; test
314/// binaries named `e2e_*`, selected by the `e2e` nextest profile.
315fn cargo_e2e(extra: &[OsString]) -> ExitCode {
316 let args = scoped(
317 &[
318 "--locked",
319 "--workspace",
320 "--all-features",
321 "--profile",
322 "e2e",
323 ],
324 extra,
325 );
326 nextest_run_os(&args)
327}
329/// Coverage report over every tier; informational, never a percentage gate.
330/// Both tiers accumulate into one profile set, then `target/coverage/lcov.info`
331/// and the per-file summary are produced from it.
332fn cargo_coverage(extra: &[OsString]) -> ExitCode {
333 let installed = install_llvm_cov(&[]);
334 if installed != ExitCode::SUCCESS {
335 return installed;
336 }
337 if std::fs::create_dir_all(target_dir().join("coverage")).is_err() {
338 return fail("cannot create target/coverage\n");
339 }
340 let tiers: [&[&str]; 2] = [&[], &["--profile", "e2e"]];
341 let base = [
342 "llvm-cov",
343 "nextest",
344 "--no-report",
345 "--locked",
346 "--workspace",
347 "--all-features",
348 ];
349 let clean = run_os(
350 "cargo",
351 &["llvm-cov", "clean", "--workspace"].map(OsString::from),
352 );
353 if clean != ExitCode::SUCCESS {
354 return clean;
355 }
356 for tier in tiers {
357 let mut args: Vec<&str> = base.to_vec();
358 args.extend_from_slice(tier);
359 // A tier with no matching tests is a report, not a failure.
360 args.push("--no-tests=warn");
361 let ran = run_os("cargo", &scoped(&args, extra));
362 if ran != ExitCode::SUCCESS {
363 return ran;
364 }
365 }
366 let lcov = [
367 "llvm-cov",
368 "report",
369 "--lcov",
370 "--output-path",
371 "target/coverage/lcov.info",
372 ];
373 let wrote = run_os("cargo", &lcov.map(OsString::from));
374 if wrote != ExitCode::SUCCESS {
375 return wrote;
376 }
377 run_os(
378 "cargo",
379 &["llvm-cov", "report", "--summary-only"].map(OsString::from),
380 )
381}
310383/// nextest has no warning-deny flag, so config-drift warnings are turned into
311384/// a gate failure by scanning its stderr.
312385fn nextest_run_os(args: &[OsString]) -> ExitCode {
394467 if !extra.is_empty() {
395468 return fail("bootstrap installs tools and admits no scoping\n");
396469 }
397 let steps: [Step; 6] = [
470 let steps: [Step; 7] = [
398471 install_binstall,
399472 install_nextest,
400473 install_machete,
401474 install_deny,
402475 install_audit,
403476 install_mutants,
477 install_llvm_cov,
404478 ];
405479 sequence(&steps, extra)
447521 })
524fn install_llvm_cov(_extra: &[OsString]) -> ExitCode {
525 let tool = tool_present_bin("cargo-llvm-cov", LLVM_COV_VERSION, || {
526 cargo(&[
527 "binstall",
528 "--no-confirm",
529 &format!("cargo-llvm-cov@{LLVM_COV_VERSION}"),
530 ])
531 });
532 if tool != ExitCode::SUCCESS {
533 return tool;
534 }
535 run_os(
536 "rustup",
537 &["component", "add", "llvm-tools"].map(OsString::from),
538 )
539}
450541fn install_binstall(_extra: &[OsString]) -> ExitCode {
451542 tool_present_bin("cargo-binstall", BINSTALL_VERSION, || {
452543 cargo(&[