summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <contact@benschubert.me>2019-07-31 16:26:27 +0100
committerJames Ennis <james.ennis@codethink.co.uk>2019-08-14 11:12:08 +0100
commit237d71f052745040f0e89f19b80176e34bfe9b92 (patch)
tree1b18af88d74c6100afee419e7ead9db39e42f9ae
parent5a02d732b24d9a86b654790e7806eb5da7a109f1 (diff)
downloadbuildstream-danielsilverstone-ct/missing-sh-fix.tar.gz
workspace: Add test to ensure we can show logs from a workspaced builddanielsilverstone-ct/missing-sh-fix
-rw-r--r--tests/frontend/project/elements/manual.bst9
-rw-r--r--tests/frontend/workspace.py34
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/frontend/project/elements/manual.bst b/tests/frontend/project/elements/manual.bst
new file mode 100644
index 000000000..142409a08
--- /dev/null
+++ b/tests/frontend/project/elements/manual.bst
@@ -0,0 +1,9 @@
+kind: manual
+
+config:
+ build-commands:
+ - echo "hello"
+
+sources:
+ - kind: local
+ path: elements/manual.bst
diff --git a/tests/frontend/workspace.py b/tests/frontend/workspace.py
index ad0fc7371..a21538325 100644
--- a/tests/frontend/workspace.py
+++ b/tests/frontend/workspace.py
@@ -1333,3 +1333,37 @@ def test_build_all(cli, tmpdir, datafiles, case, strict, non_workspaced_elements
# Assert that the target is built
assert cli.get_element_states(project, all_elements) == \
{elem: "cached" for elem in all_elements}
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize('strict', ['strict', 'non-strict'])
+def test_show_workspace_logs(cli, tmpdir, datafiles, strict):
+ project = str(datafiles)
+ workspace = os.path.join(str(tmpdir), 'workspace')
+ target = 'manual.bst'
+
+ # Configure strict mode
+ strict_mode = True
+ if strict != 'strict':
+ strict_mode = False
+ cli.configure({
+ 'projects': {
+ 'test': {
+ 'strict': strict_mode
+ }
+ }
+ })
+
+ # First open the workspace
+ result = cli.run(project=project, args=['workspace', 'open', '--directory', workspace, target])
+ result.assert_success()
+
+ # Build the element
+ result = cli.run(project=project, args=['build', target])
+ result.assert_task_error(ErrorDomain.SANDBOX, 'missing-command')
+
+ result = cli.run(project=project, args=['artifact', 'log', target])
+ result.assert_success()
+
+ # Assert that the log is not empty
+ assert result.output != ""