summaryrefslogtreecommitdiff
path: root/test/run.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2012-11-07 12:33:54 -0800
committerIan Lance Taylor <iant@golang.org>2012-11-07 12:33:54 -0800
commit5a4efa4e2730cd0417e36d714d14ac8bafd89575 (patch)
tree8ae049319683ea4ff71d9a4a48c847c56e5ca413 /test/run.go
parent602f3b6323d1aac28250492e35668322479f3db8 (diff)
downloadgo-5a4efa4e2730cd0417e36d714d14ac8bafd89575.tar.gz
test: run index test by default
Running this test via "bash run" uncovered three different bugs (4344, 4348, 4353). We need to run it by default. R=golang-dev, rsc CC=golang-dev http://codereview.appspot.com/6832043
Diffstat (limited to 'test/run.go')
-rw-r--r--test/run.go38
1 files changed, 34 insertions, 4 deletions
diff --git a/test/run.go b/test/run.go
index 6b881eb1f..2b874d7df 100644
--- a/test/run.go
+++ b/test/run.go
@@ -128,7 +128,7 @@ func main() {
if !*verbose && test.err == nil {
continue
}
- fmt.Printf("%-10s %-20s: %s\n", test.action, test.goFileName(), errStr)
+ fmt.Printf("%-20s %-20s: %s\n", test.action, test.goFileName(), errStr)
}
if *summary {
@@ -198,7 +198,7 @@ type test struct {
donec chan bool // closed when done
src string
- action string // "compile", "build", "run", "errorcheck", "skip", "runoutput", "compiledir"
+ action string // "compile", "build", etc.
tempDir string
err error
@@ -300,7 +300,7 @@ func (t *test) run() {
fallthrough
case "compile", "compiledir", "build", "run", "runoutput", "rundir":
t.action = action
- case "errorcheck", "errorcheckdir":
+ case "errorcheck", "errorcheckdir", "errorcheckoutput":
t.action = action
wantError = true
for len(args) > 0 && strings.HasPrefix(args[0], "-") {
@@ -467,7 +467,7 @@ func (t *test) run() {
case "runoutput":
useTmp = false
- out, err := runcmd("go", "run", t.goFileName())
+ out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
if err != nil {
t.err = err
}
@@ -484,6 +484,36 @@ func (t *test) run() {
if string(out) != t.expectedOutput() {
t.err = fmt.Errorf("incorrect output\n%s", out)
}
+
+ case "errorcheckoutput":
+ useTmp = false
+ out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ if err != nil {
+ t.err = err
+ }
+ tfile := filepath.Join(t.tempDir, "tmp__.go")
+ err = ioutil.WriteFile(tfile, out, 0666)
+ if err != nil {
+ t.err = fmt.Errorf("write tempfile:%s", err)
+ return
+ }
+ cmdline := []string{"go", "tool", gc, "-e", "-o", "a." + letter}
+ cmdline = append(cmdline, flags...)
+ cmdline = append(cmdline, tfile)
+ out, err = runcmd(cmdline...)
+ if wantError {
+ if err == nil {
+ t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
+ return
+ }
+ } else {
+ if err != nil {
+ t.err = err
+ return
+ }
+ }
+ t.err = t.errorCheck(string(out), tfile, "tmp__.go")
+ return
}
}