diff options
author | William Salmon <will.salmon@codethink.co.uk> | 2019-05-15 17:21:49 +0100 |
---|---|---|
committer | William Salmon <will.salmon@codethink.co.uk> | 2019-07-25 10:08:18 +0100 |
commit | 43505dfd6da8b6eb3f4d4e544f3cdc0e2a31a947 (patch) | |
tree | 57c2c4e41df4c5c32b776818f83e5458a782b896 /tests/frontend | |
parent | 3e5790d151faaddbeb376eb8cb24178fa9899c17 (diff) | |
download | buildstream-43505dfd6da8b6eb3f4d4e544f3cdc0e2a31a947.tar.gz |
Implmented export_to_tar for casbaseddirectory
Diffstat (limited to 'tests/frontend')
5 files changed, 49 insertions, 0 deletions
diff --git a/tests/frontend/buildcheckout.py b/tests/frontend/buildcheckout.py index a3f68c031..dd4a461ea 100644 --- a/tests/frontend/buildcheckout.py +++ b/tests/frontend/buildcheckout.py @@ -425,6 +425,49 @@ def test_build_checkout_tarball_is_deterministic(datafiles, cli): @pytest.mark.datafiles(DATA_DIR) +def test_build_checkout_tarball_links(datafiles, cli): + project = str(datafiles) + checkout = os.path.join(cli.directory, 'checkout.tar') + extract = os.path.join(cli.directory, 'extract') + + result = cli.run(project=project, args=['build', 'import-links.bst']) + result.assert_success() + + builddir = os.path.join(cli.directory, 'build') + assert os.path.isdir(builddir) + assert not os.listdir(builddir) + + checkout_args = ['artifact', 'checkout', '--tar', checkout, 'import-links.bst'] + + result = cli.run(project=project, args=checkout_args) + result.assert_success() + + tar = tarfile.open(name=checkout, mode="r:") + tar.extractall(extract) + assert open(os.path.join(extract, 'basicfolder', 'basicsymlink')).read() == "file contents\n" + + +@pytest.mark.datafiles(DATA_DIR) +def test_build_checkout_links(datafiles, cli): + project = str(datafiles) + checkout = os.path.join(cli.directory, 'checkout') + + result = cli.run(project=project, args=['build', 'import-links.bst']) + result.assert_success() + + builddir = os.path.join(cli.directory, 'build') + assert os.path.isdir(builddir) + assert not os.listdir(builddir) + + checkout_args = ['artifact', 'checkout', '--directory', checkout, 'import-links.bst'] + + result = cli.run(project=project, args=checkout_args) + result.assert_success() + + assert open(os.path.join(checkout, 'basicfolder', 'basicsymlink')).read() == "file contents\n" + + +@pytest.mark.datafiles(DATA_DIR) @pytest.mark.parametrize("hardlinks", [("copies"), ("hardlinks")]) def test_build_checkout_nonempty(datafiles, cli, hardlinks): project = str(datafiles) diff --git a/tests/frontend/project/elements/import-links.bst b/tests/frontend/project/elements/import-links.bst new file mode 100644 index 000000000..42b279ee2 --- /dev/null +++ b/tests/frontend/project/elements/import-links.bst @@ -0,0 +1,4 @@ +kind: import +sources: +- kind: local + path: files/files-and-links diff --git a/tests/frontend/project/files/files-and-links/basicfile b/tests/frontend/project/files/files-and-links/basicfile new file mode 100644 index 000000000..d03e2425c --- /dev/null +++ b/tests/frontend/project/files/files-and-links/basicfile @@ -0,0 +1 @@ +file contents diff --git a/tests/frontend/project/files/files-and-links/basicfolder/basicsymlink b/tests/frontend/project/files/files-and-links/basicfolder/basicsymlink new file mode 120000 index 000000000..e2b4f7423 --- /dev/null +++ b/tests/frontend/project/files/files-and-links/basicfolder/basicsymlink @@ -0,0 +1 @@ +../basicfile
\ No newline at end of file diff --git a/tests/frontend/project/files/files-and-links/basicfolder/subdir-file b/tests/frontend/project/files/files-and-links/basicfolder/subdir-file new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/frontend/project/files/files-and-links/basicfolder/subdir-file |