Files
w3cjandClaude Opus 5.5 ddbc377f8f test: testscript commands for the scripts' setup, and a coverage baseline per package
script_test.go's sandbox sets DEVVM_MESSAGES=names and DATA, VMS, RUN
and CFG by default, and adds stub_reset, catg (the one file a glob
matches), vm_name VAR NAME (the folder's VM) and project NAME [git];
script_cmds.txtar checks each. Every script is rewritten onto them, its
assertions kept; TestCommandLines leaves the scripts' own commands out.

mise run test runs scripts/test.sh: the tests as before, with the CLI
tests' devvm built with -cover for every package (CLI_GOCOVERDIR),
merged with the Go tests' counters by go tool covdata, then
scripts/coverage.sh holds each package to testdata/coverage/<os>.txt.
mise run coverage raises the baselines; coverage.txtar checks the
comparison. The macOS baseline is recorded from this tree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 14:25:09 -07:00

44 lines
2.1 KiB
Plaintext

# gc --history: the exports devvm history export and devvm rm saved, never
# part of gc's default run; with --older-than, only those that old, each
# with the file beside it that names its folder. Only files named as devvm
# names them: never an export being written, nor anything else in the
# folder. Never a VM.
env EXPORTS=$XDG_DATA_HOME/devvm/exports
mkdir $EXPORTS
exec sh -c 'cd "$EXPORTS" && for f in devvm-old-12345612345612-20200101-000000 devvm-new-abcdefabcdefab-20991231-235959; do echo x > $f.tar.gz; echo /p > $f.folder; done'
exec sh -c 'cd "$EXPORTS" && echo x > .devvm-export-123 && echo x > notes.tar.gz && mkdir devvm-dir-12345612345612-20200101-000000.tar.gz'
# The default run keeps them.
exec devvm gc --force
stdout '^==> nothing_to_clean$'
exists $EXPORTS/devvm-old-12345612345612-20200101-000000.tar.gz
# An age only with --history, and only one devvm takes.
! exec devvm gc --force --older-than 30d
stderr '^devvm: gc_older_than_needs_history$'
! exec devvm gc --force --history --older-than 30
stderr '^devvm: bad_duration value=30$'
! exec devvm gc --force --history --older-than forever
stderr '^devvm: bad_duration value=forever$'
# --older-than 30d: the old one, by its VM and date.
exec devvm gc --force --history --older-than 30d
stdout '^gc_history count=1 size=\S+$'
stdout '^gc_history_export date=2020-01-01 00:00 size=\S+ vm=devvm-old-12345612345612$'
stdout '^==> deleted_history count=1$'
! exists $EXPORTS/devvm-old-12345612345612-20200101-000000.tar.gz
! exists $EXPORTS/devvm-old-12345612345612-20200101-000000.folder
exists $EXPORTS/devvm-new-abcdefabcdefab-20991231-235959.tar.gz
exists $EXPORTS/devvm-new-abcdefabcdefab-20991231-235959.folder
# --history: every one left, and nothing that isn't one.
exec devvm gc --force --history
stdout '^gc_history_export .* vm=devvm-new-abcdefabcdefab$'
stdout '^==> deleted_history count=1$'
! exists $EXPORTS/devvm-new-abcdefabcdefab-20991231-235959.tar.gz
! exists $EXPORTS/devvm-new-abcdefabcdefab-20991231-235959.folder
exists $EXPORTS/.devvm-export-123
exists $EXPORTS/notes.tar.gz
exists $EXPORTS/devvm-dir-12345612345612-20200101-000000.tar.gz