diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-06 17:57:23 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-06 17:57:23 +0000 |
commit | 220a902afa4e096172926d498e1efac23e80deb7 (patch) | |
tree | 4ce83ca433796a728e9fdd00af105bce158532b5 /libgo/go/testing | |
parent | 506056fd6ecd06499e2ee7f6e37dbd5fbf7f4de6 (diff) | |
download | gcc-220a902afa4e096172926d498e1efac23e80deb7.tar.gz |
libgo: Update to weekly.2012-03-04 release.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185010 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/testing')
-rw-r--r-- | libgo/go/testing/example.go | 10 | ||||
-rw-r--r-- | libgo/go/testing/testing.go | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/libgo/go/testing/example.go b/libgo/go/testing/example.go index 7f8ff2d0541..671c798760b 100644 --- a/libgo/go/testing/example.go +++ b/libgo/go/testing/example.go @@ -19,7 +19,7 @@ type InternalExample struct { Output string } -func RunExamples(examples []InternalExample) (ok bool) { +func RunExamples(matchString func(pat, str string) (bool, error), examples []InternalExample) (ok bool) { ok = true var eg InternalExample @@ -27,6 +27,14 @@ func RunExamples(examples []InternalExample) (ok bool) { stdout, stderr := os.Stdout, os.Stderr for _, eg = range examples { + matched, err := matchString(*match, eg.Name) + if err != nil { + fmt.Fprintf(os.Stderr, "testing: invalid regexp for -test.run: %s\n", err) + os.Exit(1) + } + if !matched { + continue + } if *chatty { fmt.Printf("=== RUN: %s\n", eg.Name) } diff --git a/libgo/go/testing/testing.go b/libgo/go/testing/testing.go index adc8c09f217..477d2ac23ae 100644 --- a/libgo/go/testing/testing.go +++ b/libgo/go/testing/testing.go @@ -99,7 +99,7 @@ var ( // Report as tests are run; default is silent for success. chatty = flag.Bool("test.v", false, "verbose: print additional output") - match = flag.String("test.run", "", "regular expression to select tests to run") + match = flag.String("test.run", "", "regular expression to select tests and examples to run") memProfile = flag.String("test.memprofile", "", "write a memory profile to the named file after execution") memProfileRate = flag.Int("test.memprofilerate", 0, "if >=0, sets runtime.MemProfileRate") cpuProfile = flag.String("test.cpuprofile", "", "write a cpu profile to the named file during execution") @@ -280,7 +280,7 @@ func Main(matchString func(pat, str string) (bool, error), tests []InternalTest, before() startAlarm() testOk := RunTests(matchString, tests) - exampleOk := RunExamples(examples) + exampleOk := RunExamples(matchString, examples) if !testOk || !exampleOk { fmt.Println("FAIL") os.Exit(1) |