From fd8886be33278009ceb032d8946990c5d765d1a4 Mon Sep 17 00:00:00 2001 From: Tofik Sonono Date: Thu, 21 Nov 2024 11:19:12 +0100 Subject: [PATCH] Review fixes + disable coverage test on Win MSVC can not produce gcov based coverage data, therefore the coverage end-to-end tests are disabled on Windows. --- src/coverage.ts | 2 +- src/ctest.ts | 4 ++-- test/end-to-end-tests/single-root-UI/test/coverage.test.ts | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/coverage.ts b/src/coverage.ts index feb1a10af..b4d4caabe 100644 --- a/src/coverage.ts +++ b/src/coverage.ts @@ -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) { for (const coverageInfoFile of coverageInfoFiles) { diff --git a/src/ctest.ts b/src/ctest.ts index eadabe6dd..455331782 100644 --- a/src/ctest.ts +++ b/src/ctest.ts @@ -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; } } } @@ -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; } } } diff --git a/test/end-to-end-tests/single-root-UI/test/coverage.test.ts b/test/end-to-end-tests/single-root-UI/test/coverage.test.ts index c836c28c4..5ec196323 100644 --- a/test/end-to-end-tests/single-root-UI/test/coverage.test.ts +++ b/test/end-to-end-tests/single-root-UI/test/coverage.test.ts @@ -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 { @@ -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');