Agent Skillsnubjs/nub › linux-vm-test

linux-vm-test

GitHub

用于在本地 Linux VM(Lima/Tart)中运行 Nub 测试和调试探针,解决 Docker 无法复现的内核或发行版行为问题。支持持久化 Lima 调试源码状态及 Tart 干净环境复现,涵盖预检、命令追踪、构建及生命周期管理。

.agents/skills/linux-vm-test/SKILL.md nubjs/nub

触发场景

需要复现特定 Linux 内核或发行版行为 Docker 无法准确模拟的架构或包行为测试 Linux Rust 项目源码级调试与构建

安装

npx skills add nubjs/nub --skill linux-vm-test -g -y
更多选项

非标准路径

npx skills add https://github.com/nubjs/nub/tree/main/.agents/skills/linux-vm-test -g -y

不安装直接使用

npx skills use nubjs/nub@linux-vm-test

指定 Agent (Claude Code)

npx skills add nubjs/nub --skill linux-vm-test -a claude-code -g -y

安装 repo 全部 skill

npx skills add nubjs/nub --all -g -y

预览 repo 内 skill

npx skills add nubjs/nub --list

SKILL.md

Frontmatter
{
    "name": "linux-vm-test",
    "metadata": {
        "internal": true
    },
    "description": "Run ad-hoc Nub tests and debugging probes on real local Linux guests. Use for Linux-specific sandbox, kernel, distro, architecture, package, or runtime behavior that Docker cannot reproduce faithfully. Selects persistent Lima for source-mounted iteration or ephemeral Tart for clean-image reproduction."
}

Linux VM testing

Use a real VM only when the behavior depends on a Linux kernel or guest OS. Prefer Docker for userspace-only clean-cache/config experiments and ci-adhoc-test for unavailable architectures, distributions, or release-platform proof.

Two local backends serve different purposes:

  • Lima landlock-vm: persistent Ubuntu arm64 debugger with the host home mounted read-only.
  • Tart: disposable Ubuntu arm64 guest for clean-machine or alternate-image reproduction.

Preflight

Inspect both backends before changing VM state:

limactl list
tart list
limactl shell landlock-vm -- bash -lc \
  'uname -srm; . /etc/os-release; echo "$PRETTY_NAME"; df -h "$HOME" /tmp'

Confirm the source mount before treating it as writable:

limactl shell landlock-vm -- bash -lc \
  'findmnt -T /Users/colinmcd94/Documents/projects/nub'

The known Lima mount is read-only. Never build in /Users/colinmcd94/**. If the guest disk is full, report it and ask before reclaiming space. Never stop, delete, or clean an existing VM merely to make room.

Persistent Lima debugging

Run a short probe synchronously against the exact host source state:

limactl shell landlock-vm -- bash -lc \
  'cd /Users/colinmcd94/.cache/nub/worktrees/<worktree> && <probe>'

Trace a guest command without modifying the host checkout:

limactl shell landlock-vm -- bash -lc \
  'strace -f -o /tmp/nub.strace -- <command>'
limactl shell landlock-vm -- bash -lc \
  'bpftrace -l "tracepoint:syscalls:sys_enter_*" | head'

For a Linux Rust build, copy the exact source state into guest-local storage and use a guest-only target directory:

limactl shell landlock-vm -- bash -lc '
  mkdir -p "$HOME/src" "$HOME/.cache/nub/linux-vm-target"
  src=/Users/colinmcd94/.cache/nub/worktrees/<worktree>
  dest="$HOME/src/nub-<slug>"
  rsync -a --delete \
    --exclude .git --exclude target --exclude node_modules \
    "$src/" "$dest/"
  cd "$dest"
  export CARGO_TARGET_DIR="$HOME/.cache/nub/linux-vm-target/<slug>"
  cargo build -p nub-cli --profile fast
  cargo test -p nub-cli --test <test_stem>
'

Repeat the copy after host edits. Use the exact host worktree under test, a distinct guest target for each branch or probe, and direct Cargo commands because the copied tree intentionally omits Git metadata. Remove only probe-owned files after capturing evidence; do not sweep guest caches or unrelated targets.

Start or stop the persistent VM only when required:

limactl start landlock-vm
limactl stop landlock-vm

Clean Tart reproduction

Let the checked-in helper own lifecycle:

tests/vm/tart-vm.sh up <name> <image>
tests/vm/tart-vm.sh exec <name> -- bash -lc '<probe>'
tests/vm/tart-vm.sh run <name> ./probe.sh
tests/vm/tart-vm.sh down <name>
tests/vm/tart-vm.sh rm <name>

Use a unique VM name. The run operation copies one script when sshpass is installed and otherwise streams its body; it does not copy a fixture tree or checkout. Fetch or copy multi-file fixtures deliberately. Finish a throwaway run with rm; down intentionally preserves the disk.

Evidence

Record:

  • Host commit plus dirty-state summary.
  • Guest distro, kernel, and architecture.
  • Exact command and environment overrides.
  • Exit status, stdout, and stderr.
  • Relevant trace or log path.

Copy concise results to the host before deleting a Tart guest. Do not claim x86_64 coverage from these Apple-Silicon arm64 VMs. Use ci-adhoc-test when the claim requires x86_64-native behavior or another unavailable platform.

版本历史

  • 4fd083f 当前 2026-07-19 12:02

同 Skill 集合

.agents/skills/windows-vm-test/SKILL.md
.claude/skills/audit-thread/SKILL.md
.claude/skills/download-stats/SKILL.md
.claude/skills/git-archaeology/SKILL.md
.claude/skills/md-toc/SKILL.md
.claude/skills/plan-thread/SKILL.md
.claude/skills/pm-perf-tracing/SKILL.md
.claude/skills/soak/SKILL.md
.claude/skills/todo/SKILL.md
skills/nub/SKILL.md
.agents/skills/agent-browser/SKILL.md
.claude/skills/ad-hoc-test/SKILL.md
.claude/skills/address-issue/SKILL.md
.claude/skills/aube-bump/SKILL.md
.claude/skills/aube-sync/SKILL.md
.claude/skills/ci-adhoc-test/SKILL.md
.claude/skills/ci-watch/SKILL.md
.claude/skills/cpu-reduction/SKILL.md
.claude/skills/dev-loop/SKILL.md
.claude/skills/impact-analysis/SKILL.md
.claude/skills/implementation-thread/SKILL.md
.claude/skills/prose-writing/SKILL.md
.claude/skills/release/SKILL.md
.claude/skills/remote-build/SKILL.md
.claude/skills/rust-build-hygiene/SKILL.md
.claude/skills/rust-build/SKILL.md
.claude/skills/visual-review/SKILL.md
.claude/skills/worktree/SKILL.md

元信息

文件数
0
版本
995b212
Hash
c512a3a9
收录时间
2026-07-19 12:02

首页 - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-07-31 20:57
浙ICP备14020137号-1 $访客地图$