diff options
author | Phil Dawson <phil.dawson@codethink.co.uk> | 2018-12-12 11:40:57 +0000 |
---|---|---|
committer | Phil Dawson <phil.dawson@codethink.co.uk> | 2018-12-12 14:43:40 +0000 |
commit | c2efeba064f30c9bdbb4e370b1911dc50a78ff9b (patch) | |
tree | 1a7e4db7a120debc764c79546682917d2f413a40 /tests/frontend/source_checkout.py | |
parent | 733aab53ce07c0b36a460eb55b5eb629197b4faa (diff) | |
download | buildstream-c2efeba064f30c9bdbb4e370b1911dc50a78ff9b.tar.gz |
Add option to source-checkout command to generate build scripts
Diffstat (limited to 'tests/frontend/source_checkout.py')
-rw-r--r-- | tests/frontend/source_checkout.py | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/frontend/source_checkout.py b/tests/frontend/source_checkout.py index 0815d9b9c..f6067498d 100644 --- a/tests/frontend/source_checkout.py +++ b/tests/frontend/source_checkout.py @@ -170,3 +170,38 @@ def test_source_checkout_fetch(datafiles, cli, fetch): assert os.path.exists(os.path.join(checkout, 'remote-import-dev', 'pony.h')) else: result.assert_main_error(ErrorDomain.PIPELINE, 'uncached-sources') + + +@pytest.mark.datafiles(DATA_DIR) +def test_source_checkout_build_scripts(cli, tmpdir, datafiles): + project_path = os.path.join(datafiles.dirname, datafiles.basename) + element_name = 'source-bundle/source-bundle-hello.bst' + normal_name = 'source-bundle-source-bundle-hello' + checkout = os.path.join(str(tmpdir), 'source-checkout') + + args = ['source-checkout', '--include-build-scripts', element_name, checkout] + result = cli.run(project=project_path, args=args) + result.assert_success() + + # There sould be a script for each element (just one in this case) and a top level build script + expected_scripts = ['build.sh', 'build-' + normal_name] + for script in expected_scripts: + assert script in os.listdir(checkout) + + +@pytest.mark.datafiles(DATA_DIR) +def test_source_checkout_tar_buildscripts(cli, tmpdir, datafiles): + project_path = os.path.join(datafiles.dirname, datafiles.basename) + element_name = 'source-bundle/source-bundle-hello.bst' + normal_name = 'source-bundle-source-bundle-hello' + tar_file = os.path.join(str(tmpdir), 'source-checkout.tar') + + args = ['source-checkout', '--include-build-scripts', '--tar', element_name, tar_file] + result = cli.run(project=project_path, args=args) + result.assert_success() + + expected_scripts = ['build.sh', 'build-' + normal_name] + + with tarfile.open(tar_file, 'r') as tf: + for script in expected_scripts: + assert script in tf.getnames() |