mirror of
https://github.com/golang/go
synced 2024-11-17 11:34:48 -07:00
runtime: fix runtime gdb test with gdb v8.2
Previously, some of output from gdb matched with literal string, while gdb v8.2 print the address of variable (e.g. map key and value) in output. This commit fix the regex in testing the output. Fixes #27608 Change-Id: Ic3fe8280b9f93fda2799116804822616caa66beb Reviewed-on: https://go-review.googlesource.com/135055 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
This commit is contained in:
parent
b57ccdf992
commit
a9c69e0a65
@ -242,14 +242,14 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||||||
t.Fatalf("info goroutines failed: %s", bl)
|
t.Fatalf("info goroutines failed: %s", bl)
|
||||||
}
|
}
|
||||||
|
|
||||||
printMapvarRe1 := regexp.MustCompile(`\Q = map[string]string = {["abc"] = "def", ["ghi"] = "jkl"}\E$`)
|
printMapvarRe1 := regexp.MustCompile(`^\$[0-9]+ = map\[string\]string = {\[(0x[0-9a-f]+\s+)?"abc"\] = (0x[0-9a-f]+\s+)?"def", \[(0x[0-9a-f]+\s+)?"ghi"\] = (0x[0-9a-f]+\s+)?"jkl"}$`)
|
||||||
printMapvarRe2 := regexp.MustCompile(`\Q = map[string]string = {["ghi"] = "jkl", ["abc"] = "def"}\E$`)
|
printMapvarRe2 := regexp.MustCompile(`^\$[0-9]+ = map\[string\]string = {\[(0x[0-9a-f]+\s+)?"ghi"\] = (0x[0-9a-f]+\s+)?"jkl", \[(0x[0-9a-f]+\s+)?"abc"\] = (0x[0-9a-f]+\s+)?"def"}$`)
|
||||||
if bl := blocks["print mapvar"]; !printMapvarRe1.MatchString(bl) &&
|
if bl := blocks["print mapvar"]; !printMapvarRe1.MatchString(bl) &&
|
||||||
!printMapvarRe2.MatchString(bl) {
|
!printMapvarRe2.MatchString(bl) {
|
||||||
t.Fatalf("print mapvar failed: %s", bl)
|
t.Fatalf("print mapvar failed: %s", bl)
|
||||||
}
|
}
|
||||||
|
|
||||||
strVarRe := regexp.MustCompile(`\Q = "abc"\E$`)
|
strVarRe := regexp.MustCompile(`^\$[0-9]+ = (0x[0-9a-f]+\s+)?"abc"$`)
|
||||||
if bl := blocks["print strvar"]; !strVarRe.MatchString(bl) {
|
if bl := blocks["print strvar"]; !strVarRe.MatchString(bl) {
|
||||||
t.Fatalf("print strvar failed: %s", bl)
|
t.Fatalf("print strvar failed: %s", bl)
|
||||||
}
|
}
|
||||||
@ -263,8 +263,11 @@ func testGdbPython(t *testing.T, cgo bool) {
|
|||||||
// 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.
|
||||||
|
|
||||||
infoLocalsRe := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`)
|
infoLocalsRe1 := regexp.MustCompile(`slicevar *= *\[\]string *= *{"def"}`)
|
||||||
if bl := blocks["info locals"]; !infoLocalsRe.MatchString(bl) {
|
// Format output from gdb v8.2
|
||||||
|
infoLocalsRe2 := regexp.MustCompile(`^slicevar = .*\nmapvar = .*\nstrvar = 0x[0-9a-f]+ "abc"`)
|
||||||
|
if bl := blocks["info locals"]; !infoLocalsRe1.MatchString(bl) &&
|
||||||
|
!infoLocalsRe2.MatchString(bl) {
|
||||||
t.Fatalf("info locals failed: %s", bl)
|
t.Fatalf("info locals failed: %s", bl)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -425,11 +428,11 @@ func TestGdbAutotmpTypes(t *testing.T) {
|
|||||||
|
|
||||||
// Check that the backtrace matches the source code.
|
// Check that the backtrace matches the source code.
|
||||||
types := []string{
|
types := []string{
|
||||||
"struct []main.astruct;",
|
"[]main.astruct;",
|
||||||
"struct bucket<string,main.astruct>;",
|
"bucket<string,main.astruct>;",
|
||||||
"struct hash<string,main.astruct>;",
|
"hash<string,main.astruct>;",
|
||||||
"struct main.astruct;",
|
"main.astruct;",
|
||||||
"typedef struct hash<string,main.astruct> * map[string]main.astruct;",
|
"hash<string,main.astruct> * map[string]main.astruct;",
|
||||||
}
|
}
|
||||||
for _, name := range types {
|
for _, name := range types {
|
||||||
if !strings.Contains(sgot, name) {
|
if !strings.Contains(sgot, name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user