summaryrefslogtreecommitdiff
path: root/libgo/go/path/path_test.go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2013-07-16 06:54:42 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2013-07-16 06:54:42 +0000
commitbe47d6eceffd2c5dbbc1566d5eea490527fb2bd4 (patch)
tree0e8fda573576bb4181dba29d0e88380a8c38fafd /libgo/go/path/path_test.go
parentefb30cdeb003fd7c585ee0d7657340086abcbd9e (diff)
libgo: Update to Go 1.1.1.
From-SVN: r200974
Diffstat (limited to 'libgo/go/path/path_test.go')
-rw-r--r--libgo/go/path/path_test.go27
1 files changed, 12 insertions, 15 deletions
diff --git a/libgo/go/path/path_test.go b/libgo/go/path/path_test.go
index 926b57355a0..62974401126 100644
--- a/libgo/go/path/path_test.go
+++ b/libgo/go/path/path_test.go
@@ -64,7 +64,6 @@ var cleantests = []PathTest{
}
func TestClean(t *testing.T) {
- defer runtime.GOMAXPROCS(runtime.GOMAXPROCS(1))
for _, test := range cleantests {
if s := Clean(test.path); s != test.result {
t.Errorf("Clean(%q) = %q, want %q", test.path, s, test.result)
@@ -74,22 +73,20 @@ func TestClean(t *testing.T) {
}
}
- var ms runtime.MemStats
- runtime.ReadMemStats(&ms)
- allocs := -ms.Mallocs
- const rounds = 100
- for i := 0; i < rounds; i++ {
- for _, test := range cleantests {
- Clean(test.result)
- }
+ if runtime.GOMAXPROCS(0) > 1 {
+ t.Log("skipping AllocsPerRun checks; GOMAXPROCS>1")
+ return
}
- runtime.ReadMemStats(&ms)
- allocs += ms.Mallocs
- /* Fails with gccgo, which has no escape analysis.
- if allocs >= rounds {
- t.Errorf("Clean cleaned paths: %d allocations per test round, want zero", allocs/rounds)
+
+ t.Log("Skipping AllocsPerRun for gccgo")
+ return
+
+ for _, test := range cleantests {
+ allocs := testing.AllocsPerRun(100, func() { Clean(test.result) })
+ if allocs > 0 {
+ t.Errorf("Clean(%q): %v allocs, want zero", test.result, allocs)
+ }
}
- */
}
type SplitTest struct {