diff options
author | Jürg Billeter <j@bitron.ch> | 2020-01-13 11:26:02 +0100 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2020-01-13 11:31:14 +0100 |
commit | 0cf763ab40f94ec9377263a864b197a972213c84 (patch) | |
tree | 972ee7f8db6ef32e6a13688d317d585923424862 | |
parent | 730302e250d8ebdd143c9188d353ea24669306ae (diff) | |
download | buildstream-0cf763ab40f94ec9377263a864b197a972213c84.tar.gz |
_sandboxreapi.py: Improve batch command logging
This adds a timed activity message to bring batch command logging for
REAPI-based sandboxes in line with the default sandbox as far as
possible.
Thix fixes 3 xfails with buildbox-run.
-rw-r--r-- | src/buildstream/sandbox/_sandboxreapi.py | 11 | ||||
-rw-r--r-- | tests/integration/manual.py | 1 | ||||
-rw-r--r-- | tests/integration/messages.py | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/src/buildstream/sandbox/_sandboxreapi.py b/src/buildstream/sandbox/_sandboxreapi.py index ec31b97f1..2430fd372 100644 --- a/src/buildstream/sandbox/_sandboxreapi.py +++ b/src/buildstream/sandbox/_sandboxreapi.py @@ -171,8 +171,15 @@ class _SandboxREAPIBatch(_SandboxBatch): self.main_group.execute(self) first = self.first_command - if first and self.sandbox.run(["sh", "-c", "-e", self.script], self.flags, cwd=first.cwd, env=first.env) != 0: - raise SandboxCommandError("Command execution failed", collect=self.collect) + if first: + context = self.sandbox._get_context() + with context.messenger.timed_activity( + "Running commands", + detail=self.main_group.combined_label(), + element_name=self.sandbox._get_element_name(), + ): + if self.sandbox.run(["sh", "-c", "-e", self.script], self.flags, cwd=first.cwd, env=first.env) != 0: + raise SandboxCommandError("Command failed", collect=self.collect) def execute_group(self, group): group.execute_children(self) diff --git a/tests/integration/manual.py b/tests/integration/manual.py index 4e80d0dc0..c6a84b062 100644 --- a/tests/integration/manual.py +++ b/tests/integration/manual.py @@ -127,7 +127,6 @@ def test_manual_element_noparallel(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") -@pytest.mark.xfail(HAVE_SANDBOX == "buildbox-run", reason="Individual commands are not logged with command batching") def test_manual_element_logging(cli, datafiles): project = str(datafiles) element_path = os.path.join(project, "elements") diff --git a/tests/integration/messages.py b/tests/integration/messages.py index 8bd56b82c..f35b778d6 100644 --- a/tests/integration/messages.py +++ b/tests/integration/messages.py @@ -38,7 +38,6 @@ DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "project",) @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") -@pytest.mark.xfail(HAVE_SANDBOX == "buildbox-run", reason="Individual commands are not logged with command batching") def test_disable_message_lines(cli, datafiles): project = str(datafiles) element_path = os.path.join(project, "elements") @@ -67,7 +66,6 @@ def test_disable_message_lines(cli, datafiles): @pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason="Only available with a functioning sandbox") -@pytest.mark.xfail(HAVE_SANDBOX == "buildbox-run", reason="Individual commands are not logged with command batching") def test_disable_error_lines(cli, datafiles): project = str(datafiles) element_path = os.path.join(project, "elements") |