From df50bf766070449211540d69c851aad18e868847 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Wed, 31 Jul 2019 16:26:27 +0100 Subject: workspace: Add test to ensure we can show logs from a workspaced build --- tests/frontend/project/elements/manual.bst | 9 +++++++++ tests/frontend/workspace.py | 32 ++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 tests/frontend/project/elements/manual.bst 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..037a1a970 100644 --- a/tests/frontend/workspace.py +++ b/tests/frontend/workspace.py @@ -1333,3 +1333,35 @@ 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 result.output == "" -- cgit v1.2.1