diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-16 23:05:44 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-03-16 23:05:44 +0000 |
commit | 31c6ec422702226aabab7d082da16663e6c3e72c (patch) | |
tree | 44176975832a3faf1626836e70c97d5edd674122 /libgo/go/testing/testing.go | |
parent | b3145af52cfb7c84d62a8e4ceeb165a7369718da (diff) | |
download | gcc-31c6ec422702226aabab7d082da16663e6c3e72c.tar.gz |
Update to current version of Go library (revision 94d654be2064).
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171076 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/testing/testing.go')
-rw-r--r-- | libgo/go/testing/testing.go | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/libgo/go/testing/testing.go b/libgo/go/testing/testing.go index 0e04935ce44..324b5a70e1f 100644 --- a/libgo/go/testing/testing.go +++ b/libgo/go/testing/testing.go @@ -12,7 +12,7 @@ // // Functions of the form // func BenchmarkXxx(*testing.B) -// are considered benchmarks, and are executed by gotest when the -benchmarks +// are considered benchmarks, and are executed by gotest when the -test.bench // flag is provided. // // A sample benchmark function looks like this: @@ -43,11 +43,12 @@ import ( "fmt" "os" "runtime" + "time" ) // Report as tests are run; default is silent for success. -var chatty = flag.Bool("v", false, "verbose: print additional output") -var match = flag.String("match", "", "regular expression to select tests to run") +var chatty = flag.Bool("test.v", false, "verbose: print additional output") +var match = flag.String("test.run", "", "regular expression to select tests to run") // Insert final newline if needed and tabs after internal newlines. @@ -91,7 +92,7 @@ func (t *T) FailNow() { // and records the text in the error log. func (t *T) Log(args ...interface{}) { t.errors += "\t" + tabify(fmt.Sprintln(args...)) } -// Log formats its arguments according to the format, analogous to Printf(), +// Logf formats its arguments according to the format, analogous to Printf(), // and records the text in the error log. func (t *T) Logf(format string, args ...interface{}) { t.errors += "\t" + tabify(fmt.Sprintf(format, args...)) @@ -144,7 +145,7 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe for i := 0; i < len(tests); i++ { matched, err := matchString(*match, tests[i].Name) if err != nil { - println("invalid regexp for -match:", err.String()) + println("invalid regexp for -test.run:", err.String()) os.Exit(1) } if !matched { @@ -153,16 +154,19 @@ func Main(matchString func(pat, str string) (bool, os.Error), tests []InternalTe if *chatty { println("=== RUN ", tests[i].Name) } + ns := -time.Nanoseconds() t := new(T) t.ch = make(chan *T) go tRunner(t, &tests[i]) <-t.ch + ns += time.Nanoseconds() + tstr := fmt.Sprintf("(%.1f seconds)", float64(ns)/1e9) if t.failed { - println("--- FAIL:", tests[i].Name) + println("--- FAIL:", tests[i].Name, tstr) print(t.errors) ok = false } else if *chatty { - println("--- PASS:", tests[i].Name) + println("--- PASS:", tests[i].Name, tstr) print(t.errors) } } |