diff options
| author | James Tucker <james@tailscale.com> | 2023-07-20 12:34:10 -0700 |
|---|---|---|
| committer | James Tucker <james@tailscale.com> | 2023-07-20 12:34:10 -0700 |
| commit | 1e57a1b5c2b0b59b88dd14aa1ef2d854477d263b (patch) | |
| tree | 242e0b099e40162a278bb71dd0b7a6d9b6cda5c2 | |
| parent | bec9815f028a06311ea0ed28eb9ae98c167c1a9c (diff) | |
| download | tailscale-raggi/gvisor-hostarch-deptest.tar.xz tailscale-raggi/gvisor-hostarch-deptest.zip | |
tstest/linuxdeps: add test to reject gvisor.dev/gvisor/pkg/hostarchraggi/gvisor-hostarch-deptest
Updates #TODO
Signed-off-by: James Tucker <james@tailscale.com>
| -rw-r--r-- | tstest/linuxdeps/linuxdeps.go | 5 | ||||
| -rw-r--r-- | tstest/linuxdeps/linuxdeps_test.go | 30 |
2 files changed, 35 insertions, 0 deletions
diff --git a/tstest/linuxdeps/linuxdeps.go b/tstest/linuxdeps/linuxdeps.go new file mode 100644 index 000000000..9a43f3762 --- /dev/null +++ b/tstest/linuxdeps/linuxdeps.go @@ -0,0 +1,5 @@ +package linuxdeps + +import ( + _ "tailscale.com/util/linuxfw" +) diff --git a/tstest/linuxdeps/linuxdeps_test.go b/tstest/linuxdeps/linuxdeps_test.go new file mode 100644 index 000000000..5dbaf2b8c --- /dev/null +++ b/tstest/linuxdeps/linuxdeps_test.go @@ -0,0 +1,30 @@ +package linuxdeps + +import ( + "encoding/json" + "os" + "os/exec" + "testing" +) + +func TestDeps(t *testing.T) { + cmd := exec.Command("go", "list", "-json", ".") + cmd.Env = append(os.Environ(), "GOOS=linux", "GOARCH=arm64") + out, err := cmd.Output() + if err != nil { + t.Fatal(err) + } + var res struct { + Deps []string + } + if err := json.Unmarshal(out, &res); err != nil { + t.Fatal(err) + } + for _, dep := range res.Deps { + switch dep { + case "gvisor.dev/gvisor/pkg/hostarch": + t.Errorf("package %q is not allowed as a dependency on Linux (due to lack of support for >4K pages)", dep) + } + } + t.Logf("got %d dependencies", len(res.Deps)) +} |
