mirror of
https://github.com/golang/go
synced 2024-11-08 12:16:15 -07:00
runtime: only check the existence of variables in gdb info locals test
As discussed in golang.org/cl/28499: Only test that all expected variables are listed in 'info locals' since different versions of gdb print variables in different order and with differing amount of information and formats. Fixes #28499 Change-Id: I76627351170b5fdf2bf8cbf143e54f628b45dc4e Reviewed-on: https://go-review.googlesource.com/c/146598 Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
484fc06849
commit
914a25c0eb
@ -262,15 +262,13 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||||||
// However, the newer dwarf location list code reconstituted
|
// However, the newer dwarf location list code reconstituted
|
||||||
// aggregates from their fields and reverted their printing
|
// aggregates from their fields and reverted their printing
|
||||||
// back to its original form.
|
// back to its original form.
|
||||||
|
// Only test that all variables are listed in 'info locals' since
|
||||||
|
// different versions of gdb print variables in different
|
||||||
|
// order and with differing amount of information and formats.
|
||||||
|
|
||||||
infoLocalsRe1 := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`)
|
if bl := blocks["info locals"]; !strings.Contains(bl, "slicevar") ||
|
||||||
// Format output from gdb v8.2
|
!strings.Contains(bl, "mapvar") ||
|
||||||
infoLocalsRe2 := regexp.MustCompile(`^slicevar = .*\nmapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"`)
|
!strings.Contains(bl, "strvar") {
|
||||||
// Format output from gdb v7.7
|
|
||||||
infoLocalsRe3 := regexp.MustCompile(`^mapvar = .*\nstrvar = "abc"\nslicevar *= *\[\]string`)
|
|
||||||
if bl := blocks["info locals"]; !infoLocalsRe1.MatchString(bl) &&
|
|
||||||
!infoLocalsRe2.MatchString(bl) &&
|
|
||||||
!infoLocalsRe3.MatchString(bl) {
|
|
||||||
t.Fatalf("info locals failed: %s", bl)
|
t.Fatalf("info locals failed: %s", bl)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user