aboutsummaryrefslogtreecommitdiff
path: root/src/internal/testenv/testenv.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal/testenv/testenv.go')
-rw-r--r--src/internal/testenv/testenv.go44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/internal/testenv/testenv.go b/src/internal/testenv/testenv.go
index cfb033b2a2..0ee6355ee3 100644
--- a/src/internal/testenv/testenv.go
+++ b/src/internal/testenv/testenv.go
@@ -43,12 +43,8 @@ func HasGoBuild() bool {
return false
}
switch runtime.GOOS {
- case "android", "js":
+ case "android", "js", "ios":
return false
- case "darwin", "ios":
- if runtime.GOARCH == "arm64" {
- return false
- }
}
return true
}
@@ -122,12 +118,8 @@ func GoTool() (string, error) {
// using os.StartProcess or (more commonly) exec.Command.
func HasExec() bool {
switch runtime.GOOS {
- case "js":
+ case "js", "ios":
return false
- case "darwin", "ios":
- if runtime.GOARCH == "arm64" {
- return false
- }
}
return true
}
@@ -135,10 +127,8 @@ func HasExec() bool {
// HasSrc reports whether the entire source tree is available under GOROOT.
func HasSrc() bool {
switch runtime.GOOS {
- case "darwin", "ios":
- if runtime.GOARCH == "arm64" {
- return false
- }
+ case "ios":
+ return false
}
return true
}
@@ -202,6 +192,32 @@ func MustHaveCGO(t testing.TB) {
}
}
+// CanInternalLink reports whether the current system can link programs with
+// internal linking.
+// (This is the opposite of cmd/internal/sys.MustLinkExternal. Keep them in sync.)
+func CanInternalLink() bool {
+ switch runtime.GOOS {
+ case "android":
+ if runtime.GOARCH != "arm64" {
+ return false
+ }
+ case "darwin", "ios":
+ if runtime.GOARCH == "arm64" {
+ return false
+ }
+ }
+ return true
+}
+
+// MustInternalLink checks that the current system can link programs with internal
+// linking.
+// If not, MustInternalLink calls t.Skip with an explanation.
+func MustInternalLink(t testing.TB) {
+ if !CanInternalLink() {
+ t.Skipf("skipping test: internal linking on %s/%s is not supported", runtime.GOOS, runtime.GOARCH)
+ }
+}
+
// HasSymlink reports whether the current system can use os.Symlink.
func HasSymlink() bool {
ok, _ := hasSymlink()