From 30ca2010ea0fae712e2f68788f8fdc5ddb578bec Mon Sep 17 00:00:00 2001 From: ari Date: Tue, 20 Oct 2026 11:04:57 -0400 Subject: [PATCH] F: build checks..vm-peers from dev-test vm peers After F2 moved the peers test into checks, vm-steps still resolved peers to tests..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. --- dev/dev-test.nu | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/dev/dev-test.nu b/dev/dev-test.nu index 31b7477..d5a0333 100755 --- a/dev/dev-test.nu +++ b/dev/dev-test.nu @@ -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..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..peers) + name?: string@"nu-complete dev-test vm" # checks..vm or checks..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..vm-peers, not under the old tests..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..($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?)