You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:39:16 UTC
[buildstream] 02/15: tests/.../missing_dependencies: include git
This is an automated email from the ASF dual-hosted git repository.
not-in-ldap pushed a commit to branch aevri/enable_spawn_ci_7
in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 8004c61f6f9a791eb186c3f418df9c76fa5db83a
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Thu Oct 24 16:40:32 2019 +0100
tests/.../missing_dependencies: include git
Symlink `git` into the separate tools bin directory. BuildStream needs
`git` in order to be able to determine its version.
This missing dependency is revealed when you run these tests in `spawn`
mode, as it will re-run the base __init__.__version__ logic in a new
process.
Also take the opportunity to extract _symlink_host_tools_to_dir(), to
re-use some code.
---
tests/sandboxes/missing_dependencies.py | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/tests/sandboxes/missing_dependencies.py b/tests/sandboxes/missing_dependencies.py
index 975c8eb..a5bf31e 100644
--- a/tests/sandboxes/missing_dependencies.py
+++ b/tests/sandboxes/missing_dependencies.py
@@ -18,13 +18,19 @@ DATA_DIR = os.path.join(
)
+def _symlink_host_tools_to_dir(host_tools, dir_):
+ dir_.mkdir(exist_ok=True)
+ for tool in host_tools:
+ target_path = dir_ / tool
+ os.symlink(utils.get_host_tool(tool), str(target_path))
+
+
@pytest.mark.skipif(not IS_LINUX, reason='Only available on Linux')
@pytest.mark.datafiles(DATA_DIR)
-def test_missing_brwap_has_nice_error_message(cli, datafiles, tmp_path):
- # Create symlink to buildbox-casd to work with custom PATH
- buildbox_casd = tmp_path.joinpath('bin/buildbox-casd')
- buildbox_casd.parent.mkdir()
- os.symlink(utils.get_host_tool('buildbox-casd'), str(buildbox_casd))
+def test_missing_bwrap_has_nice_error_message(cli, datafiles, tmp_path):
+ # Create symlink to buildbox-casd and git to work with custom PATH
+ bin_dir = tmp_path / "bin"
+ _symlink_host_tools_to_dir(['buildbox-casd', 'git'], bin_dir)
project = str(datafiles)
element_path = os.path.join(project, 'elements', 'element.bst')
@@ -50,7 +56,7 @@ def test_missing_brwap_has_nice_error_message(cli, datafiles, tmp_path):
result = cli.run(
project=project,
args=['build', 'element.bst'],
- env={'PATH': str(tmp_path.joinpath('bin')),
+ env={'PATH': str(bin_dir),
'BST_FORCE_SANDBOX': None})
result.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox')
assert "not found" in result.stderr
@@ -69,9 +75,9 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path):
bwrap.chmod(0o755)
- # Create symlink to buildbox-casd to work with custom PATH
- buildbox_casd = tmp_path.joinpath('bin/buildbox-casd')
- os.symlink(utils.get_host_tool('buildbox-casd'), str(buildbox_casd))
+ # Create symlink to buildbox-casd and git to work with custom PATH
+ bin_dir = tmp_path / "bin"
+ _symlink_host_tools_to_dir(['buildbox-casd', 'git'], bin_dir)
project = str(datafiles)
element_path = os.path.join(project, 'elements', 'element3.bst')
@@ -97,7 +103,7 @@ def test_old_brwap_has_nice_error_message(cli, datafiles, tmp_path):
result = cli.run(
project=project,
args=['--debug', '--verbose', 'build', 'element3.bst'],
- env={'PATH': str(tmp_path.joinpath('bin')),
+ env={'PATH': str(bin_dir),
'BST_FORCE_SANDBOX': None})
result.assert_task_error(ErrorDomain.SANDBOX, 'unavailable-local-sandbox')
assert "too old" in result.stderr