| 1 | package agentvm |
| 2 | |
| 3 | import ( |
| 4 | "os/exec" |
| 5 | "runtime" |
| 6 | "testing" |
| 7 | ) |
| 8 | |
| 9 | |
| 10 | func TestSetupScript(t *testing.T) { |
| 11 | runScript(t, "tests/setup-script.sh") |
| 12 | } |
| 13 | |
| 14 | |
| 15 | |
| 16 | func TestInstaller(t *testing.T) { |
| 17 | runScript(t, "tests/installer.sh") |
| 18 | } |
| 19 | |
| 20 | func runScript(t *testing.T, script string) { |
| 21 | t.Helper() |
| 22 | if runtime.GOOS == "windows" { |
| 23 | t.Skip("runs in a Linux guest, or on macOS and Linux") |
| 24 | } |
| 25 | bash, err := exec.LookPath("bash") |
| 26 | if err != nil { |
| 27 | t.Skip("no bash") |
| 28 | } |
| 29 | out, err := exec.Command(bash, script).CombinedOutput() |
| 30 | if err != nil { |
| 31 | t.Errorf("%v\n%s", err, out) |
| 32 | } |
| 33 | } |