Skip to content

Commit

Permalink
Exclude tests module from OpenCppCoverage report
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelBCG committed Apr 23, 2024
1 parent f25178f commit 6752830
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/run_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,21 @@ set Sources=%RETVAL%
call :NORMALIZEPATH "%ExcludedPathForTestReport%"
set ExcludedSources=%RETVAL%

"%OpenCPPCoveragePath%" --modules="%Module%" --sources="%Sources%" ^
--excluded_sources="%ExcludedSources%" --export_type="%ExportType%" -v -- %TestRunner%
rem Make command to run OpenCppCoverage

set RunOpenCppCoverageCommand="%OpenCPPCoveragePath%" --modules="%Module%" --sources="%Sources%"

:: Exclude module with tests from cpp coverage report if the module is defined in config.bat
if [%TestsModuleName%]==[] goto :afterAddingTestsModule
set "TestsModulePath=%Sources%\%TestsModuleName%"
:: excluded_sources argument can be used multiple times
set RunOpenCppCoverageCommand=%RunOpenCppCoverageCommand% --excluded_sources="%TestsModulePath%"
:afterAddingTestsModule

set RunOpenCppCoverageCommand=%RunOpenCppCoverageCommand% --excluded_sources="%ExcludedSources%" --export_type="%ExportType%" -v -- %TestRunner%

:: Run OpenCppCoverage
%RunOpenCppCoverageCommand%

rem clean obsolete artifacts
del /q LastCoverageResults.log
Expand Down

0 comments on commit 6752830

Please sign in to comment.