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
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
set RelativePathToTests=Tests
set ExcludedPathForTestReport=%SourceCodePath%\%ProjectPureName%\%RelativePathToTests%
set UEAutomationContentPath=%EnginePath%\Engine\Content\Automation
set OpenCPPCoveragePath=C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe
9 changes: 8 additions & 1 deletion tests/create_spec_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ call "%~dp0..\..\devops_data\config.bat"
:begin
set /p TestClassName= "Enter test class name (without word 'Test' in the name) :"
if [%TestClassName%]==[] goto:begin
set /p TestRelativePath= "Enter relative to [Source\%ProjectPureName%] directory (use \ symbol for subdirs):"

rem Setting TestRelativePath
call set_TestRelativePath.bat
if "%RETURNED_VALUE%"=="EXIT" goto:EOF

rem '.spec.cpp' file name
set TestCppFileName=%TestClassName%.spec.cpp
Expand All @@ -20,6 +23,10 @@ rem Confirmation
echo.
echo =========== File to be created: ===========
echo %TestCppFilePath%
echo.
echo =========== FYI: Path to be excluded from OpenCppCoverage report: ===========
echo %ExcludedPathForTestReport%*
echo.
echo ======================================
echo.
set /p UserConfirmed= "Confirm? [Y/N or (E)xit] :"
Expand Down
9 changes: 8 additions & 1 deletion tests/create_test_file.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ call "%~dp0..\..\devops_data\config.bat"
:begin
set /p TestClassName= "Enter test class name :"
if [%TestClassName%]==[] goto:begin
set /p TestRelativePath= "Enter relative to [Source\%ProjectPureName%] directory (use \ symbol for subdirs):"

rem Setting TestRelativePath
call set_TestRelativePath.bat
if "%RETURNED_VALUE%"=="EXIT" goto:EOF

rem .h / .cpp file names
set TestCppFileName=%TestClassName%.cpp
Expand All @@ -23,6 +26,10 @@ echo.
echo =========== Files to be created: ===========
echo %TestCppFilePath%
echo %TestHFilePath%
echo.
echo =========== FYI: Path to be excluded from OpenCppCoverage report: ===========
echo %ExcludedPathForTestReport%*
echo.
echo ======================================
echo.
set /p UserConfirmed= "Confirm? [Y/N or (E)xit] :"
Expand Down
6 changes: 3 additions & 3 deletions tests/run_tests.bat
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ set Module=%RETVAL%
call :NORMALIZEPATH "%SourceCodePath%"
set Sources=%RETVAL%

call :NORMALIZEPATH "%ExludedPathForTestReport%"
set ExludedSources=%RETVAL%
call :NORMALIZEPATH "%ExcludedPathForTestReport%"
set ExcludedSources=%RETVAL%

"%OpenCPPCoveragePath%" --modules="%Module%" --sources="%Sources%" ^
--excluded_sources="%ExludedSources%" --export_type="%ExportType%" -v -- %TestRunner%
--excluded_sources="%ExcludedSources%" --export_type="%ExportType%" -v -- %TestRunner%

rem clean obsolete artifacts
del /q LastCoverageResults.log
Expand Down
23 changes: 23 additions & 0 deletions tests/set_TestRelativePath.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
:: Copyright LifeEXE. All Rights Reserved.

@echo off

rem This script is designed to be called from create_spec_file.bat and create_test_file.bat
rem It sets TestRelativePath (relative path for saving the test files)

set TestRelativePath=%RelativePathToTests%
echo In what directory do you want to create the test file(s)? The target directory relative to [Source\%ProjectPureName%] is currently "%TestRelativePath%".
echo Please note that OpenCppCoverage will exclude tests from the following path: [%ExcludedPathForTestReport%*].
:change_TestRelativePath
set /p ChangeDirChoice= "Do you want to change the target directory? [Y/N or (E)xit] :"
set RETURNED_VALUE=
if /i "%ChangeDirChoice%"=="Y" (
set /p TestRelativePath= "Enter the new relative to [Source\%ProjectPureName%] directory (use \ symbol for subdirs) :"
) else if /i "%ChangeDirChoice%"=="e" (
set RETURNED_VALUE=EXIT
) else if /i "%ChangeDirChoice%"=="n" (
rem Just continue with the current TestRelativePath
) else (
echo Invalid ChangeDirChoice. Please enter Y, N or E.
goto change_TestRelativePath
)