summaryrefslogtreecommitdiff
path: root/test/run.go
diff options
context:
space:
mode:
authorShenghou Ma <minux.ma@gmail.com>2012-08-07 09:38:35 +0800
committerShenghou Ma <minux.ma@gmail.com>2012-08-07 09:38:35 +0800
commit4d10f82c2dd64ee05f9e8c5c6b07d82fbd3ff7fd (patch)
tree23d83699e51a3440709ac6768e539bc910a9a1ce /test/run.go
parent125038ed63faaecf5765f1bcff6d51c31f82fd2b (diff)
downloadgo-4d10f82c2dd64ee05f9e8c5c6b07d82fbd3ff7fd.tar.gz
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
Diffstat (limited to 'test/run.go')
-rw-r--r--test/run.go17
1 files changed, 12 insertions, 5 deletions
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 {