_fixtures: Removed testvariables2 and testvariables4
Moved the code in testvariables2 and testvariables4 into testvariables3, renamed testvariables3 into testvariables2
This commit is contained in:
parent
9fcd44421f
commit
6242c4388e
@ -1,13 +1,196 @@
|
||||
package main
|
||||
|
||||
import "runtime"
|
||||
import (
|
||||
"fmt"
|
||||
"go/constant"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type astruct struct {
|
||||
A int
|
||||
B int
|
||||
}
|
||||
|
||||
type bstruct struct {
|
||||
a astruct
|
||||
}
|
||||
|
||||
type cstruct struct {
|
||||
pb *bstruct
|
||||
sa []*astruct
|
||||
}
|
||||
|
||||
type a struct {
|
||||
aas []a
|
||||
}
|
||||
|
||||
type A struct {
|
||||
val int
|
||||
}
|
||||
|
||||
type C struct {
|
||||
s string
|
||||
}
|
||||
|
||||
type B struct {
|
||||
A
|
||||
*C
|
||||
a A
|
||||
ptr *A
|
||||
}
|
||||
|
||||
func afunc(x int) int {
|
||||
return x + 2
|
||||
}
|
||||
|
||||
func afunc1(x int) {
|
||||
}
|
||||
|
||||
func afunc2() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type functype func(int) int
|
||||
|
||||
func (a *astruct) Error() string {
|
||||
return "not an error"
|
||||
}
|
||||
|
||||
func (b *bstruct) Error() string {
|
||||
return "not an error"
|
||||
}
|
||||
|
||||
type dstruct struct {
|
||||
x interface{}
|
||||
}
|
||||
|
||||
type maptype map[string]interface{}
|
||||
|
||||
type benchstruct struct {
|
||||
a [64]byte
|
||||
b [64]byte
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
Route string
|
||||
Active int
|
||||
}
|
||||
|
||||
type Menu []Item
|
||||
|
||||
func main() {
|
||||
i1 := 1
|
||||
i2 := 2
|
||||
f1 := 3.0
|
||||
i3 := 3
|
||||
p1 := &i1
|
||||
s1 := []string{"one", "two", "three", "four", "five"}
|
||||
s3 := make([]int, 0, 6)
|
||||
a1 := [5]string{"one", "two", "three", "four", "five"}
|
||||
c1 := cstruct{&bstruct{astruct{1, 2}}, []*astruct{&astruct{1, 2}, &astruct{2, 3}, &astruct{4, 5}}}
|
||||
s2 := []astruct{{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, 14}, {15, 16}}
|
||||
p2 := &(c1.sa[2].B)
|
||||
as1 := astruct{1, 1}
|
||||
var p3 *int
|
||||
str1 := "01234567890"
|
||||
var fn1 functype = afunc
|
||||
var fn2 functype = nil
|
||||
var nilslice []int = nil
|
||||
var nilptr *int = nil
|
||||
ch1 := make(chan int, 2)
|
||||
var chnil chan int = nil
|
||||
m1 := map[string]astruct{
|
||||
"Malone": astruct{2, 3},
|
||||
"Adenauer": astruct{},
|
||||
"squadrons": astruct{},
|
||||
"quintuplets": astruct{},
|
||||
"parasite": astruct{},
|
||||
"wristwatches": astruct{},
|
||||
"flashgun": astruct{},
|
||||
"equivocally": astruct{},
|
||||
"sweetbrier": astruct{},
|
||||
"idealism": astruct{},
|
||||
"tangos": astruct{},
|
||||
"alterable": astruct{},
|
||||
"quaffing": astruct{},
|
||||
"arsenic": astruct{},
|
||||
"coincidentally": astruct{},
|
||||
"hindrances": astruct{},
|
||||
"zoning": astruct{},
|
||||
"egging": astruct{},
|
||||
"inserts": astruct{},
|
||||
"adaptive": astruct{},
|
||||
"orientations": astruct{},
|
||||
"periling": astruct{},
|
||||
"lip": astruct{},
|
||||
"chant": astruct{},
|
||||
"availing": astruct{},
|
||||
"fern": astruct{},
|
||||
"flummoxes": astruct{},
|
||||
"meanders": astruct{},
|
||||
"ravenously": astruct{},
|
||||
"reminisce": astruct{},
|
||||
"snorkel": astruct{},
|
||||
"gutters": astruct{},
|
||||
"jibbed": astruct{},
|
||||
"tiara": astruct{},
|
||||
"takers": astruct{},
|
||||
"animates": astruct{},
|
||||
"Zubenelgenubi": astruct{},
|
||||
"bantering": astruct{},
|
||||
"tumblers": astruct{},
|
||||
"horticulturists": astruct{},
|
||||
"thallium": astruct{},
|
||||
}
|
||||
var mnil map[string]astruct = nil
|
||||
m2 := map[int]*astruct{1: &astruct{10, 11}}
|
||||
m3 := map[astruct]int{{1, 1}: 42, {2, 2}: 43}
|
||||
up1 := unsafe.Pointer(&i1)
|
||||
i4 := 800
|
||||
i5 := -3
|
||||
i6 := -500
|
||||
var err1 error = c1.sa[0]
|
||||
var err2 error = c1.pb
|
||||
var errnil error = nil
|
||||
var iface1 interface{} = c1.sa[0]
|
||||
var iface2 interface{} = "test"
|
||||
var iface3 interface{} = map[string]constant.Value{}
|
||||
var iface4 interface{} = []constant.Value{constant.MakeInt64(4)}
|
||||
var ifacenil interface{} = nil
|
||||
arr1 := [4]int{0, 1, 2, 3}
|
||||
parr := &arr1
|
||||
cpx1 := complex(1, 2)
|
||||
const1 := constant.MakeInt64(3)
|
||||
recursive1 := dstruct{}
|
||||
recursive1.x = &recursive1
|
||||
var iface5 interface{} = &recursive1
|
||||
var iface2fn1 interface{} = afunc1
|
||||
var iface2fn2 interface{} = afunc2
|
||||
var mapinf maptype = map[string]interface{}{}
|
||||
mapinf["inf"] = mapinf
|
||||
var bencharr [64]benchstruct
|
||||
var benchparr [64]*benchstruct
|
||||
mainMenu := Menu{
|
||||
{Name: "home", Route: "/", Active: 1},
|
||||
{Name: "About", Route: "/about", Active: 1},
|
||||
{Name: "Login", Route: "/login", Active: 1},
|
||||
}
|
||||
var aas = []a{{nil}}
|
||||
aas[0].aas = aas
|
||||
runtime.Breakpoint()
|
||||
b := B{A: A{-314}, C: &C{"hello"}, a: A{42}, ptr: &A{1337}}
|
||||
b2 := B{A: A{42}, a: A{47}}
|
||||
|
||||
for i := range benchparr {
|
||||
benchparr[i] = &benchstruct{}
|
||||
}
|
||||
|
||||
var amb1 = 1
|
||||
runtime.Breakpoint()
|
||||
for amb1 := 0; amb1 < 10; amb1++ {
|
||||
fmt.Println(amb1)
|
||||
}
|
||||
runtime.Breakpoint()
|
||||
fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu, b, b2)
|
||||
}
|
||||
|
||||
@ -1,173 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/constant"
|
||||
"runtime"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
type astruct struct {
|
||||
A int
|
||||
B int
|
||||
}
|
||||
|
||||
type bstruct struct {
|
||||
a astruct
|
||||
}
|
||||
|
||||
type cstruct struct {
|
||||
pb *bstruct
|
||||
sa []*astruct
|
||||
}
|
||||
|
||||
func afunc(x int) int {
|
||||
return x + 2
|
||||
}
|
||||
|
||||
func afunc1(x int) {
|
||||
}
|
||||
|
||||
func afunc2() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type functype func(int) int
|
||||
|
||||
func (a *astruct) Error() string {
|
||||
return "not an error"
|
||||
}
|
||||
|
||||
func (b *bstruct) Error() string {
|
||||
return "not an error"
|
||||
}
|
||||
|
||||
type dstruct struct {
|
||||
x interface{}
|
||||
}
|
||||
|
||||
type maptype map[string]interface{}
|
||||
|
||||
type benchstruct struct {
|
||||
a [64]byte
|
||||
b [64]byte
|
||||
}
|
||||
|
||||
type Item struct {
|
||||
Name string
|
||||
Route string
|
||||
Active int
|
||||
}
|
||||
|
||||
type Menu []Item
|
||||
|
||||
func main() {
|
||||
i1 := 1
|
||||
i2 := 2
|
||||
f1 := 3.0
|
||||
i3 := 3
|
||||
p1 := &i1
|
||||
s1 := []string{"one", "two", "three", "four", "five"}
|
||||
s3 := make([]int, 0, 6)
|
||||
a1 := [5]string{"one", "two", "three", "four", "five"}
|
||||
c1 := cstruct{&bstruct{astruct{1, 2}}, []*astruct{&astruct{1, 2}, &astruct{2, 3}, &astruct{4, 5}}}
|
||||
s2 := []astruct{{1, 2}, {3, 4}, {5, 6}, {7, 8}, {9, 10}, {11, 12}, {13, 14}, {15, 16}}
|
||||
p2 := &(c1.sa[2].B)
|
||||
as1 := astruct{1, 1}
|
||||
var p3 *int
|
||||
str1 := "01234567890"
|
||||
var fn1 functype = afunc
|
||||
var fn2 functype = nil
|
||||
var nilslice []int = nil
|
||||
var nilptr *int = nil
|
||||
ch1 := make(chan int, 2)
|
||||
var chnil chan int = nil
|
||||
m1 := map[string]astruct{
|
||||
"Malone": astruct{2, 3},
|
||||
"Adenauer": astruct{},
|
||||
"squadrons": astruct{},
|
||||
"quintuplets": astruct{},
|
||||
"parasite": astruct{},
|
||||
"wristwatches": astruct{},
|
||||
"flashgun": astruct{},
|
||||
"equivocally": astruct{},
|
||||
"sweetbrier": astruct{},
|
||||
"idealism": astruct{},
|
||||
"tangos": astruct{},
|
||||
"alterable": astruct{},
|
||||
"quaffing": astruct{},
|
||||
"arsenic": astruct{},
|
||||
"coincidentally": astruct{},
|
||||
"hindrances": astruct{},
|
||||
"zoning": astruct{},
|
||||
"egging": astruct{},
|
||||
"inserts": astruct{},
|
||||
"adaptive": astruct{},
|
||||
"orientations": astruct{},
|
||||
"periling": astruct{},
|
||||
"lip": astruct{},
|
||||
"chant": astruct{},
|
||||
"availing": astruct{},
|
||||
"fern": astruct{},
|
||||
"flummoxes": astruct{},
|
||||
"meanders": astruct{},
|
||||
"ravenously": astruct{},
|
||||
"reminisce": astruct{},
|
||||
"snorkel": astruct{},
|
||||
"gutters": astruct{},
|
||||
"jibbed": astruct{},
|
||||
"tiara": astruct{},
|
||||
"takers": astruct{},
|
||||
"animates": astruct{},
|
||||
"Zubenelgenubi": astruct{},
|
||||
"bantering": astruct{},
|
||||
"tumblers": astruct{},
|
||||
"horticulturists": astruct{},
|
||||
"thallium": astruct{},
|
||||
}
|
||||
var mnil map[string]astruct = nil
|
||||
m2 := map[int]*astruct{1: &astruct{10, 11}}
|
||||
m3 := map[astruct]int{{1, 1}: 42, {2, 2}: 43}
|
||||
up1 := unsafe.Pointer(&i1)
|
||||
i4 := 800
|
||||
i5 := -3
|
||||
i6 := -500
|
||||
var err1 error = c1.sa[0]
|
||||
var err2 error = c1.pb
|
||||
var errnil error = nil
|
||||
var iface1 interface{} = c1.sa[0]
|
||||
var iface2 interface{} = "test"
|
||||
var iface3 interface{} = map[string]constant.Value{}
|
||||
var iface4 interface{} = []constant.Value{constant.MakeInt64(4)}
|
||||
var ifacenil interface{} = nil
|
||||
arr1 := [4]int{0, 1, 2, 3}
|
||||
parr := &arr1
|
||||
cpx1 := complex(1, 2)
|
||||
const1 := constant.MakeInt64(3)
|
||||
recursive1 := dstruct{}
|
||||
recursive1.x = &recursive1
|
||||
var iface5 interface{} = &recursive1
|
||||
var iface2fn1 interface{} = afunc1
|
||||
var iface2fn2 interface{} = afunc2
|
||||
var mapinf maptype = map[string]interface{}{}
|
||||
mapinf["inf"] = mapinf
|
||||
var bencharr [64]benchstruct
|
||||
var benchparr [64]*benchstruct
|
||||
mainMenu := Menu{
|
||||
{Name: "home", Route: "/", Active: 1},
|
||||
{Name: "About", Route: "/about", Active: 1},
|
||||
{Name: "Login", Route: "/login", Active: 1},
|
||||
}
|
||||
|
||||
for i := range benchparr {
|
||||
benchparr[i] = &benchstruct{}
|
||||
}
|
||||
|
||||
var amb1 = 1
|
||||
runtime.Breakpoint()
|
||||
for amb1 := 0; amb1 < 10; amb1++ {
|
||||
fmt.Println(amb1)
|
||||
}
|
||||
runtime.Breakpoint()
|
||||
fmt.Println(i1, i2, i3, p1, amb1, s1, s3, a1, p2, p3, s2, as1, str1, f1, fn1, fn2, nilslice, nilptr, ch1, chnil, m1, mnil, m2, m3, up1, i4, i5, i6, err1, err2, errnil, iface1, iface2, ifacenil, arr1, parr, cpx1, const1, iface3, iface4, recursive1, recursive1.x, iface5, iface2fn1, iface2fn2, bencharr, benchparr, mapinf, mainMenu)
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
type A struct {
|
||||
val int
|
||||
}
|
||||
|
||||
type C struct {
|
||||
s string
|
||||
}
|
||||
|
||||
type B struct {
|
||||
A
|
||||
*C
|
||||
a A
|
||||
ptr *A
|
||||
}
|
||||
|
||||
func main() {
|
||||
b := B{A: A{-314}, C: &C{"hello"}, a: A{42}, ptr: &A{1337}}
|
||||
b2 := B{A: A{42}, a: A{47}}
|
||||
runtime.Breakpoint()
|
||||
fmt.Println(b, b2)
|
||||
fmt.Println(b.val)
|
||||
fmt.Println(b.A.val)
|
||||
fmt.Println(b.a.val)
|
||||
fmt.Println(b.ptr.val)
|
||||
fmt.Println(b.C.s)
|
||||
fmt.Println(b.s)
|
||||
}
|
||||
@ -1070,7 +1070,7 @@ func TestFrameEvaluation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPointerSetting(t *testing.T) {
|
||||
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
|
||||
pval := func(n int64) {
|
||||
@ -1134,7 +1134,7 @@ func TestRecursiveStructure(t *testing.T) {
|
||||
|
||||
func TestIssue316(t *testing.T) {
|
||||
// A pointer loop that includes one interface should not send dlv into an infinite loop
|
||||
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
_, err := evalVariable(p, "iface5")
|
||||
assertNoError(err, t, "EvalVariable()")
|
||||
@ -1143,7 +1143,7 @@ func TestIssue316(t *testing.T) {
|
||||
|
||||
func TestIssue325(t *testing.T) {
|
||||
// nil pointer dereference when evaluating interfaces to function pointers
|
||||
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
iface2fn1v, err := evalVariable(p, "iface2fn1")
|
||||
assertNoError(err, t, "EvalVariable()")
|
||||
@ -1191,7 +1191,7 @@ func TestBreakpointCounts(t *testing.T) {
|
||||
func BenchmarkArray(b *testing.B) {
|
||||
// each bencharr struct is 128 bytes, bencharr is 64 elements long
|
||||
b.SetBytes(int64(64 * 128))
|
||||
withTestProcess("testvariables3", b, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", b, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), b, "Continue()")
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := evalVariable(p, "bencharr")
|
||||
@ -1268,7 +1268,7 @@ func BenchmarkArrayPointer(b *testing.B) {
|
||||
// each bencharr struct is 128 bytes, benchparr is an array of 64 pointers to bencharr
|
||||
// each read will read 64 bencharr structs plus the 64 pointers of benchparr
|
||||
b.SetBytes(int64(64*128 + 64*8))
|
||||
withTestProcess("testvariables3", b, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", b, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), b, "Continue()")
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := evalVariable(p, "bencharr")
|
||||
@ -1282,7 +1282,7 @@ func BenchmarkMap(b *testing.B) {
|
||||
// each string key has an average of 9 character
|
||||
// reading strings and the map structure imposes a overhead that we ignore here
|
||||
b.SetBytes(int64(41 * (2*8 + 9)))
|
||||
withTestProcess("testvariables3", b, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", b, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), b, "Continue()")
|
||||
for i := 0; i < b.N; i++ {
|
||||
_, err := evalVariable(p, "m1")
|
||||
@ -1292,7 +1292,7 @@ func BenchmarkMap(b *testing.B) {
|
||||
}
|
||||
|
||||
func BenchmarkGoroutinesInfo(b *testing.B) {
|
||||
withTestProcess("testvariables3", b, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", b, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), b, "Continue()")
|
||||
for i := 0; i < b.N; i++ {
|
||||
p.allGCache = nil
|
||||
@ -1343,7 +1343,7 @@ func TestIssue305(t *testing.T) {
|
||||
|
||||
func TestIssue341(t *testing.T) {
|
||||
// pointer loop through map entries
|
||||
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue()")
|
||||
t.Logf("requesting mapinf")
|
||||
mapinf, err := evalVariable(p, "mapinf")
|
||||
@ -1434,7 +1434,7 @@ func TestCondBreakpointError(t *testing.T) {
|
||||
|
||||
func TestIssue356(t *testing.T) {
|
||||
// slice with a typedef does not get printed correctly
|
||||
withTestProcess("testvariables3", t, func(p *Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
mmvar, err := evalVariable(p, "mainMenu")
|
||||
assertNoError(err, t, "EvalVariable()")
|
||||
|
||||
@ -302,7 +302,7 @@ func TestLocalVariables(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmbeddedStruct(t *testing.T) {
|
||||
withTestProcess("testvariables4", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
testcases := []varTest{
|
||||
{"b.val", true, "-314", "", "int", nil},
|
||||
{"b.A.val", true, "-314", "", "int", nil},
|
||||
@ -556,7 +556,7 @@ func TestEvalExpression(t *testing.T) {
|
||||
{"mainMenu[0]", false, `main.Item {Name: "home", Route: "/", Active: 1}`, "", "main.Item", nil},
|
||||
}
|
||||
|
||||
withTestProcess("testvariables3", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
for _, tc := range testcases {
|
||||
variable, err := evalVariable(p, tc.name)
|
||||
@ -576,7 +576,7 @@ func TestEvalExpression(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEvalAddrAndCast(t *testing.T) {
|
||||
withTestProcess("testvariables3", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
c1addr, err := evalVariable(p, "&c1")
|
||||
assertNoError(err, t, "EvalExpression(&c1)")
|
||||
@ -602,7 +602,7 @@ func TestEvalAddrAndCast(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMapEvaluation(t *testing.T) {
|
||||
withTestProcess("testvariables3", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
m1v, err := evalVariable(p, "m1")
|
||||
assertNoError(err, t, "EvalVariable()")
|
||||
@ -636,7 +636,7 @@ func TestMapEvaluation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnsafePointer(t *testing.T) {
|
||||
withTestProcess("testvariables3", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
withTestProcess("testvariables2", t, func(p *proc.Process, fixture protest.Fixture) {
|
||||
assertNoError(p.Continue(), t, "Continue() returned an error")
|
||||
up1v, err := evalVariable(p, "up1")
|
||||
assertNoError(err, t, "EvalVariable(up1)")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user