From 4d10f82c2dd64ee05f9e8c5c6b07d82fbd3ff7fd Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Tue, 7 Aug 2012 09:38:35 +0800 Subject: misc/cgo/{life,stdio}, test/run.go: use test/run.go to do the cgo tests Enhances test/run.go to support testing other directories Will enable stdio tests on Windows in a follow-up CL. R=golang-dev, alex.brainman, rsc CC=golang-dev http://codereview.appspot.com/6220049 --- test/run.go | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'test/run.go') diff --git a/test/run.go b/test/run.go index e3c305690..325d2ea41 100644 --- a/test/run.go +++ b/test/run.go @@ -77,16 +77,23 @@ func main() { if flag.NArg() > 0 { for _, arg := range flag.Args() { if arg == "-" || arg == "--" { - // Permit running either: + // Permit running: // $ go run run.go - env.go // $ go run run.go -- env.go + // $ go run run.go - ./fixedbugs + // $ go run run.go -- ./fixedbugs continue } - if !strings.HasSuffix(arg, ".go") { - log.Fatalf("can't yet deal with non-go file %q", arg) + if fi, err := os.Stat(arg); err == nil && fi.IsDir() { + for _, baseGoFile := range goFiles(arg) { + tests = append(tests, startTest(arg, baseGoFile)) + } + } else if strings.HasSuffix(arg, ".go") { + dir, file := filepath.Split(arg) + tests = append(tests, startTest(dir, file)) + } else { + log.Fatalf("can't yet deal with non-directory and non-go file %q", arg) } - dir, file := filepath.Split(arg) - tests = append(tests, startTest(dir, file)) } } else { for _, dir := range dirs { -- cgit v1.2.1