Skip to content

Commit 32908a8

Browse files
committed
Fixup debugging on Linux
1 parent a0b5e53 commit 32908a8

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

src/debugger/buildConfig.ts

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,39 @@ export class DebugConfigurationFactory {
8888
switch (process.platform) {
8989
case "win32":
9090
return this.buildWindowsConfig();
91-
default:
91+
case "darwin":
9292
return this.buildDarwinConfg();
93+
default:
94+
return this.buildLinuxConfig();
9395
}
9496
}
9597

9698
/* eslint-disable no-case-declarations */
99+
private buildLinuxConfig(): vscode.DebugConfiguration | null {
100+
if (this.testKind === TestKind.debug && this.testLibrary === TestLibrary.xctest) {
101+
const { folder } = getFolderAndNameSuffix(this.ctx, this.expandEnvVariables);
102+
const buildDirectory = BuildFlags.buildDirectoryFromWorkspacePath(folder, true);
103+
return {
104+
...this.baseConfig,
105+
program: path.join(
106+
buildDirectory,
107+
"debug",
108+
this.ctx.swiftPackage.name + "PackageTests.xctest"
109+
),
110+
args: this.testList,
111+
env: {
112+
...swiftRuntimeEnv(),
113+
...configuration.folder(this.ctx.workspaceFolder).testEnvironmentVariables,
114+
},
115+
};
116+
} else {
117+
return this.buildDarwinConfg();
118+
}
119+
}
120+
97121
private buildDarwinConfg(): vscode.DebugConfiguration | null {
98122
switch (this.testLibrary) {
99-
case "swift-testing":
123+
case TestLibrary.swiftTesting:
100124
switch (this.testKind) {
101125
case TestKind.debug:
102126
// In the debug case we need to build the .swift-testing executable and then
@@ -158,7 +182,7 @@ export class DebugConfigurationFactory {
158182
: this.baseConfig.preLaunchTask,
159183
};
160184
}
161-
case "XCTest":
185+
case TestLibrary.xctest:
162186
switch (this.testKind) {
163187
case TestKind.debug:
164188
const xcTestPath = this.ctx.workspaceContext.toolchain.xcTestPath;
@@ -238,8 +262,6 @@ export class DebugConfigurationFactory {
238262
: this.baseConfig.preLaunchTask,
239263
};
240264
}
241-
default:
242-
return null;
243265
}
244266
}
245267

0 commit comments

Comments
 (0)