Skip to content
Snippets Groups Projects
Commit 2d2e40c6 authored by Jonathan Maw's avatar Jonathan Maw
Browse files

tests: Add a test for the interactive failure shell

This test checks that the interactive failure shell stages the cached
build tree.
parent 7faef862
No related branches found
No related tags found
Loading
...@@ -9,3 +9,4 @@ pytest-pep8 ...@@ -9,3 +9,4 @@ pytest-pep8
pytest-pylint pytest-pylint
pytest-xdist pytest-xdist
pytest-timeout pytest-timeout
pexpect
import os import os
import pytest import pytest
import shutil import shutil
import pexpect
from tests.testutils import cli, cli_integration, create_artifact_share from tests.testutils import cli, cli_integration, create_artifact_share
...@@ -29,6 +30,31 @@ def test_buildtree_staged(cli_integration, tmpdir, datafiles): ...@@ -29,6 +30,31 @@ def test_buildtree_staged(cli_integration, tmpdir, datafiles):
res.assert_success() res.assert_success()
# Check that a failed build causes a shell that stages the buildtree
@pytest.mark.datafiles(DATA_DIR)
def test_buildtree_staged_interactive(cli_integration, tmpdir, datafiles):
# i.e. tests that cached build trees are staged by `bst shell --build`
project = os.path.join(datafiles.dirname, datafiles.basename)
element_name = 'build-shell/buildtree-fail.bst'
# Start an interactive session and intercept the interactive prompt
child = pexpect.spawn('bst', ['--no-colors', 'build', element_name], cwd=project)
# Ensure starting a shell is a valid option
child.expect('\(s\)hell')
# Wait for the interactive prompt
child.expect('Choice: \[continue\]:')
# Start a shell and wait for the shell's prompt
child.sendline('s')
child.expect('\]\$')
# Read the contents of the file we added
child.sendline('cat test')
child.expect('Hi')
# Check that build shells work when pulled from a remote cache # Check that build shells work when pulled from a remote cache
# This is to roughly simulate remote execution # This is to roughly simulate remote execution
@pytest.mark.datafiles(DATA_DIR) @pytest.mark.datafiles(DATA_DIR)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment