浏览文件
main_test.go
26 行 · 617 B历史下载| 1 | package vm |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "runtime" |
| 6 | "testing" |
| 7 | |
| 8 | limaversion "github.com/lima-vm/lima/v2/pkg/version" |
| 9 | |
| 10 | "github.com/sylvinus/agent-vm/internal/limaembed" |
| 11 | ) |
| 12 | |
| 13 | // Lima starts its hostagent as this executable: the test binary, here. |
| 14 | // It is not stamped with Lima's version, as the Makefile's builds are. |
| 15 | func TestMain(m *testing.M) { |
| 16 | limaversion.Version = "v2.3.0-test" |
| 17 | // macOS's TMPDIR (/var/folders/...) is too long for Lima's socket |
| 18 | // paths (104 bytes); real Lima homes are short. |
| 19 | if runtime.GOOS == "darwin" { |
| 20 | os.Setenv("TMPDIR", "/tmp") |
| 21 | } |
| 22 | if limaembed.Run(os.Args[1:]) { |
| 23 | return |
| 24 | } |
| 25 | os.Exit(m.Run()) |
| 26 | } |

