Skip to content

Commit

Permalink
test: fix remote attach tests on windows long tests
Browse files Browse the repository at this point in the history
The filepaths returned by delve will have '/' as the path separator
even on windows. One of the breakpoint tests was missing this
conversion.

The port was also not correctly set on the disconnect request.

This change does not fix all of the issues, but does keep the tests
from crashing, which should allow us to easier see the test failures.

Updates #832

Change-Id: I829ad6186001f9c665079aa69d99673068a999e8
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/276714
Reviewed-by: Hyang-Ah Hana Kim <[email protected]>
Trust: Suzy Mueller <[email protected]>
  • Loading branch information
suzmue committed Dec 10, 2020
1 parent 43afbf2 commit 27a25c4
Showing 1 changed file with 4 additions and 26 deletions.
30 changes: 4 additions & 26 deletions test/integration/goDebug.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ suite('Go Debug Adapter', function () {
const BREAKPOINT_LINE = 29;
const remoteProgram = await setUpRemoteProgram(remoteAttachConfig.port, server);

const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE, false);
const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE);

// Setup attach with a breakpoint.
await setUpRemoteAttach(remoteAttachDebugConfig, [breakpointLocation]);
Expand All @@ -858,7 +858,6 @@ suite('Go Debug Adapter', function () {
});

test('stopped for a breakpoint set after initialization (remote attach)', async () => {
this.timeout(30_000);
const FILE = path.join(DATA_ROOT, 'helloWorldServer', 'main.go');
const BREAKPOINT_LINE = 29;
const remoteProgram = await setUpRemoteProgram(remoteAttachConfig.port, server);
Expand All @@ -867,7 +866,7 @@ suite('Go Debug Adapter', function () {
await setUpRemoteAttach(remoteAttachDebugConfig);

// Now sets a breakpoint.
const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE, false);
const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE);
const breakpointsResult = await dc.setBreakpointsRequest(
{source: {path: breakpointLocation.path}, breakpoints: [breakpointLocation]});
assert.ok(breakpointsResult.success && breakpointsResult.body.breakpoints[0].verified);
Expand All @@ -881,27 +880,6 @@ suite('Go Debug Adapter', function () {
await killProcessTree(remoteProgram);
await new Promise((resolve) => setTimeout(resolve, 2_000));
});

test('stopped for a breakpoint set during initialization (remote attach)', async () => {
const FILE = path.join(DATA_ROOT, 'helloWorldServer', 'main.go');
const BREAKPOINT_LINE = 29;
const remoteProgram = await setUpRemoteProgram(remoteAttachConfig.port, server);

const breakpointLocation = getBreakpointLocation(FILE, BREAKPOINT_LINE, false);

// Setup attach with a breakpoint.
await setUpRemoteAttach(remoteAttachDebugConfig, [breakpointLocation]);

// Calls the helloworld server to make the breakpoint hit.
await waitForBreakpoint(
() => http.get(`http://localhost:${server}`).on('error', (data) => console.log(data)),
breakpointLocation);

await dc.disconnectRequest({restart: false});
await killProcessTree(remoteProgram);
await new Promise((resolve) => setTimeout(resolve, 2_000));
});

});

suite('conditionalBreakpoints', () => {
Expand Down Expand Up @@ -1070,8 +1048,8 @@ suite('Go Debug Adapter', function () {
// disconnectRequest is sent after it has already disconnected.

test('disconnect should work for remote attach', async () => {
this.timeout(30_000);
const server = await getPort();
remoteAttachConfig.port = await getPort();
const remoteProgram = await setUpRemoteProgram(remoteAttachConfig.port, server);

const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, remoteAttachConfig);
Expand Down Expand Up @@ -1247,7 +1225,7 @@ suite('Go Debug Adapter', function () {
};
const debugConfig = debugConfigProvider.resolveDebugConfiguration(undefined, config);

await dc.hitBreakpoint(debugConfig, { path: FILE, line: BREAKPOINT_LINE } );
await dc.hitBreakpoint(debugConfig, getBreakpointLocation(FILE, BREAKPOINT_LINE));

return Promise.all([
dc.disconnectRequest({restart: false}),
Expand Down

0 comments on commit 27a25c4

Please sign in to comment.