Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle subprocess segfaults for testAdapters #21963

Merged
merged 15 commits into from
Sep 12, 2023
Prev Previous commit
Next Next commit
add logging
  • Loading branch information
eleanorjboyd committed Sep 11, 2023
commit 1ba5b823d64b69b73132ce0fbf2fda73f2be2609
29 changes: 19 additions & 10 deletions src/test/testing/common/testingAdapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,16 +92,28 @@ suite('End to End Tests: test adapters', () => {

await discoveryAdapter.discoverTests(workspaceUri).finally(() => {
// verification after discovery is complete
resultResolver.verify(
(x) => x.resolveDiscovery(typeMoq.It.isAny(), typeMoq.It.isAny()),
typeMoq.Times.once(),
);
// resultResolver.verify(
// (x) => x.resolveDiscovery(typeMoq.It.isAny(), typeMoq.It.isAny()),
// typeMoq.Times.once(),
// );

// 1. Check the status is "success"
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
// 2. Confirm no errors
assert.strictEqual(actualData.error, undefined, "Expected no errors in 'error' field");
// 3. Confirm tests are found
assert.ok(actualData.tests, 'Expected tests to be present');
});

await discoveryAdapter.discoverTests(Uri.parse(rootPathErrorWorkspace)).finally(() => {
// verification after discovery is complete

// 1. Check the status is "success"
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
// 2. Confirm no errors
assert.strictEqual(actualData.error, undefined, "Expected no errors in 'error' field");
// 3. Confirm tests are found
console.log(actualData.tests);
assert.ok(actualData.tests, 'Expected tests to be present');
});
});
Expand Down Expand Up @@ -269,7 +281,7 @@ suite('End to End Tests: test adapters', () => {
(x) => x.resolveExecution(typeMoq.It.isAny(), typeMoq.It.isAny()),
typeMoq.Times.once(),
);

console.log('for testing, data result', JSON.stringify(actualData));
eleanorjboyd marked this conversation as resolved.
Show resolved Hide resolved
// 1. Check the status is "success"
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
// 2. Confirm tests are found
Expand Down Expand Up @@ -372,7 +384,7 @@ suite('End to End Tests: test adapters', () => {
(x) => x.resolveExecution(typeMoq.It.isAny(), typeMoq.It.isAny()),
typeMoq.Times.once(),
);

console.log('for testing, data result', JSON.stringify(actualData));
eleanorjboyd marked this conversation as resolved.
Show resolved Hide resolved
// 1. Check the status is "success"
assert.strictEqual(actualData.status, 'success', "Expected status to be 'success'");
// 2. Confirm no errors
Expand Down Expand Up @@ -431,7 +443,6 @@ suite('End to End Tests: test adapters', () => {
});
});
test('unittest execution adapter seg fault error handling', async () => {
// generate list of test_ids
const testId = `test_seg_fault.TestSegmentationFault.test_segfault`;
const testIds: string[] = [testId];
let foundId = '';
Expand All @@ -447,6 +458,7 @@ suite('End to End Tests: test adapters', () => {
// 3. Confirm tests are found
assert.ok(data.result, 'Expected results to be present');
[foundId] = Object.keys(data.result);
console.log('for testing, data result', JSON.stringify(data));
return Promise.resolve();
});

Expand All @@ -470,7 +482,6 @@ suite('End to End Tests: test adapters', () => {
} as any),
);
await executionAdapter.runTests(workspaceUri, testIds, false, testRun.object).finally(() => {
// resolve execution should be called 200 times since there are 200 tests run.
resultResolver.verify(
(x) => x.resolveExecution(typeMoq.It.isAny(), typeMoq.It.isAny()),
typeMoq.Times.exactly(1),
Expand All @@ -483,7 +494,6 @@ suite('End to End Tests: test adapters', () => {
});
});
test('pytest execution adapter seg fault error handling', async () => {
// generate list of test_ids
const testId = `${rootPathErrorWorkspace}/test_seg_fault.py::TestSegmentationFault::test_segfault`;
const testIds: string[] = [testId];
let foundId = '';
Expand Down Expand Up @@ -522,7 +532,6 @@ suite('End to End Tests: test adapters', () => {
} as any),
);
await executionAdapter.runTests(workspaceUri, testIds, false, testRun.object, pythonExecFactory).finally(() => {
// resolve execution should be called 200 times since there are 200 tests run.
resultResolver.verify(
(x) => x.resolveExecution(typeMoq.It.isAny(), typeMoq.It.isAny()),
typeMoq.Times.exactly(1),
Expand Down