Skip to content
Snippets Groups Projects
Commit 6472662d authored by Brecht Van Lommel's avatar Brecht Van Lommel
Browse files

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

Differential Revision: https://developer.blender.org/D5715
parent 38d62a19
No related branches found
No related tags found
No related merge requests found
...@@ -62,8 +62,7 @@ Testing Targets ...@@ -62,8 +62,7 @@ Testing Targets
Not associated with building Blender. Not associated with building Blender.
* test: * test:
Run ctest, currently tests import/export, Run automated tests with ctest.
operator execution and that python modules load
* test_cmake: * test_cmake:
Runs our own cmake file checker Runs our own cmake file checker
which detects errors in the cmake file list definitions which detects errors in the cmake file list definitions
......
...@@ -18,6 +18,7 @@ def parse_arguments(): ...@@ -18,6 +18,7 @@ def parse_arguments():
parser.add_argument("--cmake-command", default="cmake") parser.add_argument("--cmake-command", default="cmake")
parser.add_argument("--svn-command", default="svn") parser.add_argument("--svn-command", default="svn")
parser.add_argument("--git-command", default="git") parser.add_argument("--git-command", default="git")
parser.add_argument("--config", default="")
parser.add_argument("build_directory") parser.add_argument("build_directory")
return parser.parse_args() return parser.parse_args()
...@@ -26,12 +27,17 @@ git_command = args.git_command ...@@ -26,12 +27,17 @@ git_command = args.git_command
svn_command = args.svn_command svn_command = args.svn_command
ctest_command = args.ctest_command ctest_command = args.ctest_command
cmake_command = args.cmake_command cmake_command = args.cmake_command
config = args.config
build_dir = args.build_directory build_dir = args.build_directory
if shutil.which(ctest_command) is None: if shutil.which(ctest_command) is None:
sys.stderr.write("ctest not found, can't run tests\n") sys.stderr.write("ctest not found, can't run tests\n")
sys.exit(1) 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. # Test if we are building a specific release version.
release_version = make_utils.git_branch_release_version(git_command) release_version = make_utils.git_branch_release_version(git_command)
lib_tests_dirpath = os.path.join('..', 'lib', "tests") lib_tests_dirpath = os.path.join('..', 'lib', "tests")
...@@ -43,6 +49,10 @@ if not os.path.exists(lib_tests_dirpath): ...@@ -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.stderr.write("svn not found, can't checkout test files\n")
sys.exit(1) 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" svn_url = make_utils.svn_libraries_base_url(release_version) + "/tests"
call([svn_command, "checkout", svn_url, lib_tests_dirpath]) call([svn_command, "checkout", svn_url, lib_tests_dirpath])
...@@ -52,4 +62,7 @@ if not os.path.exists(lib_tests_dirpath): ...@@ -52,4 +62,7 @@ if not os.path.exists(lib_tests_dirpath):
# Run tests # Run tests
os.chdir(build_dir) os.chdir(build_dir)
call([ctest_command, ".", "--output-on-failure"]) command = [ctest_command, ".", "--output-on-failure"]
if len(config):
command += ["-C", config]
call(command)
REM find all dependencies and set the corresponding environment variables. REM find all dependencies and set the corresponding environment variables.
for %%X in (svn.exe) do (set SVN=%%~$PATH:X) for %%X in (svn.exe) do (set SVN=%%~$PATH:X)
for %%X in (cmake.exe) do (set CMAKE=%%~$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) for %%X in (git.exe) do (set GIT=%%~$PATH:X)
set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe set PYTHON=%BLENDER_DIR%\..\lib\win64_vc14\python\37\bin\python.exe
if NOT "%verbose%" == "" ( if NOT "%verbose%" == "" (
echo svn : "%SVN%" echo svn : "%SVN%"
echo cmake : "%CMAKE%" echo cmake : "%CMAKE%"
echo ctest : "%CTEST%"
echo git : "%GIT%" echo git : "%GIT%"
echo python : "%PYTHON%" echo python : "%PYTHON%"
) )
......
...@@ -92,6 +92,9 @@ if NOT "%1" == "" ( ...@@ -92,6 +92,9 @@ if NOT "%1" == "" (
set MUST_CLEAN=1 set MUST_CLEAN=1
) else if "%1" == "verbose" ( ) else if "%1" == "verbose" (
set VERBOSE=1 set VERBOSE=1
) else if "%1" == "test" (
set TEST=1
set NOBUILD=1
) else if "%1" == "format" ( ) else if "%1" == "format" (
set FORMAT=1 set FORMAT=1
set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9 set FORMAT_ARGS=%2 %3 %4 %5 %6 %7 %8 %9
......
...@@ -29,3 +29,4 @@ set ASAN_CMAKE_ARGS= ...@@ -29,3 +29,4 @@ set ASAN_CMAKE_ARGS=
set WITH_PYDEBUG= set WITH_PYDEBUG=
set PYDEBUG_CMAKE_ARGS= set PYDEBUG_CMAKE_ARGS=
set FORMAT= set FORMAT=
set TEST=
...@@ -13,6 +13,7 @@ echo - update ^(Update both SVN and GIT^) ...@@ -13,6 +13,7 @@ echo - update ^(Update both SVN and GIT^)
echo - code_update ^(Update only GIT^) echo - code_update ^(Update only GIT^)
echo - nobuild ^(only generate project files^) echo - nobuild ^(only generate project files^)
echo - showhash ^(Show git hashes of source tree^) 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 - format [path] ^(Format the source using clang-format, path is optional, requires python 3.x to be available^)
echo. echo.
echo Configuration options echo Configuration options
......
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
...@@ -63,6 +63,11 @@ echo Building blender with VS%BUILD_VS_YEAR% for %BUILD_ARCH% in %BUILD_DIR% ...@@ -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" call "%BLENDER_DIR%\build_files\windows\check_libraries.cmd"
if errorlevel 1 goto EOF 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" call "%BLENDER_DIR%\build_files\windows\check_submodules.cmd"
if errorlevel 1 goto EOF if errorlevel 1 goto EOF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment