Build: add "make test" command for Windows, output log file

Differential Revision: https://developer.blender.org/D5715
This commit is contained in:
Brecht Van Lommel 2019-09-12 20:13:47 +02:00
parent 38d62a195b
commit 6472662d66
8 changed files with 41 additions and 4 deletions

View File

@ -62,8 +62,7 @@ Testing Targets
Not associated with building Blender.
* test:
Run ctest, currently tests import/export,
operator execution and that python modules load
Run automated tests with ctest.
* test_cmake:
Runs our own cmake file checker
which detects errors in the cmake file list definitions

View File

@ -18,6 +18,7 @@ def parse_arguments():
parser.add_argument("--cmake-command", default="cmake")
parser.add_argument("--svn-command", default="svn")
parser.add_argument("--git-command", default="git")
parser.add_argument("--config", default="")
parser.add_argument("build_directory")
return parser.parse_args()
@ -26,12 +27,17 @@ git_command = args.git_command
svn_command = args.svn_command
ctest_command = args.ctest_command
cmake_command = args.cmake_command
config = args.config
build_dir = args.build_directory
if shutil.which(ctest_command) is None:
sys.stderr.write("ctest not found, can't run tests\n")
sys.exit(1)
if shutil.which(git_command) is None:
sys.stderr.write("git not found, can't run tests\n")
sys.exit(1)
# Test if we are building a specific release version.
release_version = make_utils.git_branch_release_version(git_command)
lib_tests_dirpath = os.path.join('..', 'lib', "tests")
@ -43,6 +49,10 @@ if not os.path.exists(lib_tests_dirpath):
sys.stderr.write("svn not found, can't checkout test files\n")
sys.exit(1)
if shutil.which(cmake_command) is None:
sys.stderr.write("cmake not found, can't checkout test files\n")
sys.exit(1)
svn_url = make_utils.svn_libraries_base_url(release_version) + "/tests"
call([svn_command, "checkout", svn_url, lib_tests_dirpath])
@ -52,4 +62,7 @@ if not os.path.exists(lib_tests_dirpath):
# Run tests
os.chdir(build_dir)
call([ctest_command, ".", "--output-on-failure"])
command = [ctest_command, ".", "--output-on-failure"]
if len(config):
command += ["-C", config]
call(command)

View File

@ -1,15 +1,17 @@
REM find all dependencies and set the corresponding environment variables.
for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$PATH:X)
for %%X in (ctest.exe) do (set CTEST=%%~$PATH:X)
for %%X in (git.exe) do (set GIT=%%~$PATH:X)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe
if NOT "%verbose%" == "" (
echo svn : "%SVN%"
echo cmake : "%CMAKE%"
echo ctest : "%CTEST%"
echo git : "%GIT%"
echo python : "%PYTHON%"
)
if "%CMAKE%" == "" (
echo Cmake not found in path, required for building, exiting...
exit /b 1
)
)

View File

@ -92,6 +92,9 @@ if NOT "%1" == "" (
set MUST_CLEAN=1
) else if "%1" == "verbose" (
set VERBOSE=1
) else if "%1" == "test" (
set TEST=1
set NOBUILD=1
) else if "%1" == "format" (
set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9

View File

@ -29,3 +29,4 @@ set ASAN_CMAKE_ARGS=
set WITH_PYDEBUG=
set PYDEBUG_CMAKE_ARGS=
set FORMAT=
set TEST=

View File

@ -13,6 +13,7 @@ echo - update ^(Update both SVN and GIT^)
echo - code_update ^(Update only GIT^)
echo - nobuild ^(only generate project files^)
echo - showhash ^(Show git hashes of source tree^)
echo - test ^(Run automated tests with ctest^)
echo - format [path] ^(Format the source using clang-format, path is optional, requires python 3.x to be available^)
echo.
echo Configuration options

View File

@ -0,0 +1,13 @@
if EXIST %PYTHON% (
goto detect_python_done
)
echo python not found in lib folder
exit /b 1
:detect_python_done
REM Use -B to avoid writing __pycache__ in lib directory and causing update conflicts.
%PYTHON% -B %BLENDER_DIR%\build_files\utils\make_test.py --git-command "%GIT%" --svn-command "%SVN%" --cmake-command="%CMAKE%" --ctest-command="%CTEST%" --config="%BUILD_TYPE%" %BUILD_DIR%
:EOF

View File

@ -63,6 +63,11 @@ echo Building blender with VS%BUILD_VS_YEAR% for %BUILD_ARCH% in %BUILD_DIR%
call "%BLENDER_DIR%\build_files\windows\check_libraries.cmd"
if errorlevel 1 goto EOF
if "%TEST%" == "1" (
call "%BLENDER_DIR%\build_files\windows\test.cmd"
goto EOF
)
call "%BLENDER_DIR%\build_files\windows\check_submodules.cmd"
if errorlevel 1 goto EOF