Skip to content

Commit 7172505

Browse files
authored
Merge pull request #328 from jcreedcmu/jcreed/restart-on-segfault
Retry integration tests only on segfault
2 parents 17901be + 41fab20 commit 7172505

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed

common/config/rush/pnpm-lock.yaml

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@
597597
"typescript-config": "^0.0.1",
598598
"typescript-formatter": "^7.2.2",
599599
"vsce": "^1.65.0",
600-
"vscode-test": "^1.0.0",
600+
"vscode-test": "^1.4.0",
601601
"webpack": "^4.38.0",
602602
"webpack-cli": "^3.3.2",
603603
"eslint": "~6.8.0",

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)