mirror of
https://github.com/devvmhq/devvm.git
synced 2026-12-01 06:23:17 -10:00
- backend.Backend gains Problems(ctx) []Problem (Key, Fix, Msg): all that a backend needs and the host lacks. Check is the first of them, so every command that needs the backend stops at the first one. - Lima's Problems (check.go): host OS, arm64/amd64 (arch), macOS 13+ (macos, via sysctl kern.osproductversion: platform.MacOSVersion), Lima missing/broken/older than 2.0 (lima; brew install/reinstall/ upgrade lima when Homebrew is there), on Linux qemu-system-<arch> and qemu-img (qemu; apt-get, dnf, pacman or zypper's command), /dev/kvm missing (kvm) or not openable (kvm-access; sudo usermod -aG kvm USER), Lima's global configs (lima-config). DEVVM_KVM swaps /dev/kvm for tests. - devvm doctor [--backend NAME] [--fixes]: a features table (FEATURE, one column per backend: native, emulated, unreviewed, none; Support gains String), Docker found or not, then doctor_ok or each problem (the last one fails). --fixes prints KEY<tab>FIX<tab>MESSAGE lines and succeeds either way. - Messages: lima_missing_fix, lima_broken_fix, lima_old_fix, qemu_missing_fix, lima_arch_unsupported, macos_old, no_kvm, kvm_access, docker_found, docker_missing, doctor_ok, doctor_failed; kvm and ok are initialisms in the generator. - Tests: TestProblems (23 cases), TestWriteFeatures, TestWriteFixes, TestMacOSVersion, Support's String in TestSupport; doctor.txtar; the script sandbox sets DEVVM_KVM; e2e images checks doctor. - Converted: cli.bats preflight (arm64 and x86_64), doctor (macOS without Lima, Linux without QEMU, x86_64 Linux, limactl that doesn't run), the doctor half of "all there", doctor's half of the Lima global configs case. - Docs: new install.md (requirements, checking them, --fixes keys), lima.md requirements, backends.md, commands.md, contributing.md, README; CLI reference regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]>
22 lines
417 B
Go
22 lines
417 B
Go
package platform
|
|
|
|
import (
|
|
"regexp"
|
|
"runtime"
|
|
"testing"
|
|
)
|
|
|
|
func TestMacOSVersion(t *testing.T) {
|
|
v := MacOSVersion()
|
|
if runtime.GOOS != "darwin" {
|
|
if v != "" {
|
|
t.Errorf("MacOSVersion() = %q off macOS", v)
|
|
}
|
|
return
|
|
}
|
|
// Never 10.16, the version older programs are told for 11 and later.
|
|
if !regexp.MustCompile(`^(1[1-9]|[2-9][0-9])\.[0-9]+`).MatchString(v) {
|
|
t.Errorf("MacOSVersion() = %q", v)
|
|
}
|
|
}
|