Files
devvm/testdata/script/up.txtar
T
CJandClaude Opus 5.5 8d8da01037 feat(tools): dotnet, the .NET SDK, as a shared toolchain (#7)
Adds `dotnet`, the .NET SDK, as a fifth shared toolchain next to node,
python, rust and go. `--tools dotnet`, `devvm tools add dotnet` and the
picker offer it, and a folder with `*.sln`, `*.slnx`, `*.csproj`,
`*.fsproj` or `global.json` at its top level suggests it in the new VM's
summary, the way `package.json` suggests node.

Refs #2. Thanks to @jsskeen-utah for the detailed request.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-07 10:44:25 -07:00

204 lines
9.3 KiB
Plaintext

# devvm in a folder: its VM, created from its image with only the folder
# mounted, its state, .git protection, started, then a shell in the
# folder in place of devvm.
project web git
# A network tier that isn't one: nothing is built or created.
! exec devvm --network sideways
stderr '^devvm: arg_not_choice choices=open, internet, allowlist, none command=--network given=sideways$'
stub_calls
! stdout 'create|clone|start'
! exists $VMS
# A new VM: base built, then cloned with only the folder, read-write, and
# the shared tools, read-only; no agent forwarding; Lima's own port
# forwards off; started, its host key pinned and its ports forwarded by
# devvm's forwarder over Lima's ssh, set up, and devvm's last act is the
# shell, in the folder.
exec devvm --network open
stdout '^==> new_vm_summary vm=devvm-web-[0-9a-f]{14}\nnew_vm_toolchains_none\nnew_vm_agents_none\nnew_vm_layers_none\nnew_vm_size cpus=4 disk=100 memory=8\nnew_vm_network tier=open\nnew_vm_ports ports=all\nnew_vm_choose\n'
stdout '^==> building_image image=base key=[0-9a-f]{12}$'
stdout '^==> creating_from image=base vm=devvm-web-[0-9a-f]{14}$'
stdout '^==> starting vm=devvm-web-[0-9a-f]{14}$'
# None of devvm's own files written out: they stay in the binary.
! exists $XDG_DATA_HOME/devvm/assets
# .git unprotected off macOS, and devvm says so.
[darwin] ! stderr git_protect_needs_macos_new
[linux] stderr '^devvm: git_protect_needs_macos_new$'
stub_calls
stdout '^limactl clone --tty=false devvm-img-[0-9a-f]{12} devvm-web-[0-9a-f]{14} --mount-none --set \.mounts = \[\{"location":"[^"]*/web","writable":true\},\{"location":"[^"]*/data/devvm/tools","mountPoint":"/mnt/devvm-tools","writable":false\}\] --set \.ssh\.forwardAgent=false --set \.ssh\.localPort=[1-9][0-9]+ --set \.portForwards = \[\{"guestIP":"127\.0\.0\.1","guestPortRange":\[1,65535\],"proto":"any","ignore":true\},\{"guestIP":"0\.0\.0\.0","guestPortRange":\[1,65535\],"proto":"any","ignore":true\},\{"guestIP":"::","guestPortRange":\[1,65535\],"proto":"any","ignore":true\}\] --set \.propagateProxyEnv=true --set \.env = \{"NODE_EXTRA_CA_CERTS":.*\}$'
# Its first start's one edit: its proxy in its environment (the
# password's stand-in alone), open, so Lima's own proxy settings off.
stdout -count=1 'limactl edit --tty=false devvm-web'
stdout '^limactl edit --tty=false devvm-web-[0-9a-f]{14} --set \.env = \{"HTTPS_PROXY":"http://devvm:devvm-proxy-password@192\.168\.5\.2:[0-9]+",.* --set \.propagateProxyEnv=false$'
! stdout 'devvm-tools-build'
stdout '^limactl start --tty=false devvm-web-[0-9a-f]{14}\n(limactl list --json\n)*limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c .*/etc/ssh/ssh_host_.*\n'
stdout '^ssh -F none -M -S \S+/data/devvm/run/port-[0-9a-f]{16}\.ctl -T .* -o IdentityFile=\S+/lima/_config/user .* -o UserKnownHostsFile=\S+/data/devvm/vms/[0-9a-f]{14}/run/known_hosts .* -o HostKeyAlias=devvm-web-[0-9a-f]{14} .* -p 60022 -l stub 127\.0\.0\.1 sh -s$'
! stdout '^docker '
stdout '^limactl shell --workdir / devvm-web-[0-9a-f]{14} sh -c cd ''/'' && exec ''bash'' ''-c'' ''d=\$\(mktemp -d\); tar -xf - .*''\n(limactl list --json\n)+limactl shell --workdir /\S*/web devvm-web-[0-9a-f]{14}\n\z'
exists $XDG_DATA_HOME/devvm/tools
! exists $XDG_DATA_HOME/devvm/mise.lock
# .git's hooks and config locked (macOS); elsewhere, not.
[darwin] stdout '^chflags -R -P uchg /\S*/web/\.git/hooks$'
[darwin] stdout '^chflags -R -P uchg /\S*/web/\.git/config$'
[linux] ! stdout chflags
# The forwarder checks the VM's one record of its host keys, for its
# start, which the ssh config checks too; the backend keeps no files of
# the VM's.
vm_name WEB web
exec cat $WEB_dir/run/known_hosts
stdout '\A# devvm: host keys of start [0-9]+ \S+\ndevvm-web-[0-9a-f]{14} ssh-ed25519 \S+\n\z'
stub_calls
stdout '^ssh -F none -M .* -o UserKnownHostsFile='$WEB_dir'/run/known_hosts '
exec cat $DATA/ssh_config
stdout '^ UserKnownHostsFile "'$WEB_dir'/run/known_hosts"$'
! exists $DATA/known_hosts
! exists $WEB_dir/backend
vm_state $WEB_dir/vm.json
stdout '^version=1$'
stdout '^id=[0-9a-f]{32}$'
stdout '^name=devvm-web-[0-9a-f]{14}$'
stdout '^alias=devvm-web$'
stdout '^image=base$'
stdout '^dir=/\S*/web$'
stdout '^folder=[0-9]+:[0-9]+'
stdout '^chain=base=[0-9a-f]{12}$'
stdout '^backend=lima$'
stdout '^created=\d{4}-'
stdout '^net.tier=open$'
stdout '^tools.made.libc=gnu$'
! stdout '^tools.made.files='
[darwin] stdout '^git.mode=on$'
[darwin] stdout '^git.made.git_id=[0-9]+:[0-9]+:[0-9]+\.[0-9]{9}$'
[darwin] stdout '^git.made.protected=true$'
[linux] stdout '^git.mode=off$'
! stdout '^size\.|^ports\.forward='
stdout '^ports.host.ssh=[1-9][0-9]+$'
# Its ssh port is devvm's, recorded before the clone that sets it, so
# other VMs' forwarders never take it.
exec sh -c 'p=$(sed -n "s/.*\"ssh\": \([0-9]*\).*/\1/p" "$WEB_dir/vm.json") && grep -c -- "^limactl clone .* --set \.ssh\.localPort=$p " "$STUB_LOG"'
stdout '^1$'
# limactl ran from devvm's data folder, never the project folder.
exec cat $STUB_DIR/limactl-env
stdout '^cwd=/\S*/data/devvm '
# A folder made again at the same path never gets the old one's VM.
cd $WORK
rm web
mkdir web
cd web
! exec devvm --network open
stderr '^devvm: vm_other_folder vm=devvm-web-[0-9a-f]{14} was=/\S*/web$'
# --no-git-protect: nothing locked. An SSH origin gets a hint: the VM
# has no SSH agent.
project api git
exec git remote add origin [email protected]:o/api.git
stub_reset
exec devvm --network open --no-git-protect
! stdout building_image
stderr '^devvm: ssh_remote_hint vm=devvm-api-[0-9a-f]{14}$'
! stderr git_protect_needs_macos_new
stub_calls
! stdout chflags
vm_name API api
vm_state $API_dir/vm.json
stdout '^git.mode=off$'
# Launches run no docker, which only --from uses, for a new VM or an
# existing one.
stub_calls
! stdout '^docker '
stub_reset
exec devvm --network open
stub_calls
stdout '^limactl list --json$'
! stdout '^docker '
# Linux hosts: set-id files in the folder are named (they reach the host).
[linux] mkdir $WORK/setid
[linux] cd $WORK/setid
[linux] exec sh -c 'touch tool && chmod u+s tool'
[linux] exec devvm --network open
[linux] stderr '^devvm: setid_files files=/\S*/setid/tool$'
# Ctrl+C before the VM's first shell deletes it and its state, and takes
# off .git's locks; nothing else.
project slow git
exec sh -c ': > "$STUB_LOG" && : > "$STUB_DIR/start-hangs"'
! exec devvm --network open &u&
wait_file $STUB_DIR/hanging
kill -INT u
wait u
stdout '^==> interrupted_vm vm=devvm-slow-[0-9a-f]{14}$'
stub_calls
stdout '^limactl delete -f devvm-slow-[0-9a-f]{14}$'
[darwin] stdout '^chflags -R -P uchg /\S*/slow/\.git/config\n(.*\n)*chflags -R -P nouchg /\S*/slow/\.git/config$'
[darwin] stdout '^chflags -R -P nouchg /\S*/slow/\.git/hooks$'
! stdout 'delete -f devvm-(web|api)'
! stdout 'nouchg /\S*/(web|api)/'
! stdout 'limactl shell --workdir'
exec sh -c 'cat "$VMS"/*/vm.json'
! stdout devvm-slow
stdout '"name": "devvm-web-'
exec sh -c 'stub vms | grep -c devvm-slow || true'
stdout '^0$'
rm $STUB_DIR/start-hangs
# --tools, --agents and --layers: none alone or their part's names, each
# refused before anything runs: another part's name with that part's
# flag, any other with a did-you-mean.
project parts git
stub_reset
! exec devvm --tools pyhton
stderr '^devvm: unknown_part_like flag=--tools given=pyhton like=python$'
stderr '^usage_help command=devvm$'
! exec devvm --tools claude
stderr '^devvm: part_other_flag flag=--tools given=claude other=--agents$'
! exec devvm --tools node,docker
stderr '^devvm: part_other_flag flag=--tools given=docker other=--layers$'
! exec devvm --tools java
stderr '^devvm: unknown_part flag=--tools given=java names=node python rust go dotnet$'
! exec devvm --agents cladue
stderr '^devvm: unknown_part_like flag=--agents given=cladue like=claude$'
! exec devvm --layers node
stderr '^devvm: part_other_flag flag=--layers given=node other=--tools$'
! exec devvm --layers mailpit
stderr '^devvm: unknown_part flag=--layers given=mailpit names=desktop docker nix$'
! exec devvm --layers none,docker
stderr '^devvm: part_none_alone flag=--layers$'
! stub_calls
! vm_name PARTS parts
# Without a terminal a new VM gets the defaults, as its summary says,
# each with why: the toolchains the folder's files call for, devvm
# setup's agents, no layers; the summary ends with the flags that choose
# others, and nothing is asked. The same with --no-input.
project dflt git
exec sh -c 'echo "{}" > package.json'
exec devvm setup --agents codex
exec devvm --network open --no-git-protect --no-input
stdout '^==> new_vm_summary vm=devvm-dflt-[0-9a-f]{14}\nnew_vm_toolchain_for file=package.json tool=node\nnew_vm_agent_from agent=codex from=devvm setup\nnew_vm_layers_none\n'
stdout -count=1 new_vm_summary
stdout '^new_vm_choose$'
! stderr new_vm_customize
vm_name DFLT dflt
vm_state $DFLT_dir/vm.json
stdout '^image=base$'
stdout '^tools.names=node codex$'
# Each flag is the exact list for its part, none for none, and the rest
# keep their defaults.
project flags git
exec sh -c 'echo "{}" > package.json'
exec devvm --network open --no-git-protect --tools go --agents none
stdout '^new_vm_toolchain_from from=--tools tool=go\nnew_vm_agents_none\nnew_vm_layers_none\n'
vm_name FLAGS flags
vm_state $FLAGS_dir/vm.json
stdout '^image=base$'
stdout '^tools.names=go$'
project nonetools git
exec sh -c 'echo "{}" > package.json'
exec devvm --network open --no-git-protect --tools none
stdout '^new_vm_toolchains_none\nnew_vm_agent_from agent=codex from=devvm setup\nnew_vm_layers_none\n'