mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 13:18:53 +00:00
gokrazy/natlab: update gokrazy, wire up natlab tests to GitHub CI
Updates #13038 Change-Id: I610f9076816f44d59c0ca405a1b4f5eb4c6c0594 Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:

committed by
Brad Fitzpatrick

parent
3e18434595
commit
5eafce7e25
@@ -32,6 +32,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
runVMTests = flag.Bool("run-vm-tests", false, "run tests that require a VM")
|
||||
logTailscaled = flag.Bool("log-tailscaled", false, "log tailscaled output")
|
||||
pcapFile = flag.String("pcap", "", "write pcap to file")
|
||||
)
|
||||
@@ -59,8 +60,25 @@ func newNatTest(tb testing.TB) *natTest {
|
||||
base: filepath.Join(modRoot, "gokrazy/natlabapp.qcow2"),
|
||||
}
|
||||
|
||||
if !*runVMTests {
|
||||
tb.Skip("skipping heavy test; set --run-vm-tests to run")
|
||||
}
|
||||
|
||||
if _, err := os.Stat(nt.base); err != nil {
|
||||
tb.Skipf("skipping test; base image %q not found", nt.base)
|
||||
if !os.IsNotExist(err) {
|
||||
tb.Fatal(err)
|
||||
}
|
||||
tb.Logf("building VM image...")
|
||||
cmd := exec.Command("make", "natlab")
|
||||
cmd.Dir = filepath.Join(modRoot, "gokrazy")
|
||||
cmd.Stderr = os.Stderr
|
||||
cmd.Stdout = os.Stdout
|
||||
if err := cmd.Run(); err != nil {
|
||||
tb.Fatalf("Error running 'make natlab' in gokrazy directory")
|
||||
}
|
||||
if _, err := os.Stat(nt.base); err != nil {
|
||||
tb.Skipf("still can't find VM image: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
nt.kernel, err = findKernelPath(filepath.Join(modRoot, "gokrazy/natlabapp/builddir/github.com/tailscale/gokrazy-kernel/go.mod"))
|
||||
|
Reference in New Issue
Block a user