diff --git a/pipelines/game/unreal_game_test_runner.jenkinsfile b/pipelines/game/unreal_game_test_runner.jenkinsfile index 97b16f6..e264a67 100644 --- a/pipelines/game/unreal_game_test_runner.jenkinsfile +++ b/pipelines/game/unreal_game_test_runner.jenkinsfile @@ -5,6 +5,18 @@ def ColorFromBuildResult(result){ return '#FF0000' } +def FormatExcludedPaths(paths) { + def prefix = "--excluded_sources=" + def pathList = paths.split(";") + def result = [] + + for (path in pathList) { + result.add("${prefix}\"${path}\"") + } + + env.EXCLUDED_SOURCES = result.join(" ") +} + pipeline { agent { node { @@ -86,12 +98,13 @@ pipeline { } stage('Test') { steps { + FormatExcludedPaths(EXCLUDED_SOURCES) bat ''' set TEST_RUNNER="%EDITOR_PATH%" "%PROJECT_PATH%" -ExecCmds="Automation %TEST_EXTRA_CMD%RunTests %TEST_NAMES%;Quit" ^ -ReportExportPath="%TEST_OUTPUT_PATH%" %EDITOR_FLAGS% "%OPEN_CPP_COVERAGE_PATH%" --modules="%BUILD_DIR%" --sources="%SOURCE_CODE_PATH%" ^ - --excluded_sources="%EXCLUDED_SOURCES%" --export_type="%CODE_COVERAGE_EXPORT_TYPE%" -- %TEST_RUNNER% + %EXCLUDED_SOURCES% --export_type="%CODE_COVERAGE_EXPORT_TYPE%" -- %TEST_RUNNER% if errorlevel 255 echo WARNING: Some tests failed, error code: %errorlevel% & exit /b 0 ''' diff --git a/pipelines/libs/vars/utils.groovy b/pipelines/libs/vars/utils.groovy index e0c1ffb..08e8f70 100644 --- a/pipelines/libs/vars/utils.groovy +++ b/pipelines/libs/vars/utils.groovy @@ -13,4 +13,16 @@ def loadEnvironmentVariables(path){ value = props["${key}"] env."${key}" = "${value}" } -} \ No newline at end of file +} + +def FormatExcludedPaths(paths) { + def prefix = "--excluded_sources=" + def pathList = paths.split(";") + def result = [] + + for (path in pathList) { + result.add("${prefix}\"${path}\"") + } + + env.EXCLUDED_SOURCES = result.join(" ") +} diff --git a/setup/config.template b/setup/config.template index fb51e93..7808c35 100644 --- a/setup/config.template +++ b/setup/config.template @@ -46,6 +46,7 @@ rem Tests set TestNames= set TestOutputLogPath=%ProjectRoot%\Build\Tests\Tests.log set ReportOutputPath=%ProjectRoot%\Build\Tests -set ExludedPathForTestReport=%SourceCodePath%\%ProjectPureName%\Tests +::To specify multiple paths for excluding sources, use the semicolon symbol ";". Example: %SourceCodePath%\%ProjectPureName%\Public\Tests;%SourceCodePath%\%ProjectPureName%\Private\Tests +set ExludedPathsForTestReport=%SourceCodePath%\%ProjectPureName%\Tests set UEAutomationContentPath=%EnginePath%\Engine\Content\Automation set OpenCPPCoveragePath=C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe diff --git a/tests/run_tests.bat b/tests/run_tests.bat index 2b3db90..4e4b7c1 100644 --- a/tests/run_tests.bat +++ b/tests/run_tests.bat @@ -30,11 +30,22 @@ set Module=%RETVAL% call :NORMALIZEPATH "%SourceCodePath%" set Sources=%RETVAL% -call :NORMALIZEPATH "%ExludedPathForTestReport%" -set ExludedSources=%RETVAL% +set "ExcludedSources=" +set First="true" +SETLOCAL ENABLEDELAYEDEXPANSION +for %%i in (%ExludedPathsForTestReport%) do ( + call :NORMALIZEPATH "%%i" + set PathToAdd=!RETVAL! + if !First!=="true" ( + set First="false" + set "ExcludedSources=--excluded_sources="!PathToAdd!"" + ) else ( + set "ExcludedSources=!ExcludedSources! --excluded_sources="!PathToAdd!"" + ) +) "%OpenCPPCoveragePath%" --modules="%Module%" --sources="%Sources%" ^ ---excluded_sources="%ExludedSources%" --export_type="%ExportType%" -v -- %TestRunner% +%ExcludedSources% --export_type="%ExportType%" -v -- %TestRunner% rem clean obsolete artifacts del /q LastCoverageResults.log