aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorMartin Möhrmann <moehrmann@google.com>2018-11-01 11:20:11 +0100
committerMartin Möhrmann <martisch@uos.de>2018-11-02 00:52:46 +0000
commit914a25c0eb8aacdbb5cddd3e7d5e6ee7b019f88f (patch)
treec6f1b3f289af88b17c72922a2f4e890ad8a46ba8 /src/runtime/runtime-gdb_test.go
parent484fc06849fa54d168af1d513c37d1b22bf38e7c (diff)
downloadgo-914a25c0eb8aacdbb5cddd3e7d5e6ee7b019f88f.tar.gz
go-914a25c0eb8aacdbb5cddd3e7d5e6ee7b019f88f.zip
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>
Diffstat (limited to 'src/runtime/runtime-gdb_test.go')
-rw-r--r--src/runtime/runtime-gdb_test.go14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index ee63285ec5..7672e45b03 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -262,15 +262,13 @@ func testGdbPython(t *testing.T, cgo bool) {
// However, the newer dwarf location list code reconstituted
// aggregates from their fields and reverted their printing
// 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"}`)
- // Format output from gdb v8.2
- infoLocalsRe2 := regexp.MustCompile(`^slicevar = .*\nmapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"`)
- // 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) {
+ if bl := blocks["info locals"]; !strings.Contains(bl, "slicevar") ||
+ !strings.Contains(bl, "mapvar") ||
+ !strings.Contains(bl, "strvar") {
t.Fatalf("info locals failed: %s", bl)
}