mirror of
https://github.com/tailscale/tailscale.git
synced 2026-05-05 20:26:47 +02:00
tstest/linuxdeps: add test to reject gvisor.dev/gvisor/pkg/hostarch
Updates #TODO Signed-off-by: James Tucker <james@tailscale.com>
This commit is contained in:
parent
bec9815f02
commit
1e57a1b5c2
5
tstest/linuxdeps/linuxdeps.go
Normal file
5
tstest/linuxdeps/linuxdeps.go
Normal file
@ -0,0 +1,5 @@
|
||||
package linuxdeps
|
||||
|
||||
import (
|
||||
_ "tailscale.com/util/linuxfw"
|
||||
)
|
||||
30
tstest/linuxdeps/linuxdeps_test.go
Normal file
30
tstest/linuxdeps/linuxdeps_test.go
Normal file
@ -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))
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user