diff --git a/setup/config.template b/setup/config.template index fb51e93..457082f 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 +set RelativePathToTests=Tests +set ExcludedPathForTestReport=%SourceCodePath%\%ProjectPureName%\%RelativePathToTests% set UEAutomationContentPath=%EnginePath%\Engine\Content\Automation set OpenCPPCoveragePath=C:\Program Files\OpenCppCoverage\OpenCppCoverage.exe diff --git a/tests/create_spec_file.bat b/tests/create_spec_file.bat index 69c9a1f..9e13976 100644 --- a/tests/create_spec_file.bat +++ b/tests/create_spec_file.bat @@ -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 @@ -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] :" diff --git a/tests/create_test_file.bat b/tests/create_test_file.bat index c750dc5..06035cb 100644 --- a/tests/create_test_file.bat +++ b/tests/create_test_file.bat @@ -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 @@ -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] :" diff --git a/tests/run_tests.bat b/tests/run_tests.bat index 2b3db90..1a6ea53 100644 --- a/tests/run_tests.bat +++ b/tests/run_tests.bat @@ -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 diff --git a/tests/set_TestRelativePath.bat b/tests/set_TestRelativePath.bat new file mode 100644 index 0000000..e90c065 --- /dev/null +++ b/tests/set_TestRelativePath.bat @@ -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 +)