Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc fixes for test problems #2751

Merged
merged 4 commits into from
Oct 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions _scripts/test_linux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,12 @@ echo "$GOROOT"
echo "$GOPATH"
cd delve

# Starting with go1.18 'go build' and 'go run' will try to stamp the build
# with the current VCS revision, which does not work with TeamCity
if [ "$version" = "gotip" ]; then
export GOFLAGS=-buildvcs=false
elif [ ${version:4} -gt 17 ]; then
export GOFLAGS=-buildvcs=false
fi

make test
4 changes: 4 additions & 0 deletions pkg/proc/amd64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ const amd64cgocallSPOffsetSaveSlot = 0x28

func amd64SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {
if it.frame.Current.Fn == nil {
if it.systemstack && it.g != nil && it.top {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add some more context via comments here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, let's just forego this for now since the comment would have to be added to so many places.

it.switchToGoroutineStack()
return true
}
return false
}
switch it.frame.Current.Fn.Name {
Expand Down
4 changes: 4 additions & 0 deletions pkg/proc/arm64_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const arm64cgocallSPOffsetSaveSlot = 0x8
const prevG0schedSPOffsetSaveSlot = 0x10

func arm64SwitchStack(it *stackIterator, callFrameRegs *op.DwarfRegisters) bool {
if it.frame.Current.Fn == nil && it.systemstack && it.g != nil && it.top {
it.switchToGoroutineStack()
return true
}
if it.frame.Current.Fn != nil {
switch it.frame.Current.Fn.Name {
case "runtime.asmcgocall", "runtime.cgocallback_gofunc", "runtime.sigpanic", "runtime.cgocallback":
Expand Down
4 changes: 4 additions & 0 deletions pkg/proc/i386_arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func i386FixFrameUnwindContext(fctxt *frame.FrameContext, pc uint64, bi *BinaryI
// SwitchStack will use the current frame to determine if it's time to
func i386SwitchStack(it *stackIterator, _ *op.DwarfRegisters) bool {
if it.frame.Current.Fn == nil {
if it.systemstack && it.g != nil && it.top {
it.switchToGoroutineStack()
return true
}
return false
}
switch it.frame.Current.Fn.Name {
Expand Down
2 changes: 1 addition & 1 deletion pkg/proc/proc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5409,7 +5409,7 @@ func TestWatchpointsBasic(t *testing.T) {
t.Fatal("breakpoint not set")
}

p.ClearBreakpoint(bp.Addr)
assertNoError(p.ClearBreakpoint(bp.Addr), t, "ClearBreakpoint")

assertNoError(p.Continue(), t, "Continue 2")
assertLineNumber(p, t, 21, "Continue 2") // Position 2
Expand Down
3 changes: 2 additions & 1 deletion pkg/terminal/command_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ func TestScopePrefix(t *testing.T) {
stackOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d stack", gid)), "\n")
fid := -1
for _, line := range stackOut {
line = strings.TrimLeft(line, " ")
space := strings.Index(line, " ")
if space < 0 {
continue
Expand All @@ -417,7 +418,7 @@ func TestScopePrefix(t *testing.T) {
}
}
if fid < 0 {
t.Fatalf("Could not find frame for goroutine %d: %v", gid, stackOut)
t.Fatalf("Could not find frame for goroutine %d: %q", gid, stackOut)
}
term.AssertExec(fmt.Sprintf("goroutine %d frame %d locals", gid, fid), "(no locals)\n")
argsOut := strings.Split(term.MustExec(fmt.Sprintf("goroutine %d frame %d args", gid, fid)), "\n")
Expand Down
12 changes: 10 additions & 2 deletions service/dap/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4689,6 +4689,15 @@ func TestLaunchDebugRequest(t *testing.T) {
rescueStderr := os.Stderr
r, w, _ := os.Pipe()
os.Stderr = w
done := make(chan struct{})

var err []byte

go func() {
err, _ = ioutil.ReadAll(r)
t.Log(string(err))
close(done)
}()

tmpBin := "__tmpBin"
runTest(t, "increment", func(client *daptest.Client, fixture protest.Fixture) {
Expand All @@ -4703,8 +4712,7 @@ func TestLaunchDebugRequest(t *testing.T) {
time.Sleep(100 * time.Millisecond)

w.Close()
err, _ := ioutil.ReadAll(r)
t.Log(string(err))
<-done
os.Stderr = rescueStderr

rmErrRe, _ := regexp.Compile(`could not remove .*\n`)
Expand Down