aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/link/internal/ld/stackcheck_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/link/internal/ld/stackcheck_test.go')
-rw-r--r--src/cmd/link/internal/ld/stackcheck_test.go19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/cmd/link/internal/ld/stackcheck_test.go b/src/cmd/link/internal/ld/stackcheck_test.go
index 21dbf2b3fd..2089badbe9 100644
--- a/src/cmd/link/internal/ld/stackcheck_test.go
+++ b/src/cmd/link/internal/ld/stackcheck_test.go
@@ -5,13 +5,12 @@
package ld
import (
- "cmd/internal/objabi"
- "cmd/internal/sys"
"fmt"
"internal/testenv"
"os"
"os/exec"
"regexp"
+ "strconv"
"testing"
)
@@ -24,7 +23,7 @@ func TestStackCheckOutput(t *testing.T) {
cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", os.DevNull, "./testdata/stackcheck")
// The rules for computing frame sizes on all of the
// architectures are complicated, so just do this on amd64.
- cmd.Env = append(os.Environ(), "GOARCH=amd64")
+ cmd.Env = append(os.Environ(), "GOARCH=amd64", "GOOS=linux")
outB, err := cmd.CombinedOutput()
if err == nil {
@@ -34,13 +33,13 @@ func TestStackCheckOutput(t *testing.T) {
t.Logf("linker output:\n%s", out)
- // Construct expected stanzas
- arch := sys.ArchAMD64
- call := 0
- if !arch.HasLR {
- call = arch.RegSize
+ // Get expected limit.
+ limitRe := regexp.MustCompile("nosplit stack over ([0-9]+) byte limit")
+ m := limitRe.FindStringSubmatch(out)
+ if m == nil {
+ t.Fatalf("no overflow errors in output")
}
- limit := objabi.StackLimit - call
+ limit, _ := strconv.Atoi(m[1])
wantMap := map[string]string{
"main.startSelf": fmt.Sprintf(
@@ -67,7 +66,7 @@ func TestStackCheckOutput(t *testing.T) {
}
// Parse stanzas
- stanza := regexp.MustCompile(`^(.*): nosplit stack overflow\n(.*\n(?: .*\n)*)`)
+ stanza := regexp.MustCompile(`^(.*): nosplit stack over [0-9]+ byte limit\n(.*\n(?: .*\n)*)`)
// Strip comments from cmd/go
out = regexp.MustCompile(`(?m)^#.*\n`).ReplaceAllString(out, "")
for len(out) > 0 {