Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • willsalmon/buildstream
  • CumHoleZH/buildstream
  • tchaik/buildstream
  • DCotyPortfolio/buildstream
  • jesusoctavioas/buildstream
  • patrickmmartin/buildstream
  • franred/buildstream
  • tintou/buildstream
  • alatiera/buildstream
  • martinblanchard/buildstream
  • neverdie22042524/buildstream
  • Mattlk13/buildstream
  • PServers/buildstream
  • phamnghia610909/buildstream
  • chiaratolentino/buildstream
  • eysz7-x-x/buildstream
  • kerrick1/buildstream
  • matthew-yates/buildstream
  • twofeathers/buildstream
  • mhadjimichael/buildstream
  • pointswaves/buildstream
  • Mr.JackWilson/buildstream
  • Tw3akG33k/buildstream
  • AlexFazakas/buildstream
  • eruidfkiy/buildstream
  • clamotion2/buildstream
  • nanonyme/buildstream
  • wickyjaaa/buildstream
  • nmanchev/buildstream
  • bojorquez.ja/buildstream
  • mostynb/buildstream
  • highpit74/buildstream
  • Demo112/buildstream
  • ba2014sheer/buildstream
  • tonimadrino/buildstream
  • usuario2o/buildstream
  • Angelika123456/buildstream
  • neo355/buildstream
  • corentin-ferlay/buildstream
  • coldtom/buildstream
  • wifitvbox81/buildstream
  • 358253885/buildstream
  • seanborg/buildstream
  • SotK/buildstream
  • DouglasWinship/buildstream
  • karansthr97/buildstream
  • louib/buildstream
  • bwh-ct/buildstream
  • robjh/buildstream
  • we88c0de/buildstream
  • zhengxian5555/buildstream
51 results
Show changes
Commits on Source (3)
...@@ -31,7 +31,7 @@ import shutil ...@@ -31,7 +31,7 @@ import shutil
import subprocess import subprocess
from ruamel.yaml.comments import CommentedSet from ruamel.yaml.comments import CommentedSet
from tests.testutils import cli, create_repo, ALL_REPO_KINDS, wait_for_cache_granularity from tests.testutils import cli, create_repo, ALL_REPO_KINDS, wait_for_cache_granularity
from tests.testutils import create_artifact_share from tests.testutils import create_artifact_share, create_element_size
from buildstream import _yaml from buildstream import _yaml
from buildstream._exceptions import ErrorDomain, LoadError, LoadErrorReason from buildstream._exceptions import ErrorDomain, LoadError, LoadErrorReason
...@@ -121,7 +121,7 @@ class WorkspaceCreater(): ...@@ -121,7 +121,7 @@ class WorkspaceCreater():
return element_tuples return element_tuples
def open_workspaces(self, kinds, track, suffixs=None, workspace_dir=None, def open_workspaces(self, kinds, track, suffixs=None, workspace_dir=None,
element_attrs=None): element_attrs=None, no_checkout=False):
element_tuples = self.create_workspace_elements(kinds, track, suffixs, workspace_dir, element_tuples = self.create_workspace_elements(kinds, track, suffixs, workspace_dir,
element_attrs) element_attrs)
...@@ -132,6 +132,8 @@ class WorkspaceCreater(): ...@@ -132,6 +132,8 @@ class WorkspaceCreater():
args = ['workspace', 'open'] args = ['workspace', 'open']
if track: if track:
args.append('--track') args.append('--track')
if no_checkout:
args.append('--no-checkout')
if workspace_dir is not None: if workspace_dir is not None:
assert len(element_tuples) == 1, "test logic error" assert len(element_tuples) == 1, "test logic error"
_, workspace_dir = element_tuples[0] _, workspace_dir = element_tuples[0]
...@@ -142,25 +144,26 @@ class WorkspaceCreater(): ...@@ -142,25 +144,26 @@ class WorkspaceCreater():
result.assert_success() result.assert_success()
# Assert that we are now buildable because the source is now cached. if not no_checkout:
states = self.cli.get_element_states(self.project_path, [ # Assert that we are now buildable because the source is now cached.
e for e, _ in element_tuples states = self.cli.get_element_states(self.project_path, [
]) e for e, _ in element_tuples
assert not any(states[e] != 'buildable' for e, _ in element_tuples) ])
assert not any(states[e] != 'buildable' for e, _ in element_tuples)
# Check that the executable hello file is found in each workspace # Check that the executable hello file is found in each workspace
for element_name, workspace_dir in element_tuples: for element_name, workspace_dir in element_tuples:
filename = os.path.join(workspace_dir, 'usr', 'bin', 'hello') filename = os.path.join(workspace_dir, 'usr', 'bin', 'hello')
assert os.path.exists(filename) assert os.path.exists(filename)
return element_tuples return element_tuples
def open_workspace(cli, tmpdir, datafiles, kind, track, suffix='', workspace_dir=None, def open_workspace(cli, tmpdir, datafiles, kind, track, suffix='', workspace_dir=None,
project_path=None, element_attrs=None): project_path=None, element_attrs=None, no_checkout=False):
workspace_object = WorkspaceCreater(cli, tmpdir, datafiles, project_path) workspace_object = WorkspaceCreater(cli, tmpdir, datafiles, project_path)
workspaces = workspace_object.open_workspaces((kind, ), track, (suffix, ), workspace_dir, workspaces = workspace_object.open_workspaces((kind, ), track, (suffix, ), workspace_dir,
element_attrs) element_attrs, no_checkout)
assert len(workspaces) == 1 assert len(workspaces) == 1
element_name, workspace = workspaces[0] element_name, workspace = workspaces[0]
return element_name, workspace_object.project_path, workspace return element_name, workspace_object.project_path, workspace
...@@ -1073,25 +1076,35 @@ def test_multiple_failed_builds(cli, tmpdir, datafiles): ...@@ -1073,25 +1076,35 @@ def test_multiple_failed_builds(cli, tmpdir, datafiles):
@pytest.mark.parametrize('subdir', [True, False], ids=["subdir", "no-subdir"]) @pytest.mark.parametrize('subdir', [True, False], ids=["subdir", "no-subdir"])
@pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"]) @pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"])
def test_external_fetch(cli, datafiles, tmpdir_factory, subdir, guess_element): def test_external_fetch(cli, datafiles, tmpdir_factory, subdir, guess_element):
# Fetching from a workspace outside a project doesn't fail horribly # An element with an open workspace can't be fetched, but we still expect fetches
# to fetch any dependencies
tmpdir = tmpdir_factory.mktemp('') tmpdir = tmpdir_factory.mktemp('')
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, "git", False) depend_element = 'fetchable.bst'
# Create an element to fetch (local sources do not need to fetch)
create_element_size(depend_element, str(datafiles), 'elements', [], 1024)
element_name, project, workspace = open_workspace(
cli, tmpdir, datafiles, "git", False, no_checkout=True,
element_attrs={'depends': [depend_element]}
)
arg_elm = [element_name] if not guess_element else [] arg_elm = [element_name] if not guess_element else []
if subdir: if subdir:
call_dir = os.path.join(workspace, 'usr') call_dir = os.path.join(workspace, 'usr')
os.makedirs(call_dir, exist_ok=True)
else: else:
call_dir = workspace call_dir = workspace
# Assert that the depended element is not fetched yet
assert cli.get_element_state(str(datafiles), depend_element) == 'fetch needed'
# Fetch the workspaced element
result = cli.run(project=project, args=['-C', call_dir, 'source', 'fetch'] + arg_elm) result = cli.run(project=project, args=['-C', call_dir, 'source', 'fetch'] + arg_elm)
result.assert_success() result.assert_success()
# We already fetched it by opening the workspace, but we're also checking # Assert that the depended element has now been fetched
# `bst show` works here assert cli.get_element_state(str(datafiles), depend_element) == 'buildable'
result = cli.run(project=project,
args=['-C', call_dir, 'show', '--deps', 'none', '--format', '%{state}'] + arg_elm)
result.assert_success()
assert result.output.strip() == 'buildable'
@pytest.mark.datafiles(DATA_DIR) @pytest.mark.datafiles(DATA_DIR)
...@@ -1120,16 +1133,24 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element): ...@@ -1120,16 +1133,24 @@ def test_external_push_pull(cli, datafiles, tmpdir_factory, guess_element):
@pytest.mark.datafiles(DATA_DIR) @pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"]) @pytest.mark.parametrize("guess_element", [True, False], ids=["guess", "no-guess"])
def test_external_track(cli, datafiles, tmpdir_factory, guess_element): def test_external_track(cli, datafiles, tmpdir_factory, guess_element):
# Tracking does not get horribly confused
tmpdir = tmpdir_factory.mktemp('') tmpdir = tmpdir_factory.mktemp('')
element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, "git", True) element_name, project, workspace = open_workspace(cli, tmpdir, datafiles, "git", False)
element_file = os.path.join(str(datafiles), 'elements', element_name)
arg_elm = [element_name] if not guess_element else [] arg_elm = [element_name] if not guess_element else []
# The workspace is necessarily already tracked, so we only care that # Delete the ref from the source so that we can detect if the
# there's no weird errors. # element has been tracked
element_contents = _yaml.load(element_file)
del element_contents['sources'][0]['ref']
_yaml.dump(_yaml.node_sanitize(element_contents), element_file)
result = cli.run(project=project, args=['-C', workspace, 'source', 'track'] + arg_elm) result = cli.run(project=project, args=['-C', workspace, 'source', 'track'] + arg_elm)
result.assert_success() result.assert_success()
# Element is tracked now
element_contents = _yaml.load(element_file)
assert 'ref' in element_contents['sources'][0]
@pytest.mark.datafiles(DATA_DIR) @pytest.mark.datafiles(DATA_DIR)
def test_external_open_other(cli, datafiles, tmpdir_factory): def test_external_open_other(cli, datafiles, tmpdir_factory):
......