Skip to content

Commit c4749e6

Browse files
committed
Try to trigger intermittent failure
Looks like LSP was not started for these tests
1 parent 8a4c5a3 commit c4749e6

File tree

2 files changed

+72
-69
lines changed

2 files changed

+72
-69
lines changed

.vscode-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module.exports = defineConfig({
7474
ui: "tdd",
7575
color: true,
7676
timeout,
77-
forbidOnly: isCIBuild,
77+
forbidOnly: false,
7878
grep: isFastTestRun ? "@slow" : undefined,
7979
invert: isFastTestRun,
8080
slow: 10000,

test/integration-tests/commands/build.test.ts

Lines changed: 71 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -25,84 +25,87 @@ import { continueSession, waitForDebugAdapterRequest } from "../../utilities/deb
2525
import { activateExtensionForSuite, folderInRootWorkspace } from "../utilities/testutilities";
2626
import { Version } from "../../../src/utilities/version";
2727

28-
suite("Build Commands @slow", function () {
29-
// Default timeout is a bit too short, give it a little bit more time
30-
this.timeout(3 * 60 * 1000);
28+
for (let i = 0; i < 25; ++i) {
29+
suite.only("Build Commands @slow " + i, function () {
30+
// Default timeout is a bit too short, give it a little bit more time
31+
this.timeout(3 * 60 * 1000);
3132

32-
let folderContext: FolderContext;
33-
let workspaceContext: WorkspaceContext;
34-
const uri = testAssetUri("defaultPackage/Sources/PackageExe/main.swift");
35-
const breakpoints = [
36-
new vscode.SourceBreakpoint(new vscode.Location(uri, new vscode.Position(2, 0))),
37-
];
33+
let folderContext: FolderContext;
34+
let workspaceContext: WorkspaceContext;
35+
const uri = testAssetUri("defaultPackage/Sources/PackageExe/main.swift");
36+
const breakpoints = [
37+
new vscode.SourceBreakpoint(new vscode.Location(uri, new vscode.Position(2, 0))),
38+
];
3839

39-
activateExtensionForSuite({
40-
async setup(ctx) {
41-
// The description of this package is crashing on Windows with Swift 5.9.x and below
42-
if (
43-
process.platform === "win32" &&
44-
ctx.globalToolchain.swiftVersion.isLessThan(new Version(5, 10, 0))
45-
) {
46-
this.skip();
47-
}
48-
// A breakpoint will have not effect on the Run command.
49-
vscode.debug.addBreakpoints(breakpoints);
40+
activateExtensionForSuite({
41+
async setup(ctx) {
42+
// The description of this package is crashing on Windows with Swift 5.9.x and below
43+
if (
44+
process.platform === "win32" &&
45+
ctx.globalToolchain.swiftVersion.isLessThan(new Version(5, 10, 0))
46+
) {
47+
this.skip();
48+
}
49+
// A breakpoint will have not effect on the Run command.
50+
vscode.debug.addBreakpoints(breakpoints);
5051

51-
workspaceContext = ctx;
52-
await waitForNoRunningTasks();
53-
folderContext = await folderInRootWorkspace("defaultPackage", workspaceContext);
54-
await workspaceContext.focusFolder(folderContext);
55-
},
56-
requiresDebugger: true,
57-
});
52+
workspaceContext = ctx;
53+
await waitForNoRunningTasks();
54+
folderContext = await folderInRootWorkspace("defaultPackage", workspaceContext);
55+
await workspaceContext.focusFolder(folderContext);
56+
},
57+
requiresDebugger: true,
58+
requiresLSP: true,
59+
});
5860

59-
suiteTeardown(async () => {
60-
vscode.debug.removeBreakpoints(breakpoints);
61-
});
61+
suiteTeardown(async () => {
62+
vscode.debug.removeBreakpoints(breakpoints);
63+
});
6264

63-
test("Swift: Run Build", async () => {
64-
const result = await vscode.commands.executeCommand(Commands.RUN, "PackageExe");
65-
expect(result).to.be.true;
66-
});
65+
test("Swift: Run Build", async () => {
66+
const result = await vscode.commands.executeCommand(Commands.RUN, "PackageExe");
67+
expect(result).to.be.true;
68+
});
6769

68-
test("Swift: Debug Build", async () => {
69-
// Promise used to indicate we hit the break point.
70-
// NB: "stopped" is the exact command when debuggee has stopped due to break point,
71-
// but "stackTrace" is the deterministic sync point we will use to make sure we can execute continue
72-
const bpPromise = waitForDebugAdapterRequest(
73-
"Debug PackageExe (defaultPackage)",
74-
workspaceContext.globalToolchain.swiftVersion,
75-
"stackTrace"
76-
);
70+
test("Swift: Debug Build", async () => {
71+
// Promise used to indicate we hit the break point.
72+
// NB: "stopped" is the exact command when debuggee has stopped due to break point,
73+
// but "stackTrace" is the deterministic sync point we will use to make sure we can execute continue
74+
const bpPromise = waitForDebugAdapterRequest(
75+
"Debug PackageExe (defaultPackage)",
76+
workspaceContext.globalToolchain.swiftVersion,
77+
"stackTrace"
78+
);
7779

78-
const resultPromise: Thenable<boolean> = vscode.commands.executeCommand(
79-
Commands.DEBUG,
80-
"PackageExe"
81-
);
80+
const resultPromise: Thenable<boolean> = vscode.commands.executeCommand(
81+
Commands.DEBUG,
82+
"PackageExe"
83+
);
8284

83-
await bpPromise;
84-
let succeeded = false;
85-
void resultPromise.then(s => (succeeded = s));
86-
while (!succeeded) {
87-
await continueSession();
88-
await new Promise(r => setTimeout(r, 500));
89-
}
90-
await expect(resultPromise).to.eventually.be.true;
91-
});
85+
await bpPromise;
86+
let succeeded = false;
87+
void resultPromise.then(s => (succeeded = s));
88+
while (!succeeded) {
89+
await continueSession();
90+
await new Promise(r => setTimeout(r, 500));
91+
}
92+
await expect(resultPromise).to.eventually.be.true;
93+
});
9294

93-
test("Swift: Clean Build", async () => {
94-
let result = await vscode.commands.executeCommand(Commands.RUN, "PackageExe");
95-
expect(result).to.be.true;
95+
test("Swift: Clean Build", async () => {
96+
let result = await vscode.commands.executeCommand(Commands.RUN, "PackageExe");
97+
expect(result).to.be.true;
9698

97-
const buildPath = path.join(folderContext.folder.fsPath, ".build");
98-
const beforeItemCount = (await fs.readdir(buildPath)).length;
99+
const buildPath = path.join(folderContext.folder.fsPath, ".build");
100+
const beforeItemCount = (await fs.readdir(buildPath)).length;
99101

100-
result = await vscode.commands.executeCommand(Commands.CLEAN_BUILD);
101-
expect(result).to.be.true;
102+
result = await vscode.commands.executeCommand(Commands.CLEAN_BUILD);
103+
expect(result).to.be.true;
102104

103-
const afterItemCount = (await fs.readdir(buildPath)).length;
104-
// .build folder is going to be filled with built artifacts after Commands.RUN command
105-
// After executing the clean command the build directory is guranteed to have less entry.
106-
expect(afterItemCount).to.be.lessThan(beforeItemCount);
105+
const afterItemCount = (await fs.readdir(buildPath)).length;
106+
// .build folder is going to be filled with built artifacts after Commands.RUN command
107+
// After executing the clean command the build directory is guranteed to have less entry.
108+
expect(afterItemCount).to.be.lessThan(beforeItemCount);
109+
});
107110
});
108-
});
111+
}

0 commit comments

Comments
 (0)