From d7dbe0111ef2a6de80a20fef188db61d8fab5c96 Mon Sep 17 00:00:00 2001 From: doujiang24 Date: Thu, 29 Sep 2022 07:29:51 +0000 Subject: [PATCH] runtime/trace: skip tests if parsing fails with timestamp error already skips tests in case of the timestamp error, eg. #97757 Change-Id: Ia696e83cba2e3ed50181a8100b964847092a7365 GitHub-Last-Rev: 8e5f607e14f6a15ed6da5f205c4ca67a4adb6fc8 GitHub-Pull-Request: golang/go#55918 Reviewed-on: https://go-review.googlesource.com/c/go/+/435855 Reviewed-by: Michael Pratt Reviewed-by: Joel Sing TryBot-Result: Gopher Robot Reviewed-by: Dmitri Shuralyov Run-TryBot: Michael Pratt --- src/runtime/crash_cgo_test.go | 10 ++++++++-- src/runtime/testdata/testprogcgo/issue29707.go | 4 +++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/runtime/crash_cgo_test.go b/src/runtime/crash_cgo_test.go index 5d5eb33fde3..1bf5d50b830 100644 --- a/src/runtime/crash_cgo_test.go +++ b/src/runtime/crash_cgo_test.go @@ -730,7 +730,10 @@ func TestCgoTraceParser(t *testing.T) { } output := runTestProg(t, "testprogcgo", "CgoTraceParser") want := "OK\n" - if output != want { + ErrTimeOrder := "ErrTimeOrder\n" + if output == ErrTimeOrder { + t.Skipf("skipping due to golang.org/issue/16755: %v", output) + } else if output != want { t.Fatalf("want %s, got %s\n", want, output) } } @@ -743,7 +746,10 @@ func TestCgoTraceParserWithOneProc(t *testing.T) { } output := runTestProg(t, "testprogcgo", "CgoTraceParser", "GOMAXPROCS=1") want := "OK\n" - if output != want { + ErrTimeOrder := "ErrTimeOrder\n" + if output == ErrTimeOrder { + t.Skipf("skipping due to golang.org/issue/16755: %v", output) + } else if output != want { t.Fatalf("GOMAXPROCS=1, want %s, got %s\n", want, output) } } diff --git a/src/runtime/testdata/testprogcgo/issue29707.go b/src/runtime/testdata/testprogcgo/issue29707.go index 95964b111bd..7d9299f131c 100644 --- a/src/runtime/testdata/testprogcgo/issue29707.go +++ b/src/runtime/testdata/testprogcgo/issue29707.go @@ -50,7 +50,9 @@ func CgoTraceParser() { trace.Stop() _, err := traceparser.Parse(buf, "") - if err != nil { + if err == traceparser.ErrTimeOrder { + fmt.Println("ErrTimeOrder") + } else if err != nil { fmt.Println("Parse error: ", err) } else { fmt.Println("OK")