aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'internal/pkg')
-rw-r--r--internal/pkg/exec_test.go2
-rw-r--r--internal/pkg/testdata/main.go15
2 files changed, 16 insertions, 1 deletions
diff --git a/internal/pkg/exec_test.go b/internal/pkg/exec_test.go
index 1b2f84a8..5a14f786 100644
--- a/internal/pkg/exec_test.go
+++ b/internal/pkg/exec_test.go
@@ -1,6 +1,6 @@
package pkg_test
-//go:generate go build -tags testtool -ldflags "-extldflags='-static'" -o testdata/testtool ./testdata
+//go:generate env CGO_ENABLED=0 go build -tags testtool -o testdata/testtool ./testdata
import (
_ "embed"
diff --git a/internal/pkg/testdata/main.go b/internal/pkg/testdata/main.go
index 2a0144f3..257d748f 100644
--- a/internal/pkg/testdata/main.go
+++ b/internal/pkg/testdata/main.go
@@ -3,10 +3,13 @@
package main
import (
+ "errors"
"log"
+ "net"
"os"
"path"
"slices"
+ "syscall"
"hakurei.app/container/fhs"
"hakurei.app/container/vfs"
@@ -67,6 +70,18 @@ func main() {
}
}
+ if _, err := net.Dial("tcp", "127.0.0.1:0"); err == nil {
+ log.Fatal("Dial unexpectedly succeeded")
+ } else if hostNet {
+ if !errors.Is(err, syscall.ECONNREFUSED) {
+ log.Fatalf("Dial: error = %v", err)
+ }
+ } else {
+ if !errors.Is(err, syscall.ENETUNREACH) {
+ log.Fatalf("Dial: error = %v", err)
+ }
+ }
+
log.Println(m)
if m.Root != "/sysroot" || m.Target != "/" {
log.Fatal("unexpected root mount entry")