summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValentin David <valentin.david@codethink.co.uk>2018-08-29 12:36:21 +0200
committerValentin David <valentin.david@codethink.co.uk>2018-08-29 12:38:45 +0200
commit60788e61648d368fad70c829978df8b72860e78f (patch)
tree0b91542834a568b24cb904ef3308e335b90222aa
parent7535fda8b3207a6020be3e7aee3337cda7dc6d56 (diff)
downloadbuildstream-valentindavid/post_tracking_errors.tar.gz
Report processing errors from trackingvalentindavid/post_tracking_errors
Failures to write files when tracking were not reported. Fixes #533.
-rw-r--r--buildstream/_scheduler/queues/trackqueue.py15
-rw-r--r--tests/frontend/track.py29
2 files changed, 32 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..3bcd719d4 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,31 @@ 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):
+ 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:
+ os.chmod(element_path, stat.S_IMODE(st.st_mode) & ~stat.S_IWUSR)
+
+ result = cli.run(project=project, args=['track', element_name])
+ result.assert_main_error(ErrorDomain.STREAM, None)
+ finally:
+ os.chmod(element_path, stat.S_IMODE(st.st_mode))