From 9eff6c6b9d0cc5bacfcd99812c16e514270c2a16 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 6 Mar 2023 16:34:18 -0800 Subject: [PATCH 1/4] Add ClientOS to debugConfig --- .../debugger/extension/configuration/resolvers/attach.ts | 9 +++++---- .../debugger/extension/configuration/resolvers/base.ts | 3 +++ .../debugger/extension/configuration/resolvers/launch.ts | 3 +++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/client/debugger/extension/configuration/resolvers/attach.ts b/src/client/debugger/extension/configuration/resolvers/attach.ts index 635dc88dbac4..92d065504d20 100644 --- a/src/client/debugger/extension/configuration/resolvers/attach.ts +++ b/src/client/debugger/extension/configuration/resolvers/attach.ts @@ -26,6 +26,9 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver dbgConfig.debugOptions!.indexOf(item) === pos, ); } + if (debugConfiguration.clienOS === undefined){ + debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix' + } return debugConfiguration; } @@ -77,10 +80,8 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver debugConfiguration: DebugConfiguration, _token?: CancellationToken, ): Promise { + if (debugConfiguration.clienOS === undefined){ + debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix' + } return debugConfiguration as T; } diff --git a/src/client/debugger/extension/configuration/resolvers/launch.ts b/src/client/debugger/extension/configuration/resolvers/launch.ts index d5cb419e031d..f298ab5783a1 100644 --- a/src/client/debugger/extension/configuration/resolvers/launch.ts +++ b/src/client/debugger/extension/configuration/resolvers/launch.ts @@ -50,6 +50,9 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver Date: Mon, 6 Mar 2023 16:34:34 -0800 Subject: [PATCH 2/4] Update debug tests --- .../configuration/resolvers/attach.unit.test.ts | 14 +++++++++++--- .../configuration/resolvers/launch.unit.test.ts | 13 +++++++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts index 9d271b7acd90..9dc8cbe8b0d6 100644 --- a/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/attach.unit.test.ts @@ -26,11 +26,9 @@ getInfoPerOS().forEach(([osName, osType, path]) => { const options = [DebugOptions.RedirectOutput]; if (osType === platform.OSType.Windows) { options.push(DebugOptions.FixFilePathCase); - options.push(DebugOptions.WindowsClient); - } else { - options.push(DebugOptions.UnixClient); } options.push(DebugOptions.ShowReturnValue); + return options; } @@ -76,6 +74,10 @@ getInfoPerOS().forEach(([osName, osType, path]) => { } } + function getClientOS(){ + return osType === platform.OSType.Windows ? 'windows' : 'unix' + } + function setupWorkspaces(folders: string[]) { const workspaceFolders = folders.map(createMoqWorkspaceFolder); getWorkspaceFoldersStub.returns(workspaceFolders); @@ -119,6 +121,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('request', 'attach'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').deep.equal(debugOptionsAvailable); }); @@ -134,6 +137,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); expect(debugConfig).to.have.property('request', 'attach'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').deep.equal(debugOptionsAvailable); expect(debugConfig).to.have.property('host', 'localhost'); }); @@ -148,6 +152,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); expect(debugConfig).to.have.property('request', 'attach'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').deep.equal(debugOptionsAvailable); expect(debugConfig).to.have.property('host', 'localhost'); }); @@ -164,6 +169,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); expect(debugConfig).to.have.property('request', 'attach'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').deep.equal(debugOptionsAvailable); expect(debugConfig).to.not.have.property('localRoot'); expect(debugConfig).to.have.property('host', 'localhost'); @@ -181,6 +187,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.least(3); expect(debugConfig).to.have.property('request', 'attach'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').deep.equal(debugOptionsAvailable); expect(debugConfig).to.have.property('host', 'localhost'); }); @@ -486,6 +493,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { debugOptions, }); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('debugOptions').to.be.deep.equal(expectedDebugOptions); }); diff --git a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts index e7e256468f84..d72a3ca35dec 100644 --- a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts @@ -58,6 +58,10 @@ getInfoPerOS().forEach(([osName, osType, path]) => { return folder.object; } + function getClientOS(){ + return osType === platform.OSType.Windows ? 'windows' : 'unix' + } + function setupIoc(pythonPath: string, workspaceFolder?: WorkspaceFolder) { configService = TypeMoq.Mock.ofType(); diagnosticsService = TypeMoq.Mock.ofType(); @@ -160,6 +164,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); expect(debugConfig).to.have.property('request', 'launch'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -188,6 +193,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); expect(debugConfig).to.have.property('request', 'launch'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -215,6 +221,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); expect(debugConfig).to.have.property('request', 'launch'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -239,6 +246,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -264,6 +272,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); expect(debugConfig).to.have.property('request', 'launch'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -290,6 +299,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { expect(Object.keys(debugConfig!)).to.have.lengthOf.above(3); expect(debugConfig).to.have.property('type', 'python'); expect(debugConfig).to.have.property('request', 'launch'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.not.have.property('pythonPath'); expect(debugConfig).to.have.property('python', pythonPath); expect(debugConfig).to.have.property('debugAdapterPython', pythonPath); @@ -692,6 +702,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); expect(debugConfig).to.have.property('console', 'integratedTerminal'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('stopOnEntry', false); expect(debugConfig).to.have.property('showReturnValue', true); expect(debugConfig).to.have.property('debugOptions'); @@ -717,6 +728,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); expect(debugConfig).to.have.property('stopOnEntry', false); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('showReturnValue', true); expect(debugConfig).to.have.property('debugOptions'); expect((debugConfig as DebugConfiguration).debugOptions).to.be.deep.equal([]); @@ -736,6 +748,7 @@ getInfoPerOS().forEach(([osName, osType, path]) => { }); expect(debugConfig).to.have.property('console', 'integratedTerminal'); + expect(debugConfig).to.have.property('clientOS', getClientOS()); expect(debugConfig).to.have.property('stopOnEntry', false); expect(debugConfig).to.have.property('showReturnValue', true); expect(debugConfig).to.have.property('redirectOutput', true); From 5bf637f1f86ca32fe2cce75353c5a5fbeeca82fc Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 6 Mar 2023 17:05:33 -0800 Subject: [PATCH 3/4] Fix lint --- .../debugger/extension/configuration/resolvers/attach.ts | 8 ++++---- .../debugger/extension/configuration/resolvers/base.ts | 4 ++-- .../debugger/extension/configuration/resolvers/launch.ts | 2 +- .../extension/configuration/resolvers/attach.unit.test.ts | 4 ++-- .../extension/configuration/resolvers/launch.unit.test.ts | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/client/debugger/extension/configuration/resolvers/attach.ts b/src/client/debugger/extension/configuration/resolvers/attach.ts index 92d065504d20..096317bb065b 100644 --- a/src/client/debugger/extension/configuration/resolvers/attach.ts +++ b/src/client/debugger/extension/configuration/resolvers/attach.ts @@ -26,8 +26,8 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver dbgConfig.debugOptions!.indexOf(item) === pos, ); } - if (debugConfiguration.clienOS === undefined){ - debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix' + if (debugConfiguration.clienOS === undefined) { + debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix'; } return debugConfiguration; } @@ -80,8 +80,8 @@ export class AttachConfigurationResolver extends BaseConfigurationResolver debugConfiguration: DebugConfiguration, _token?: CancellationToken, ): Promise { - if (debugConfiguration.clienOS === undefined){ - debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix' + if (debugConfiguration.clienOS === undefined) { + debugConfiguration.clientOS = getOSType() === OSType.Windows ? 'windows' : 'unix'; } return debugConfiguration as T; } diff --git a/src/client/debugger/extension/configuration/resolvers/launch.ts b/src/client/debugger/extension/configuration/resolvers/launch.ts index f298ab5783a1..9513384f1277 100644 --- a/src/client/debugger/extension/configuration/resolvers/launch.ts +++ b/src/client/debugger/extension/configuration/resolvers/launch.ts @@ -50,7 +50,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver { } } - function getClientOS(){ - return osType === platform.OSType.Windows ? 'windows' : 'unix' + function getClientOS() { + return osType === platform.OSType.Windows ? 'windows' : 'unix'; } function setupWorkspaces(folders: string[]) { diff --git a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts index d72a3ca35dec..4830b88a34fb 100644 --- a/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts +++ b/src/test/debugger/extension/configuration/resolvers/launch.unit.test.ts @@ -58,8 +58,8 @@ getInfoPerOS().forEach(([osName, osType, path]) => { return folder.object; } - function getClientOS(){ - return osType === platform.OSType.Windows ? 'windows' : 'unix' + function getClientOS() { + return osType === platform.OSType.Windows ? 'windows' : 'unix'; } function setupIoc(pythonPath: string, workspaceFolder?: WorkspaceFolder) { From 9d67bd43e84d49b66fdb20be318783af4fde44ee Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Mon, 6 Mar 2023 17:45:09 -0800 Subject: [PATCH 4/4] Fix debugLauncher tests --- src/test/testing/common/debugLauncher.unit.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/testing/common/debugLauncher.unit.test.ts b/src/test/testing/common/debugLauncher.unit.test.ts index dfe9e8ce5e99..b8841c380308 100644 --- a/src/test/testing/common/debugLauncher.unit.test.ts +++ b/src/test/testing/common/debugLauncher.unit.test.ts @@ -205,6 +205,9 @@ suite('Unit Tests - Debug Launcher', () => { if (!expected.python) { expected.python = 'python'; } + if (!expected.clientOS) { + expected.clientOS = isOs(OSType.Windows) ? 'windows' : 'unix'; + } if (!expected.debugAdapterPython) { expected.debugAdapterPython = 'python'; }