libgo: fix spurious test failure in libgo/runtime/pprof

Message ID mvmin4jpoog.fsf@suse.de
State New
Headers show
Series
  • libgo: fix spurious test failure in libgo/runtime/pprof
Related show

Commit Message

Andreas Schwab Aug. 9, 2018, 3:03 p.m.
TestMemoryProfiler uses a too restrictive pattern that fails to match
backtraces that contain two tabs after the function address.  That can
happen when the formatted addresses are of different length:

		0: 0 [1: 2097152] @ 0x1746c 0x134a00 0x13450e 0x134fd8 0x84396 0x84892 0x17526 0x17628 0xf863a 0xbe3d8
		#	0x1746b		pprof.allocateReflectTransient+0x21	/suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:48
		#	0x1349ff	ffi_call_asm+0x51			../../../gcc/libffi/src/riscv/sysv.S:124
		#	0x13450d	ffi_call_int+0xf7			../../../gcc/libffi/src/riscv/ffi.c:372
		#	0x134fd7	reflect.call+0xab			../../../gcc/libgo/runtime/go-reflect-call.c:232
		#	0x84395		reflect.Value.call+0x58d		../../../gcc/libgo/go/reflect/value.go:458
		#	0x84891		reflect.Value.Call+0x4b			../../../gcc/libgo/go/reflect/value.go:306
		#	0x17525		pprof.allocateReflect+0x4b		/suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:53
		#	0x17627		runtime_pprof.TestMemoryProfiler+0xf7	/suse/schwab/src/gcc/n-riscv64/riscv64-suse-linux/libgo/gotest32110/test/mprof_test.go:75
		#	0xf8639		testing.tRunner+0x89			../../../gcc/libgo/go/testing/testing.go:777

Andreas.

Comments

Ian Lance Taylor Aug. 9, 2018, 5:50 p.m. | #1
On Thu, Aug 9, 2018 at 8:03 AM, Andreas Schwab <schwab@suse.de> wrote:
> TestMemoryProfiler uses a too restrictive pattern that fails to match
> backtraces that contain two tabs after the function address.  That can
> happen when the formatted addresses are of different length:

Your patch seems to be whitespace only and to be honest I'm not sure
exactly what changed.  Would it be possible to send it as an
attachment?

Ian
Andreas Schwab Aug. 13, 2018, 7:44 a.m. | #2
On Aug 09 2018, Ian Lance Taylor <iant@golang.org> wrote:

> On Thu, Aug 9, 2018 at 8:03 AM, Andreas Schwab <schwab@suse.de> wrote:
>> TestMemoryProfiler uses a too restrictive pattern that fails to match
>> backtraces that contain two tabs after the function address.  That can
>> happen when the formatted addresses are of different length:
>
> Your patch seems to be whitespace only

Nope, look closer.

Andreas.

Patch

diff --git a/libgo/go/runtime/pprof/mprof_test.go b/libgo/go/runtime/pprof/mprof_test.go
index 5d77a1d898..ffa0591de2 100644
--- a/libgo/go/runtime/pprof/mprof_test.go
+++ b/libgo/go/runtime/pprof/mprof_test.go
@@ -86,26 +86,26 @@  func TestMemoryProfiler(t *testing.T) {
 	tests := []string{
 
 		fmt.Sprintf(`%v: %v \[%v: %v\] @ 0x[0-9,a-f x]+
-#	0x[0-9,a-f]+	pprof\.allocatePersistent1K\+0x[0-9,a-f]+	.*/mprof_test\.go:40
-#	0x[0-9,a-f]+	runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test\.go:74
+#	0x[0-9,a-f]+	+pprof\.allocatePersistent1K\+0x[0-9,a-f]+	.*/mprof_test\.go:40
+#	0x[0-9,a-f]+	+runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test\.go:74
 `, 32*memoryProfilerRun, 1024*memoryProfilerRun, 32*memoryProfilerRun, 1024*memoryProfilerRun),
 
 		fmt.Sprintf(`0: 0 \[%v: %v\] @ 0x[0-9,a-f x]+
-#	0x[0-9,a-f]+	pprof\.allocateTransient1M\+0x[0-9,a-f]+	.*/mprof_test.go:21
-#	0x[0-9,a-f]+	runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test.go:72
+#	0x[0-9,a-f]+	+pprof\.allocateTransient1M\+0x[0-9,a-f]+	.*/mprof_test.go:21
+#	0x[0-9,a-f]+	+runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test.go:72
 `, (1<<10)*memoryProfilerRun, (1<<20)*memoryProfilerRun),
 
 		// 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\.allocateTransient2M\+0x[0-9,a-f]+	.*/mprof_test.go:27
-#	0x[0-9,a-f]+	runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test.go:73
+#	0x[0-9,a-f]+	+pprof\.allocateTransient2M\+0x[0-9,a-f]+	.*/mprof_test.go:27
+#	0x[0-9,a-f]+	+runtime_pprof\.TestMemoryProfiler\+0x[0-9,a-f]+	.*/mprof_test.go:73
 `, memoryProfilerRun, (2<<20)*memoryProfilerRun, memoryProfilerRun, (2<<20)*memoryProfilerRun),
 
 		// 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]+)+
-#	0x[0-9,a-f]+	pprof\.allocateReflectTransient\+0x[0-9,a-f]+	.*/mprof_test.go:48
+#	0x[0-9,a-f]+	+pprof\.allocateReflectTransient\+0x[0-9,a-f]+	.*/mprof_test.go:48
 `, memoryProfilerRun, (2<<20)*memoryProfilerRun, memoryProfilerRun, (2<<20)*memoryProfilerRun),
 	}