Skip to content

Commit 41fab20

Browse files
committed
Retry integration tests only on segfault
1 parent a8bad9e commit 41fab20

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

extensions/ql-vscode/src/vscode-tests/run-integration-tests.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,24 @@ type Suite = {
1111
};
1212

1313
/**
14-
* Run an integration test suite `suite` at most `tries` times, or
15-
* until it succeeds, whichever comes first.
16-
*
17-
* TODO: Presently there is no way to distinguish a legitimately
18-
* failed test run from the test runner being terminated by a signal.
19-
* If in the future there arises a way to distinguish these cases
20-
* (e.g. https://github.com/microsoft/vscode-test/pull/56) only retry
21-
* in the terminated-by-signal case.
14+
* Run an integration test suite `suite`, retrying if it segfaults, at
15+
* most `tries` times.
2216
*/
23-
async function runTestsWithRetry(suite: Suite, tries: number): Promise<void> {
17+
async function runTestsWithRetryOnSegfault(suite: Suite, tries: number): Promise<void> {
2418
for (let t = 0; t < tries; t++) {
2519
try {
2620
// Download and unzip VS Code if necessary, and run the integration test suite.
2721
await runTests(suite);
2822
return;
2923
} catch (err) {
30-
console.error(`Exception raised while running tests: ${err}`);
31-
if (t < tries - 1)
32-
console.log('Retrying...');
24+
if (err === 'SIGSEGV') {
25+
console.error('Test runner segfaulted.');
26+
if (t < tries - 1)
27+
console.error('Retrying...');
28+
}
29+
else {
30+
throw err;
31+
}
3332
}
3433
}
3534
console.error(`Tried running suite ${tries} time(s), still failed, giving up.`);
@@ -67,7 +66,7 @@ async function main() {
6766
];
6867

6968
for (const integrationTestSuite of integrationTestSuites) {
70-
await runTestsWithRetry(integrationTestSuite, 3);
69+
await runTestsWithRetryOnSegfault(integrationTestSuite, 3);
7170
}
7271
} catch (err) {
7372
console.error(`Unexpected exception while running tests: ${err}`);

0 commit comments

Comments
 (0)