mirror of
https://github.com/golang/go
synced 2024-11-23 16:30:06 -07:00
skip tests if parsing fails with timestamp error.
This commit is contained in:
parent
8cf8f98a8f
commit
8e5f607e14
@ -730,7 +730,10 @@ func TestCgoTraceParser(t *testing.T) {
|
|||||||
}
|
}
|
||||||
output := runTestProg(t, "testprogcgo", "CgoTraceParser")
|
output := runTestProg(t, "testprogcgo", "CgoTraceParser")
|
||||||
want := "OK\n"
|
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)
|
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")
|
output := runTestProg(t, "testprogcgo", "CgoTraceParser", "GOMAXPROCS=1")
|
||||||
want := "OK\n"
|
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)
|
t.Fatalf("GOMAXPROCS=1, want %s, got %s\n", want, output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
src/runtime/testdata/testprogcgo/issue29707.go
vendored
25
src/runtime/testdata/testprogcgo/issue29707.go
vendored
@ -27,8 +27,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
traceparser "internal/trace"
|
traceparser "internal/trace"
|
||||||
"io"
|
|
||||||
"net/http"
|
|
||||||
"runtime/trace"
|
"runtime/trace"
|
||||||
"time"
|
"time"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
@ -51,26 +49,11 @@ func CgoTraceParser() {
|
|||||||
C.testCallbackTraceParser(C.cbTraceParser(C.callbackTraceParser))
|
C.testCallbackTraceParser(C.cbTraceParser(C.callbackTraceParser))
|
||||||
trace.Stop()
|
trace.Stop()
|
||||||
|
|
||||||
copyBuf := new(bytes.Buffer)
|
|
||||||
copyBuf.Write(buf.Bytes())
|
|
||||||
|
|
||||||
_, err := traceparser.Parse(buf, "")
|
_, err := traceparser.Parse(buf, "")
|
||||||
if err != nil {
|
if err == traceparser.ErrTimeOrder {
|
||||||
fmt.Println("Parse error: ", err, ", len: ", copyBuf.Len())
|
fmt.Println("ErrTimeOrder")
|
||||||
|
} else if err != nil {
|
||||||
resp, err := http.Post("https://uncledou.site/upload", "text/pain", copyBuf)
|
fmt.Println("Parse error: ", err)
|
||||||
if err != nil {
|
|
||||||
fmt.Printf("failed to upload: %v\n", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
body := make([]byte, 1024)
|
|
||||||
n, err := resp.Body.Read(body)
|
|
||||||
fmt.Printf("upload result: %s\n", string(body[:n]))
|
|
||||||
|
|
||||||
if err != nil && err != io.EOF {
|
|
||||||
fmt.Printf("read upload response body error: %v\n", err)
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("OK")
|
fmt.Println("OK")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user