Files
w3cjandClaude Opus 5.5 ecd266c7d3 test(cli): one wait for the scripts; the docs release job installs only what it builds with
The scripts waited with copies of the same loop: desktop.txtar's and
nix_cache.txtar's waitfor files, and sh -c loops in link_life,
fixture_v010_links, fixture_v010_small, ports and ports_stopped, each
with its own interval and limit. They now use one testscript command,
wait_until SCRIPT, which runs sh -c SCRIPT every 100 ms until it
succeeds, for up to 90 s, and fails at once when every background
command has ended, as wait_file does, or when SCRIPT exits 100
(waitGiveUp, a status no tool the scripts run gives), as the links
check does when its session has ended. Contributing's tests page names
it beside wait_file, whose limit it now says is 60 s.

The docs workflow's release job installed every tool in the tag's
mise.toml. It now installs only Go, Hugo by the name the tag gives it
(hugo-extended before Hugo 0.170) and Node when the tag draws its
diagrams, with --locked as mise-action did, picking them with mise's
own reading of the tag's mise.toml (mise ls --current --json, the tag's
file alone), and fails when the tag names no Hugo. MISE_AUTO_INSTALL is
off for the job, so mise run docs:diagrams and the shims install
nothing more, and a tool the pick missed fails the build. This job runs
only at a release, so it hasn't run yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-18 23:07:04 -07:00

99 lines
3.8 KiB
Plaintext

# devvm desktop: the folder's VM launched as devvm host does (started when
# it's stopped, set up, in devvm's ssh config), its desktop layer's
# devvm-desktop started, clipboard off unless asked for, then its desktop
# served on this machine's 127.0.0.1 with the VM's password, both kept in
# its state, until Ctrl+C or the VM stops. A VM without the layer is
# refused, and on macOS Screen Sharing (a stub open) gets the address.
# No VM.
project plain
! exec devvm desktop
stderr '^devvm: no_vm dir=\S*/plain$'
# A VM without the desktop layer: refused, nothing served. base has no
# desktop: its build doesn't run the layer's script.
exec devvm --network open --no-git-protect
vm_name PLAIN plain
grep '^# Essentials, and mise' $STUB_DIR/scripts
! grep '^# desktop: ' $STUB_DIR/scripts
cp $WORK/no-layer $STUB_DIR/shell-fails-on
! exec devvm desktop --no-open
stderr '^devvm: desktop_no_layer vm=devvm-plain-[0-9a-f]{14}$'
! stdout desktop_ready
vm_state $PLAIN_dir/vm.json
! stdout '^(ports\.host\.desktop|desktop\.made\.password)='
rm $STUB_DIR/shell-fails-on
# --layers desktop: the VM's image is desktop, built on base by the
# layer's script.
project desk
exec devvm --network open --no-git-protect --layers desktop
stdout '^==> building_image image=desktop key=[0-9a-f]{12}$'
stdout '^==> creating_from image=desktop vm=devvm-desk-[0-9a-f]{14}$'
grep '^# desktop: a built-in layer' $STUB_DIR/scripts
vm_name DESK desk
vm_state $DESK_dir/vm.json
stdout '^image=desktop$'
# A stopped VM: started, its desktop started with the clipboard off, and
# served on a port of 127.0.0.1 until Ctrl+C.
exec limactl stop $DESK
stub_reset
! exec devvm desktop --no-open &d&
wait_until 'p=$(sed -n "s/^ *\"desktop\": \([0-9][0-9]*\).*/\1/p" "$DESK_dir/vm.json") && [ -n "$p" ] && nc -z 127.0.0.1 "$p"'
kill -INT d
wait d
stdout '^==> starting what=devvm-desk-[0-9a-f]{14}$'
stdout '^desktop_ready address=127\.0\.0\.1:[0-9]+ password=[a-z2-9]{8} vm=devvm-desk-[0-9a-f]{14}$'
stub_calls
stdout '^limactl start --tty=false devvm-desk-[0-9a-f]{14}$'
stdout 'exec ''/usr/local/bin/devvm-desktop'' ''start'' ''off''$'
! stdout '^open '
exec sh -c 'grep -E "\"desktop\": [0-9]|\"password\": " "$DESK_dir/vm.json"'
stdout '^ *"password": "[a-z2-9]{8}"$'
stdout '^ *"desktop": [0-9]+,?$'
cp stdout $WORK/state1
# A running VM, the clipboard asked for: the same password and port. On
# macOS, Screen Sharing gets the address; one that doesn't open is warned
# about.
stub_reset
! exec devvm desktop --clipboard &d&
wait_until 'nc -z 127.0.0.1 "$(sed -n "s/^ *\"desktop\": \([0-9][0-9]*\).*/\1/p" "$WORK/state1")"'
[darwin] wait_until 'grep -q "^open " "$STUB_LOG"'
kill -INT d
wait d
! stdout starting
stub_calls
stdout 'exec ''/usr/local/bin/devvm-desktop'' ''start'' ''on''$'
[darwin] stdout '^open vnc://127\.0\.0\.1:[0-9]+$'
[!darwin] ! stdout '^open '
exec sh -c 'grep -E "\"desktop\": [0-9]|\"password\": " "$DESK_dir/vm.json"'
cmp stdout $WORK/state1
[darwin] exec sh -c ': > "$STUB_DIR/open-fails" && : > "$STUB_LOG"'
[darwin] ! exec devvm desktop &d&
[darwin] wait_until 'grep -q "^open " "$STUB_LOG"'
[darwin] exec sleep 0.5
[darwin] kill -INT d
[darwin] wait d
[darwin] stderr '^devvm: desktop_open_failed url=vnc://127\.0\.0\.1:[0-9]+$'
[darwin] rm $STUB_DIR/open-fails
# The VM stops: so does devvm desktop, saying so.
exec devvm desktop --no-open &d&
wait_until 'nc -z 127.0.0.1 "$(sed -n "s/^ *\"desktop\": \([0-9][0-9]*\).*/\1/p" "$WORK/state1")"'
exec limactl stop $DESK
wait d
stdout '^==> desktop_vm_stopped vm=devvm-desk-[0-9a-f]{14}$'
# Its desktop doesn't start: said, with the run log.
cp $WORK/start-fails $STUB_DIR/shell-fails-on
! exec devvm desktop --no-open
stderr 'desktop_start_failed vm=devvm-desk-[0-9a-f]{14}'
rm $STUB_DIR/shell-fails-on
-- no-layer --
'test' '-x' '/usr/local/bin/devvm-desktop'
-- start-fails --
/usr/local/bin/devvm-desktop' 'start'