diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-29 12:13:41 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-08-30 19:01:50 +0300 |
commit | 718747c5895067c261a3fc11e9918fc1a8f1d385 (patch) | |
tree | 81611125be770339eb65789d4928cd72e913cdb8 /build_files/utils/make_test.py | |
parent | 464e545c723616372bfeec8e955bf1177437fa32 (diff) |
Tests: auto download test files when running "make test"
Diffstat (limited to 'build_files/utils/make_test.py')
-rwxr-xr-x | build_files/utils/make_test.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/build_files/utils/make_test.py b/build_files/utils/make_test.py index 1522631de4b..0a5e4055a18 100755 --- a/build_files/utils/make_test.py +++ b/build_files/utils/make_test.py @@ -7,6 +7,7 @@ import os import shutil import sys +import make_utils from make_utils import call # Parse arguments @@ -14,17 +15,41 @@ from make_utils import call def parse_arguments(): parser = argparse.ArgumentParser() parser.add_argument("--ctest-command", default="ctest") + parser.add_argument("--cmake-command", default="cmake") + parser.add_argument("--svn-command", default="svn") + parser.add_argument("--git-command", default="git") parser.add_argument("build_directory") return parser.parse_args() args = parse_arguments() +git_command = args.git_command +svn_command = args.svn_command ctest_command = args.ctest_command +cmake_command = args.cmake_command 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) +# 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") + +if not os.path.exists(lib_tests_dirpath): + print("Tests files not found, downloading...") + + if shutil.which(svn_command) is None: + sys.stderr.write("svn 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]) + + # Run cmake again to detect tests files. + os.chdir(build_dir) + call([cmake_command, "."]) + # Run tests os.chdir(build_dir) call([ctest_command, ".", "--output-on-failure"]) |