summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 11:36:00 +0000
committerTristan Van Berkom <tristan.van.berkom@gmail.com>2018-08-30 11:36:00 +0000
commit02138181d1153835d77f6ca7b8dbe108c478a3b8 (patch)
tree3a63247354558854a427aeeffc800462d5c1df58
parent26565f11b8dba375e21bf56af0ccf0092a8f8365 (diff)
parenta38d9163d70cfe4e872dc5bb12c1c117ec9098d0 (diff)
downloadbuildstream-02138181d1153835d77f6ca7b8dbe108c478a3b8.tar.gz
Merge branch 'valentindavid/post_tracking_errors' into 'master'
Report processing errors from tracking Closes #533 See merge request BuildStream/buildstream!747
-rw-r--r--buildstream/_scheduler/queues/trackqueue.py15
-rw-r--r--tests/frontend/track.py34
2 files changed, 37 insertions, 12 deletions
diff --git a/buildstream/_scheduler/queues/trackqueue.py b/buildstream/_scheduler/queues/trackqueue.py
index c7a8f4cc7..f443df3be 100644
--- a/buildstream/_scheduler/queues/trackqueue.py
+++ b/buildstream/_scheduler/queues/trackqueue.py
@@ -58,18 +58,9 @@ class TrackQueue(Queue):
# Set the new refs in the main process one by one as they complete
for unique_id, new_ref in result:
source = _plugin_lookup(unique_id)
- try:
- # We appear processed if at least one source has changed
- if source._save_ref(new_ref):
- changed = True
- except SourceError as e:
- # FIXME: We currently dont have a clear path to
- # fail the scheduler from the main process, so
- # this will just warn and BuildStream will exit
- # with a success code.
- #
- source.warn("Failed to update project file",
- detail="{}".format(e))
+ # We appear processed if at least one source has changed
+ if source._save_ref(new_ref):
+ changed = True
element._tracking_done()
diff --git a/tests/frontend/track.py b/tests/frontend/track.py
index 73b63ec4c..c7921fe4c 100644
--- a/tests/frontend/track.py
+++ b/tests/frontend/track.py
@@ -1,3 +1,4 @@
+import stat
import os
import pytest
from tests.testutils import cli, create_repo, ALL_REPO_KINDS, generate_junction
@@ -634,3 +635,36 @@ def test_track_junction_included(cli, tmpdir, datafiles, ref_storage, kind):
result = cli.run(project=project, args=['track', 'junction.bst'])
result.assert_success()
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
+def test_track_error_cannot_write_file(cli, tmpdir, datafiles, kind):
+ if os.geteuid() == 0:
+ pytest.skip("This is not testable with root permissions")
+
+ project = str(datafiles)
+ dev_files_path = os.path.join(project, 'files', 'dev-files')
+ element_path = os.path.join(project, 'elements')
+ element_name = 'track-test-{}.bst'.format(kind)
+
+ configure_project(project, {
+ 'ref-storage': 'inline'
+ })
+
+ repo = create_repo(kind, str(tmpdir))
+ ref = repo.create(dev_files_path)
+
+ element_full_path = os.path.join(element_path, element_name)
+ generate_element(repo, element_full_path)
+
+ st = os.stat(element_path)
+ try:
+ read_mask = stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH
+ os.chmod(element_path, stat.S_IMODE(st.st_mode) & ~read_mask)
+
+ result = cli.run(project=project, args=['track', element_name])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+ result.assert_task_error(ErrorDomain.SOURCE, 'save-ref-error')
+ finally:
+ os.chmod(element_path, stat.S_IMODE(st.st_mode))