PR 64683 reports that sometimes the memory profiler test fails because
it expects that a large value will have been garbage collected.  Since
gccgo's garbage collection is not (yet) precise, this may not happen.
This patch lets the test pass even if the object is not collected.
Ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff -r 07baa07598ea libgo/go/runtime/pprof/mprof_test.go
--- a/libgo/go/runtime/pprof/mprof_test.go      Mon Jan 19 20:17:51 2015 -0800
+++ b/libgo/go/runtime/pprof/mprof_test.go      Tue Jan 20 08:08:36 2015 -0800
@@ -85,10 +85,12 @@
 #      0x[0-9,a-f]+    runtime_pprof_test\.TestMemoryProfiler\+0x[0-9,a-f]+    
.*/mprof_test.go:64
 `, (1<<10)*memoryProfilerRun, (1<<20)*memoryProfilerRun),
 
-               fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f x]+
+               // This should start with "0: 0" but gccgo's imprecise
+               // GC means that sometimes the value is not collected.
+               fmt.Sprintf(`(0|%v): (0|%v) \[%v: %v\] @ 0x[0-9,a-f x]+
 #      0x[0-9,a-f]+    pprof_test\.allocateTransient2M\+0x[0-9,a-f]+   
.*/mprof_test.go:30
 #      0x[0-9,a-f]+    runtime_pprof_test\.TestMemoryProfiler\+0x[0-9,a-f]+    
.*/mprof_test.go:65
-`, memoryProfilerRun, (2<<20)*memoryProfilerRun),
+`, memoryProfilerRun, (2<<20)*memoryProfilerRun, memoryProfilerRun, 
(2<<20)*memoryProfilerRun),
        }
 
        for _, test := range tests {

Reply via email to