aboutsummaryrefslogtreecommitdiff
path: root/test/nosplit.go
diff options
context:
space:
mode:
authorAustin Clements <austin@google.com>2014-10-22 15:51:54 -0400
committerAustin Clements <austin@google.com>2014-10-22 15:51:54 -0400
commitf0bd539c594ab4acfdaded45625a89a13d0bd575 (patch)
treeb9881e97ee8064251e5c94fbd544ee59b2d40abd /test/nosplit.go
parent977fba763a5e45e5527e45619ed0712ca09d910d (diff)
parentaf3868f1879c7f8bef1a4ac43cfe1ab1304ad6a4 (diff)
downloadgo-f0bd539c594ab4acfdaded45625a89a13d0bd575.tar.gz
go-f0bd539c594ab4acfdaded45625a89a13d0bd575.zip
[dev.power64] all: merge default into dev.power64
This brings dev.power64 up-to-date with the current tip of default. go_bootstrap is still panicking with a bad defer when initializing the runtime (even on amd64). LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/152570049
Diffstat (limited to 'test/nosplit.go')
-rw-r--r--test/nosplit.go13
1 files changed, 11 insertions, 2 deletions
diff --git a/test/nosplit.go b/test/nosplit.go
index 8dab2fc7a7..3a63e8731d 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -12,6 +12,7 @@ import (
"bytes"
"fmt"
"io/ioutil"
+ "log"
"os"
"os/exec"
"path/filepath"
@@ -191,7 +192,6 @@ func main() {
return
}
defer os.RemoveAll(dir)
- ioutil.WriteFile(filepath.Join(dir, "main.go"), []byte("package main\nfunc main()\n"), 0666)
tests = strings.Replace(tests, "\t", " ", -1)
tests = commentRE.ReplaceAllString(tests, "")
@@ -231,6 +231,9 @@ TestCases:
continue
}
+ var gobuf bytes.Buffer
+ fmt.Fprintf(&gobuf, "package main\n")
+
var buf bytes.Buffer
ptrSize := 4
switch goarch {
@@ -286,11 +289,17 @@ TestCases:
body = callRE.ReplaceAllString(body, "CALL ·$1(SB);")
body = callindRE.ReplaceAllString(body, "CALL REGISTER;")
+ fmt.Fprintf(&gobuf, "func %s()\n", name)
fmt.Fprintf(&buf, "TEXT ·%s(SB)%s,$%d-0\n\t%s\n\tRET\n\n", name, nosplit, size, body)
}
}
- ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666)
+ if err := ioutil.WriteFile(filepath.Join(dir, "asm.s"), buf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
+ if err := ioutil.WriteFile(filepath.Join(dir, "main.go"), gobuf.Bytes(), 0666); err != nil {
+ log.Fatal(err)
+ }
cmd := exec.Command("go", "build")
cmd.Dir = dir