Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion pipelines/game/unreal_game_test_runner.jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
'''
Expand Down
14 changes: 13 additions & 1 deletion pipelines/libs/vars/utils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@ def loadEnvironmentVariables(path){
value = props["${key}"]
env."${key}" = "${value}"
}
}
}

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(" ")
}
3 changes: 2 additions & 1 deletion setup/config.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
17 changes: 14 additions & 3 deletions tests/run_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down