Skip to content

Commit

Permalink
Review fixes + disable coverage test on Win
Browse files Browse the repository at this point in the history
MSVC can not produce gcov based coverage data, therefore the coverage
end-to-end tests are disabled on Windows.
  • Loading branch information
TSonono committed Nov 21, 2024
1 parent 8542165 commit fd8886b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/coverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import * as logging from '@cmt/logging';
nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFormat.standalone })();
const localize: nls.LocalizeFunc = nls.loadMessageBundle();

const log = logging.createLogger('ctest');
const log = logging.createLogger('ctest-coverage');

export async function handleCoverageInfoFiles(run: vscode.TestRun, coverageInfoFiles: string[], coverageData: WeakMap<vscode.FileCoverage, vscode.FileCoverageDetail[]>) {
for (const coverageInfoFile of coverageInfoFiles) {
Expand Down
4 changes: 2 additions & 2 deletions src/ctest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ export class CTestDriver implements vscode.Disposable {
if (rc !== 0) {
log.error(localize('test.preRunCoverageTargetFailure', 'Building the preRunCoverageTarget \'{0}\' on project in {1} failed. Skipping running tests.', projectCoverageConfig.preRunCoverageTarget, projectCoverageConfig.project.sourceDir));
run.end();
return 0;
return rc;
}
}
}
Expand All @@ -970,7 +970,7 @@ export class CTestDriver implements vscode.Disposable {
const rc = await projectCoverageConfig.project.build([projectCoverageConfig.postRunCoverageTarget]);
if (rc !== 0) {
log.error(localize('test.postRunCoverageTargetFailure', 'Building target postRunCoverageTarget on project in {0} failed. Skipping handling of coverage data.', projectCoverageConfig.project.sourceDir));
return 0;
return rc;
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions test/end-to-end-tests/single-root-UI/test/coverage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DefaultEnvironment, expect } from '@test/util';
import * as vscode from 'vscode';
import * as fs from 'fs';
import * as path from 'path';
import * as os from 'os';

// From vscode: src/vs/workbench/contrib/testing/common/testTypes.ts
const enum TestResultState {
Expand All @@ -25,6 +26,11 @@ suite('Coverage integration', () => {

testEnv = new DefaultEnvironment('test/end-to-end-tests/single-root-UI/project-folder', build_loc, exe_res);

if (os.platform() === 'win32') {
// MSVC compiler does not produce gcov based coverage data
return this.skip();
}

await vscode.workspace.getConfiguration('cmake', vscode.workspace.workspaceFolders![0].uri).update('useCMakePresets', 'always');
await vscode.commands.executeCommand('cmake.getSettingsChangePromise');

Expand Down

0 comments on commit fd8886b

Please sign in to comment.