tests: fix tests on Go 1.23 (#3697)
* Adjust rtype.go script to handle constants moved to internal/abi from runtime * Remove tests in service/dap/server_test that relied on knowledge of the internal layout of channels.
This commit is contained in:
parent
d7f104bf9c
commit
2e88b7ead3
@ -27,7 +27,7 @@ type g struct {
|
|||||||
waitsince int64
|
waitsince int64
|
||||||
waitreason waitReason (optional)
|
waitreason waitReason (optional)
|
||||||
stack stack
|
stack stack
|
||||||
atomicstatus uint32|runtime/internal/atomic.Uint32
|
atomicstatus uint32|runtime/internal/atomic.Uint32|internal/runtime/atomic.Uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
type gobuf struct {
|
type gobuf struct {
|
||||||
@ -54,10 +54,6 @@ type moduledata struct {
|
|||||||
types uintptr
|
types uintptr
|
||||||
}
|
}
|
||||||
|
|
||||||
type runtime/internal/atomic.Uint32 struct {
|
|
||||||
value uint32
|
|
||||||
}
|
|
||||||
|
|
||||||
type stack struct {
|
type stack struct {
|
||||||
hi uintptr
|
hi uintptr
|
||||||
lo uintptr
|
lo uintptr
|
||||||
@ -67,11 +63,11 @@ const emptyOne = 1
|
|||||||
|
|
||||||
const emptyRest = 0
|
const emptyRest = 0
|
||||||
|
|
||||||
const kindDirectIface = 32
|
const kindDirectIface|internal/abi.KindDirectIface = 32
|
||||||
|
|
||||||
const kindGCProg = 64
|
const kindGCProg|internal/abi.KindGCProg = 64
|
||||||
|
|
||||||
const kindMask = 31
|
const kindMask|internal/abi.KindMask = 31
|
||||||
|
|
||||||
const minTopHash = 4
|
const minTopHash = 4
|
||||||
or const minTopHash = 5
|
or const minTopHash = 5
|
||||||
|
@ -619,7 +619,7 @@ func check() {
|
|||||||
for _, C := range Cs {
|
for _, C := range Cs {
|
||||||
rules := checkConstValRules[C]
|
rules := checkConstValRules[C]
|
||||||
pos := fset.Position(rules[0].pos)
|
pos := fset.Position(rules[0].pos)
|
||||||
def := lookupPackage(pkgmap, "runtime").Types.Scope().Lookup(C)
|
def := findConst(pkgmap, C)
|
||||||
if def == nil {
|
if def == nil {
|
||||||
fmt.Fprintf(os.Stderr, "%s:%d: could not find constant %s\n", pos.Filename, pos.Line, C)
|
fmt.Fprintf(os.Stderr, "%s:%d: could not find constant %s\n", pos.Filename, pos.Line, C)
|
||||||
allok = false
|
allok = false
|
||||||
@ -655,6 +655,21 @@ func fieldTypeByName(typ *types.Struct, name string) types.Type {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func findConst(pkgmap map[string]*packages.Package, Cs string) types.Object {
|
||||||
|
for _, C := range strings.Split(Cs, "|") {
|
||||||
|
pkg := lookupPackage(pkgmap, "runtime")
|
||||||
|
if dot := strings.Index(C, "."); dot >= 0 {
|
||||||
|
pkg = lookupPackage(pkgmap, C[:dot])
|
||||||
|
C = C[dot+1:]
|
||||||
|
}
|
||||||
|
def := pkg.Types.Scope().Lookup(C)
|
||||||
|
if def != nil {
|
||||||
|
return def
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func matchType(typ types.Type, T string) bool {
|
func matchType(typ types.Type, T string) bool {
|
||||||
if T == "anytype" {
|
if T == "anytype" {
|
||||||
return true
|
return true
|
||||||
|
@ -15,10 +15,10 @@ import (
|
|||||||
// some extra flags defined here.
|
// some extra flags defined here.
|
||||||
// See equivalent declaration in $GOROOT/src/reflect/type.go
|
// See equivalent declaration in $GOROOT/src/reflect/type.go
|
||||||
const (
|
const (
|
||||||
kindDirectIface = 1 << 5 // +rtype kindDirectIface
|
kindDirectIface = 1 << 5 // +rtype kindDirectIface|internal/abi.KindDirectIface
|
||||||
kindGCProg = 1 << 6 // +rtype kindGCProg
|
kindGCProg = 1 << 6 // +rtype kindGCProg|internal/abi.KindGCProg
|
||||||
kindNoPointers = 1 << 7
|
kindNoPointers = 1 << 7
|
||||||
kindMask = (1 << 5) - 1 // +rtype kindMask
|
kindMask = (1 << 5) - 1 // +rtype kindMask|internal/abi.KindMask
|
||||||
)
|
)
|
||||||
|
|
||||||
type runtimeTypeDIE struct {
|
type runtimeTypeDIE struct {
|
||||||
|
@ -930,11 +930,11 @@ func (v *Variable) parseG() (*G, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
status := uint64(0)
|
status := uint64(0)
|
||||||
if atomicStatus := v.loadFieldNamed("atomicstatus"); /* +rtype uint32|runtime/internal/atomic.Uint32 */ atomicStatus != nil {
|
if atomicStatus := v.loadFieldNamed("atomicstatus"); /* +rtype uint32|runtime/internal/atomic.Uint32|internal/runtime/atomic.Uint32 */ atomicStatus != nil {
|
||||||
if constant.Val(atomicStatus.Value) != nil {
|
if constant.Val(atomicStatus.Value) != nil {
|
||||||
status, _ = constant.Uint64Val(atomicStatus.Value)
|
status, _ = constant.Uint64Val(atomicStatus.Value)
|
||||||
} else {
|
} else {
|
||||||
atomicStatus := atomicStatus // +rtype runtime/internal/atomic.Uint32
|
atomicStatus := atomicStatus // +rtype runtime/internal/atomic.Uint32|internal/runtime/atomic.Uint32
|
||||||
vv := atomicStatus.fieldVariable("value") // +rtype uint32
|
vv := atomicStatus.fieldVariable("value") // +rtype uint32
|
||||||
if vv == nil {
|
if vv == nil {
|
||||||
unreadable = true
|
unreadable = true
|
||||||
|
@ -1848,9 +1848,7 @@ func TestScopesAndVariablesRequests2(t *testing.T) {
|
|||||||
if ref > 0 {
|
if ref > 0 {
|
||||||
client.VariablesRequest(ref)
|
client.VariablesRequest(ref)
|
||||||
ch1 := client.ExpectVariablesResponse(t)
|
ch1 := client.ExpectVariablesResponse(t)
|
||||||
checkChildren(t, ch1, "ch1", 11)
|
|
||||||
checkVarExact(t, ch1, 0, "qcount", "ch1.qcount", "4 = 0x4", "uint", noChildren)
|
checkVarExact(t, ch1, 0, "qcount", "ch1.qcount", "4 = 0x4", "uint", noChildren)
|
||||||
checkVarRegex(t, ch1, 10, "lock", "ch1.lock", `runtime\.mutex {.*key: 0.*}`, `runtime\.mutex`, hasChildren)
|
|
||||||
validateEvaluateName(t, client, ch1, 0)
|
validateEvaluateName(t, client, ch1, 0)
|
||||||
validateEvaluateName(t, client, ch1, 10)
|
validateEvaluateName(t, client, ch1, 10)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user