Skip to content

Commit

Permalink
Added optional version key to subproject config.
Browse files Browse the repository at this point in the history
This is used in the c-library (qhull) test, where now the output from the qhull executable is checked.
  • Loading branch information
GPMueller committed Sep 23, 2018
1 parent 0acceef commit 422ebbb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
11 changes: 10 additions & 1 deletion clang_build/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,17 @@ def __init__(self, config, environment, multiple_projects, is_root_project, pare
_LOGGER.info(f'[[{self.name}]]: external project downloaded')
self.working_directory = download_directory

if "version" in config:
version = config["version"]
try:
_subprocess.run(["git", "checkout", version], cwd=download_directory, stdout=_subprocess.PIPE, stderr=_subprocess.PIPE, encoding='utf-8')
except _subprocess.CalledProcessError as e:
error_message = f"[{target_name_full}]: error trying to checkout version \'{version}\' from url \'{url}\'. Message " + e.output
_LOGGER.exception(error_message)
raise RuntimeError(error_message)

# Get subset of config which contains targets not associated to any project name
self.targets_config = {key: val for key, val in config.items() if not key in ["subproject", "name", "url"]}
self.targets_config = {key: val for key, val in config.items() if not key in ["subproject", "name", "url", "version"]}

# Get subsets of config which define projects
self.subprojects_config = {key: val for key, val in config.items() if key == "subproject"}
Expand Down
5 changes: 3 additions & 2 deletions test/c-library/clang-build.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ dependencies = ["qhull.qhullcpp", "qhull.qhullstatic_r"]
################# Qhull #################

[[subproject]]
name = "qhull"
url = "/~https://github.com/qhull/qhull"
name = "qhull"
url = "/~https://github.com/qhull/qhull"
version = "v7.2.0"

# Qhull libraries

Expand Down
4 changes: 3 additions & 1 deletion test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,12 @@ def test_build_all(self):
clang_build_try_except(['-d', 'test/c-library', '-V', '-a'])

try:
output = subprocess.check_output(['./build/qhull/qhull-executable/default/bin/qhull'], stderr=subprocess.STDOUT).decode('utf-8').strip()
output = subprocess.check_output(['./build/qhull/qhull-executable/default/bin/qhull', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()
except subprocess.CalledProcessError:
self.fail('Could not run a target which should have been built')

self.assertEqual(output, 'qhull_r 7.2.0 (2015.2.r 2016/01/18)')

# def test_openmp(self):
# clang_build_try_except(['-d', 'test/openmp', '-V'])

Expand Down

0 comments on commit 422ebbb

Please sign in to comment.