# ls: project VMs, by name, with their status, image, shared tools, .git # protection, network policy, links and folder. Images and build VMs # aren't listed; a project VM named like an image is. # No VMs: the header alone, and nothing is asked of Lima but its list. exec devvm ls cmp stdout header.txt ! stderr . stub_calls stdout '^limactl list --json\n\z' # A folder named img-foo gives a VM named like an image: listed, while # the image it was made from isn't. No network policy: its tier, open. project img-foo exec devvm --network open --no-git-protect exec devvm ls stdout '^NAME +STATUS +IMAGE +TOOLS +GIT +NET +LINKS +FOLDER\n' stdout '^devvm-img-foo-[0-9a-f]{14} +Running +base +- +off +open +- +/\S*/img-foo\n\z' ! stdout '^devvm-img-[0-9a-f]{12} ' # Network policy: its tier, allowlist, while it runs on the hostagent # devvm started (here the test's runner, which runs on); started some # other way since, or a failed self-check, unenforced. Stopped, it starts # confined next time. project net exec devvm --network allowlist --no-git-protect vm_name NET net exec sh -c 'echo $PPID > "$LIMA_HOME/$NET/ha.pid"; echo "$PPID 1" > "$NET_dir/run/started"' exec devvm ls stdout '^devvm-net-[0-9a-f]{14} +Running +base +- +off +allowlist +- +/' json_set $NET_dir/vm.json net.tier=none exec devvm ls stdout '^devvm-net-[0-9a-f]{14} +Running +base +- +off +none +- +/' json_set $NET_dir/vm.json net.tier=allowlist # (The exit keeps limactl start sh's child, so its hostagent is sh, soon # gone: bash 5.2 and newer as sh, Fedora's, runs a last command in sh's # place, which would make the runner, which lasts, its hostagent.) exec sh -c 'limactl stop "$NET" && limactl start --tty=false "$NET"; exit $?' exec devvm ls stdout '^devvm-net-[0-9a-f]{14} +Running +base +- +off +unenforced +- +/' exec limactl stop $NET exec devvm ls stdout '^devvm-net-[0-9a-f]{14} +Stopped +base +- +off +allowlist +- +/' json_set $NET_dir/vm.json net.made.check=unenforced exec devvm ls stdout '^devvm-net-[0-9a-f]{14} +Stopped +base +- +off +unenforced +- +/' # A --clone VM shows clone in GIT, a base from a container image its # label, and a VM whose creation didn't finish - for what it lacks. Their # folders, /p/..., are gone: (gone) after them, and folder_state gone in --json. mkdir $VMS/0123456789ab01 $VMS/0123456789ab02 cp $WORK/clone.json $VMS/0123456789ab01/vm.json cp $WORK/from.json $VMS/0123456789ab02/vm.json exec stub vm devvm-cl-0123456789ab01 Stopped exec stub vm devvm-from-0123456789ab02 Running exec stub vm devvm-half-0123456789ab03 Stopped exec stub vm devvm-tools-build Stopped exec devvm ls stdout '^devvm-cl-0123456789ab01 +Stopped +base +node,claude +clone +allowlist +- +/p/cl \(gone\)\n' stdout '^devvm-from-0123456789ab02 +Running +image_from from=node:24 image=base +- +on +open +- +/p/from \(gone\)\n' stdout '^devvm-half-0123456789ab03 +Stopped +- +- +- +- +- +-\n' ! stdout devvm-tools-build # Sorted by name. stdout '\ndevvm-cl-.*\ndevvm-from-.*\ndevvm-half-.*\ndevvm-img-foo-.*\ndevvm-net-' # --json: the same, the image and what its base started from apart, "" # for what a VM lacks, and nothing else on stdout. exec devvm ls --json stdout '^{\n "version": 1,\n "vms": \[\n' stdout '^ "name": "devvm-cl-0123456789ab01",\n "status": "Stopped",\n "image": "base",\n "tools": \[\n "node",\n "claude"\n \],\n' stdout '^ "name": "devvm-from-0123456789ab02",\n "status": "Running",\n "image": "base",\n "tools": \[\],\n "from": "node:24",\n "git": "on",\n "net": "open",\n "backend": "lima",\n "folder": "/p/from",\n "folder_state": "gone",\n "links": 0\n' stdout '^ "name": "devvm-half-0123456789ab03",\n "status": "Stopped",\n "image": "",\n "tools": \[\],\n "git": "",\n' ! stdout '^NAME' # A VM whose vm.json can't be read is a row of its own, its name and # status alone, with a warning naming the file; the rest are listed as # before. A folder's control characters never reach the terminal. mkdir $VMS/0123456789ab04 $VMS/0123456789ab05 cp $WORK/broken.json $VMS/0123456789ab04/vm.json cp $WORK/esc.json $VMS/0123456789ab05/vm.json exec stub vm devvm-bad-0123456789ab04 Running exec stub vm devvm-esc-0123456789ab05 Stopped exec devvm ls stdout '^devvm-bad-0123456789ab04 +Running +- +- +- +- +- +-\n' stdout '^devvm-cl-0123456789ab01 +Stopped ' stdout '^devvm-esc-0123456789ab05 +Stopped +base +- +on +open +- +/p/e\[2Jsc \(gone\)\n' ! stdout '\x1b' stderr '^devvm: vm_state_unreadable path=\S+/0123456789ab04/vm.json$' exec devvm ls --json stdout '"name": "devvm-bad-0123456789ab04",\n "status": "Running",\n "image": "",' rm $VMS/0123456789ab04 $VMS/0123456789ab05 # Lima can't list (not installed): fails, as a VM's state names it; with # none, the header alone. env PATH=$DEVVM_BIN ! exec devvm ls ! stdout . stderr '^devvm: program_missing name=Lima program=limactl$' rm $VMS exec devvm ls cmp stdout $WORK/header.txt exec devvm ls --json cmp stdout $WORK/none.json -- none.json -- { "version": 1, "vms": [] } -- header.txt -- NAME STATUS IMAGE TOOLS GIT NET LINKS FOLDER -- clone.json -- { "version": 1, "id": "0123456789abcdef0123456789abcd01", "name": "devvm-cl-0123456789ab01", "image": "base", "dir": "/p/cl", "backend": "lima", "created": "2026-01-01T00:00:00Z", "clone": {"on": true}, "git": {"mode": "clone"}, "net": {"tier": "allowlist"}, "tools": {"names": ["node", "claude"]} } -- broken.json -- {"version": 1, "name": "devvm-bad-0123456789ab04" -- esc.json -- { "version": 1, "id": "0123456789abcdef0123456789abcd05", "name": "devvm-esc-0123456789ab05", "image": "base", "dir": "/p/e\u001b[2Jsc", "backend": "lima", "created": "2026-01-01T00:00:00Z", "git": {"mode": "on"}, "net": {"tier": "open"} } -- from.json -- { "version": 1, "id": "0123456789abcdef0123456789abcd02", "name": "devvm-from-0123456789ab02", "image": "base", "from": "node:24", "dir": "/p/from", "backend": "lima", "created": "2026-01-01T00:00:00Z", "git": {"mode": "on"}, "net": {"tier": "open"} }