Files
devvm/tests/e2e/clone_linux_test.go
w3cjandClaude Opus 5.5 09f7f3b568 test(e2e): the Go end-to-end runner, tests/e2e, and its gc section
tests/e2e (build tag e2e) is the end-to-end runner in Go that takes over
tests/e2e.sh's sections one at a time. TestE2E is the run, with
tests/e2e.sh's options as flags (-e2e.only, -e2e.from, -e2e.clean,
-e2e.every-feature, -e2e.slots, -e2e.slot, -e2e.newest-base, -e2e.golden)
and its own -e2e.reuse. It keeps the sandbox (each slot's paths, Lima
home, XDG folders, Keychain service, ports +100 per slot, the lock),
devvm built from the checkout, config.toml and the pinned tool lock, the
host-tool check, the output lines (PASS/FAIL/SKIP/RETRY [n/N], times,
ETA), the heartbeat, each check's time limit (process groups: TERM, then
KILL), the timings files and the check-count guard (keyed by a checksum
of tests/e2e's Go files), the retry of checks marked Flaky, the slots'
plan, seeding (clonefile, reflinks) and summing, and the cleanup of only
what the run made.

Files: main_test.go (TestMain, TestE2E), options_test.go (flags),
sandbox_test.go, runner_test.go, check_test.go (S, Check, Skip, Flaky,
Builds, Tail, Needs), cmd_test.go (Run, Devvm, DevvmNames, Msg, Limactl,
InVM, Status), state_test.go (Paths: State, VMOf, VMDir, KeysOf, Record;
NewProject, Launch, Reuse, Layer, Own, Until, Settle, Port, Defer),
shared_test.go (Golden, GoE2E), slots_test.go, clone_{darwin,linux}_test.go,
sections_test.go (the table), gc_test.go (the gc section, its five check
titles tests/e2e.sh's word for word) and harness_test.go (TestHarness*,
no VM, run by scripts/test.sh).

tests/e2e.sh no longer has the gc block: after its own sections it hands
the chosen sections that go_sections lists to TestE2E in its sandbox and
under its lock, passing its pid, check count, expected total and start,
and adds the Go run's summary.go to its results. mise run e2e:go runs the
Go runner on its own. golangci-lint builds with the e2e tag; tests/e2e may
print, exit from TestMain, signal its own process groups, and run and read
its sandbox's commands and files.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-05 21:28:44 -07:00

21 lines
461 B
Go

//go:build e2e
package e2e
import (
"context"
"os"
"os/exec"
)
// cloneTree makes dst a reflink of src, a file or a folder, sharing its
// blocks: it fails where the file system can't (tmpfs, ext4), leaving no
// dst, never copying it whole.
func cloneTree(ctx context.Context, src, dst string) error {
if err := exec.CommandContext(ctx, "cp", "-a", "--reflink=always", src, dst).Run(); err != nil {
_ = os.RemoveAll(dst)
return err
}
return nil
}