F: build checks.<system>.vm-peers from dev-test vm peers

After F2 moved the peers test into checks, vm-steps still resolved peers
to tests.<system>.peers, so the documented command built nothing. Both
VM names now resolve under checks, the peers one renamed to vm-peers,
and a new self-check fails if a vm name stops pointing at .#checks.

nu dev/dev-test.nu self-check: ok.
This commit is contained in:
ari committed 2026-10-20 15:04:09 -04:00
1 parent 1c2f6f32d3
commit 30ca2010ea
1 file changed
+29 -7
+29 -7
View File
@@ -36,7 +36,7 @@ const FILTER_CACHE_REL = "target/skyg-test-filters.cache"
# unit cargo test --lib --bins
# integration cargo test --test '*' [filter] [--nocapture]
# lint cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo tree -i openssl (empty)
# vm nix build of a NixOS VM test: vm (checks) or peers (tests.<system>.peers)
# vm nix build of a NixOS VM test under checks: vm or vm-peers
# all lint, unit, integration; stops at the first failure
# ci all plus the vm test
# completions print a zsh or bash completion script
@@ -114,7 +114,7 @@ export def "dev-test lint" [] {
# Run a NixOS VM test. Slow: it builds and boots VMs.
export def "dev-test vm" [
name?: string@"nu-complete dev-test vm" # vm (checks) or peers (tests.<system>.peers)
name?: string@"nu-complete dev-test vm" # checks.<system>.vm or checks.<system>.vm-peers
] {
let name = ($name | default "vm")
if $name not-in (nu-complete dev-test vm) {
@@ -154,6 +154,7 @@ export def "dev-test self-check" [] {
++ (check-filter-cache)
++ (check-openssl-verdict)
++ (check-kvm-step)
++ (check-vm-attribute)
++ (check-module-mode)
++ (check-shell-completion)
++ (check-nu-completions)
@@ -305,18 +306,20 @@ def kvm-refusal [] {
def vm-steps [name: string] {
# The KVM check runs in the step body. Raising it here would abort `dev-test ci`
# before lint, unit and integration, and the summary table would not print.
let attr = (match $name {
"peers" => "tests"
_ => "checks"
# Both VM tests are flake checks; the peers one is renamed there.
let build = (match $name {
"peers" => "vm-peers"
_ => $name
})
let system = $"($nu.os-info.arch)-($nu.os-info.name)"
[(step-record $"vm ($name)" $"nix build .#($attr).($system).($name) -L" {||
let attr = $".#checks.($system).($build)"
[(step-record $"vm ($name)" $"nix build ($attr) -L" {||
let why = (kvm-refusal)
if $why != null {
error make { msg: $why }
}
print "NixOS VM tests are slow: expect several minutes."
run-checked "nix" ["build" $".#($attr).($system).($name)" "-L"]
run-checked "nix" ["build" $attr "-L"]
})]
}
@@ -840,6 +843,25 @@ def check-kvm-step [] {
[]
}
# Every `vm` name must build an attribute that exists: the peers test lives at
# checks.<system>.vm-peers, not under the old tests.<system>.peers.
def check-vm-attribute [] {
mut problems = []
for name in (nu-complete dev-test vm) {
let steps = (try { vm-steps $name } catch {|e| [] })
if ($steps | is-empty) {
$problems = ($problems | append $"vm-steps ($name) built no step")
continue
}
let cmd = ($steps | first | get command)
let attr = (if $name == "peers" { "vm-peers" } else { $name })
if not ($cmd | str contains ".#checks.") or not ($cmd | str contains $".($attr) -L") {
$problems = ($problems | append $"vm-steps ($name) builds '($cmd)', expected .#checks.<system>.($attr)")
}
}
$problems
}
# Words after a `TAG:` line, dropping the `--` that ends compadd's options.
def tagged-words [text: string, tag: string] {
let line = ($text | lines | where {|l| $l | str starts-with $"($tag):"} | get 0?)