diff options
author | James Ennis <james.ennis@codethink.co.uk> | 2019-08-28 16:09:13 +0100 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2019-09-05 12:14:53 +0000 |
commit | a60de4b04b20f1d688e7ef25f0df30e422183bf6 (patch) | |
tree | 3b8da0aa8f2cdebdd73c374c09fa1df100f58aac | |
parent | 9a2c8890c7823b26629f6d62a302955d7ae81bd1 (diff) | |
download | buildstream-jennis/update_checkout.tar.gz |
buildcheckout.py: Add tests which checkout artifact depsjennis/update_checkout
These tests ensure that we can checkout the build dependencies of
an artifact and that if we try to checkout the runtime dependencies
the command will fail.
-rw-r--r-- | tests/frontend/buildcheckout.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index 67314d452..c9a42239a 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -343,6 +343,43 @@ def test_build_checkout_tarball_using_ref(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) +def test_build_checkout_build_deps_using_ref(datafiles, cli): + project = str(datafiles) + checkout = os.path.join(cli.directory, 'checkout') + + result = cli.run(project=project, args=['build', 'checkout-deps.bst']) + result.assert_success() + + key = cli.get_element_key(project, 'checkout-deps.bst') + checkout_args = ['artifact', 'checkout', '--directory', checkout, '--deps', 'build', 'test/checkout-deps/' + key] + + result = cli.run(project=project, args=checkout_args) + result.assert_success() + + build_dep_files = os.path.join(checkout, 'usr', 'include', 'pony.h') + runtime_dep_files = os.path.join(checkout, 'usr', 'bin', 'hello') + target_files = os.path.join(checkout, 'etc', 'buildstream', 'config') + assert os.path.exists(build_dep_files) + assert not os.path.exists(runtime_dep_files) + assert not os.path.exists(target_files) + + +@pytest.mark.datafiles(DATA_DIR) +def test_build_checkout_runtime_deps_using_ref_fails(datafiles, cli): + project = str(datafiles) + checkout = os.path.join(cli.directory, 'checkout') + + result = cli.run(project=project, args=['build', 'checkout-deps.bst']) + result.assert_success() + + key = cli.get_element_key(project, 'checkout-deps.bst') + checkout_args = ['artifact', 'checkout', '--directory', checkout, '--deps', 'run', 'test/checkout-deps/' + key] + + result = cli.run(project=project, args=checkout_args) + result.assert_main_error(ErrorDomain.STREAM, None) + + +@pytest.mark.datafiles(DATA_DIR) def test_build_checkout_invalid_ref(datafiles, cli): project = str(datafiles) checkout = os.path.join(cli.directory, 'checkout.tar') |