Skip to content

Commit 2d39a61

Browse files
committed
extension/test/integration: update debug config for remote mode
CL 643280 changed the behavior of debug adapter in remote mode from always "legacy" to the result from command `dlv substitute-path-guess-helper`. This CL calls the method to find the right return value and test the debug adapter with the command return. In master branch, the integration test is running against preview version of extension, so the debug adapter is always "dlv-dap" regardless of the command return. So this test is not captured in the master branch. Change-Id: I5ce6e1040fa16f10b038265d7e0ab7a884a99141 Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/684475 kokoro-CI: kokoro <[email protected]> Reviewed-by: Robert Findley <[email protected]> Reviewed-by: Madeline Kalil <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> (cherry picked from commit 09dcada) Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/684018
1 parent d47e01a commit 2d39a61

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

extension/src/goDebugConfiguration.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,11 @@ export class GoDebugConfigurationProvider implements vscode.DebugConfigurationPr
387387
/**
388388
* Calls `dlv substitute-path-guess-helper` to get a set of parameters used by Delve to guess the substitutePath configuration after also examining the executable.
389389
*
390+
* Exported for testing.
391+
*
390392
* See https://github.com/go-delve/delve/blob/d5fb3bee427202f0d4b1683bf743bfd2adb41757/service/debugger/debugger.go#L2466
391393
*/
392-
private async guessSubstitutePath(): Promise<object | null> {
394+
public async guessSubstitutePath(): Promise<object | null> {
393395
return new Promise((resolve) => {
394396
const child = spawn(getBinPath('dlv'), ['substitute-path-guess-helper']);
395397
let stdoutData = '';

extension/test/integration/goDebugConfiguration.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ suite('Debug Configuration Default DebugAdapter', () => {
979979
assert.strictEqual(resolvedConfig['debugAdapter'], 'dlv-dap');
980980
});
981981

982-
test("default debugAdapter for remote mode should be 'legacy' when not in Preview mode", async () => {
982+
test('default debugAdapter for remote mode should be determined by `dlv substitute-path-guess-helper`', async () => {
983983
const config = {
984984
name: 'Attach',
985985
type: 'go',
@@ -989,9 +989,14 @@ suite('Debug Configuration Default DebugAdapter', () => {
989989
cwd: '/path'
990990
};
991991

992-
const want = extensionInfo.isPreview ? 'dlv-dap' : 'legacy';
993992
await debugConfigProvider.resolveDebugConfiguration(undefined, config);
994993
const resolvedConfig = config as any;
994+
995+
const substitutePathGuess = await debugConfigProvider.guessSubstitutePath();
996+
let want = 'dlv-dap';
997+
if (substitutePathGuess === null) {
998+
want = 'legacy';
999+
}
9951000
assert.strictEqual(resolvedConfig['debugAdapter'], want);
9961001
});
9971002

0 commit comments

Comments
 (0)