diff options
-rw-r--r-- | test/fixedbugs/bug088.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug106.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug282.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug306.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug377.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug396.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug404.go | 2 | ||||
-rw-r--r-- | test/fixedbugs/bug407.go | 2 | ||||
-rw-r--r-- | test/run.go | 23 | ||||
-rw-r--r-- | test/testlib | 7 |
10 files changed, 37 insertions, 9 deletions
diff --git a/test/fixedbugs/bug088.go b/test/fixedbugs/bug088.go index 9715a703c..3b99da84d 100644 --- a/test/fixedbugs/bug088.go +++ b/test/fixedbugs/bug088.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go || echo BUG: fails incorrectly +// compiledir // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug106.go b/test/fixedbugs/bug106.go index 1874b2044..3b99da84d 100644 --- a/test/fixedbugs/bug106.go +++ b/test/fixedbugs/bug106.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/bug0.go && $G $D/$F.dir/bug1.go || echo BUG: failed to compile +// compiledir // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug282.go b/test/fixedbugs/bug282.go index 463f21e94..3b99da84d 100644 --- a/test/fixedbugs/bug282.go +++ b/test/fixedbugs/bug282.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/p1.go && $G $D/$F.dir/p2.go +// compiledir // Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug306.go b/test/fixedbugs/bug306.go index a0a43507d..e8967c25d 100644 --- a/test/fixedbugs/bug306.go +++ b/test/fixedbugs/bug306.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/p1.go && $G $D/$F.dir/p2.go +// compiledir // Copyright 2010 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug377.go b/test/fixedbugs/bug377.go index e905e34d6..22df005b2 100644 --- a/test/fixedbugs/bug377.go +++ b/test/fixedbugs/bug377.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go +// compiledir // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug396.go b/test/fixedbugs/bug396.go index 50af6006f..48b79e01b 100644 --- a/test/fixedbugs/bug396.go +++ b/test/fixedbugs/bug396.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go +// compiledir // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug404.go b/test/fixedbugs/bug404.go index ac9e575bb..481acda32 100644 --- a/test/fixedbugs/bug404.go +++ b/test/fixedbugs/bug404.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go +// compiledir // Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/fixedbugs/bug407.go b/test/fixedbugs/bug407.go index 50af6006f..48b79e01b 100644 --- a/test/fixedbugs/bug407.go +++ b/test/fixedbugs/bug407.go @@ -1,4 +1,4 @@ -// $G $D/$F.dir/one.go && $G $D/$F.dir/two.go +// compiledir // Copyright 2011 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style diff --git a/test/run.go b/test/run.go index 198863eab..e1d97e9ee 100644 --- a/test/run.go +++ b/test/run.go @@ -216,6 +216,10 @@ func (t *test) goFileName() string { return filepath.Join(t.dir, t.gofile) } +func (t *test) goDirName() string { + return filepath.Join(t.dir, strings.Replace(t.gofile, ".go", ".dir", -1)) +} + // run runs a test. func (t *test) run() { defer close(t.donec) @@ -251,7 +255,7 @@ func (t *test) run() { case "cmpout": action = "run" // the run case already looks for <dir>/<test>.out files fallthrough - case "compile", "build", "run", "errorcheck", "runoutput": + case "compile", "compiledir", "build", "run", "errorcheck", "runoutput": t.action = action case "skip": t.action = "skip" @@ -301,6 +305,23 @@ func (t *test) run() { t.err = fmt.Errorf("%s\n%s", err, out) } + case "compiledir": + // Compile all files in the directory in lexicographic order. + longdir := filepath.Join(cwd, t.goDirName()) + files, dirErr := ioutil.ReadDir(longdir) + if dirErr != nil { + t.err = dirErr + return + } + for _, gofile := range files { + afile := strings.Replace(gofile.Name(), ".go", "."+letter, -1) + out, err := runcmd("go", "tool", gc, "-e", "-o", afile, filepath.Join(longdir, gofile.Name())) + if err != nil { + t.err = fmt.Errorf("%s\n%s", err, out) + break + } + } + case "build": out, err := runcmd("go", "build", "-o", "a.exe", long) if err != nil { diff --git a/test/testlib b/test/testlib index 9e0911526..84cda7b37 100644 --- a/test/testlib +++ b/test/testlib @@ -9,6 +9,13 @@ compile() { $G $D/$F.go } +compiledir() { + for gofile in $D/$F.dir/*.go + do + $G ${gofile} || return 1 + done +} + build() { $G $D/$F.go && $L $F.$A } |