diff options
author | Phil Dawson <phil.dawson@codethink.co.uk> | 2019-03-07 14:51:56 +0000 |
---|---|---|
committer | Phil Dawson <phil.dawson@codethink.co.uk> | 2019-03-14 10:13:44 +0000 |
commit | 88f6ceda1ae53c8a18b72bd685ad93bb1b5d96fa (patch) | |
tree | 74e10830f647a27ac812b4362402c5d5bd4e3173 /tests/integration | |
parent | 3177b389db55156380408abd85bc5b95a0d989ae (diff) | |
download | buildstream-88f6ceda1ae53c8a18b72bd685ad93bb1b5d96fa.tar.gz |
tests: move templated tests from source-determinism.py into separate file
Move the templated tests in tests/frontend/source-determinism.py into
sources/source_determinism.py
This is part of the preparation work for #944
Diffstat (limited to 'tests/integration')
-rw-r--r-- | tests/integration/source-determinism.py | 74 |
1 files changed, 1 insertions, 73 deletions
diff --git a/tests/integration/source-determinism.py b/tests/integration/source-determinism.py index 9fc153e1a..7cfca98e0 100644 --- a/tests/integration/source-determinism.py +++ b/tests/integration/source-determinism.py @@ -3,7 +3,7 @@ import pytest from buildstream import _yaml from buildstream.plugintestutils import cli_integration as cli -from tests.testutils import create_repo, ALL_REPO_KINDS +from tests.testutils import create_repo from tests.testutils.site import HAVE_SANDBOX @@ -29,78 +29,6 @@ def create_test_directory(*path, mode=0o644): @pytest.mark.integration @pytest.mark.datafiles(DATA_DIR) -@pytest.mark.parametrize("kind", ['local', *ALL_REPO_KINDS]) -@pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') -def test_deterministic_source_umask(cli, tmpdir, datafiles, kind): - project = str(datafiles) - element_name = 'list.bst' - element_path = os.path.join(project, 'elements', element_name) - repodir = os.path.join(str(tmpdir), 'repo') - sourcedir = os.path.join(project, 'source') - - create_test_file(sourcedir, 'a.txt', mode=0o700) - create_test_file(sourcedir, 'b.txt', mode=0o755) - create_test_file(sourcedir, 'c.txt', mode=0o600) - create_test_file(sourcedir, 'd.txt', mode=0o400) - create_test_file(sourcedir, 'e.txt', mode=0o644) - create_test_file(sourcedir, 'f.txt', mode=0o4755) - create_test_file(sourcedir, 'g.txt', mode=0o2755) - create_test_file(sourcedir, 'h.txt', mode=0o1755) - create_test_directory(sourcedir, 'dir-a', mode=0o0700) - create_test_directory(sourcedir, 'dir-c', mode=0o0755) - create_test_directory(sourcedir, 'dir-d', mode=0o4755) - create_test_directory(sourcedir, 'dir-e', mode=0o2755) - create_test_directory(sourcedir, 'dir-f', mode=0o1755) - - if kind == 'local': - source = {'kind': 'local', - 'path': 'source'} - else: - repo = create_repo(kind, repodir) - ref = repo.create(sourcedir) - source = repo.source_config(ref=ref) - element = { - 'kind': 'manual', - 'depends': [ - { - 'filename': 'base.bst', - 'type': 'build' - } - ], - 'sources': [ - source - ], - 'config': { - 'install-commands': [ - 'ls -l >"%{install-root}/ls-l"' - ] - } - } - _yaml.dump(element, element_path) - - def get_value_for_umask(umask): - checkoutdir = os.path.join(str(tmpdir), 'checkout-{}'.format(umask)) - - old_umask = os.umask(umask) - - try: - result = cli.run(project=project, args=['build', element_name]) - result.assert_success() - - result = cli.run(project=project, args=['artifact', 'checkout', element_name, '--directory', checkoutdir]) - result.assert_success() - - with open(os.path.join(checkoutdir, 'ls-l'), 'r') as f: - return f.read() - finally: - os.umask(old_umask) - cli.remove_artifact_from_cache(project, element_name) - - assert get_value_for_umask(0o022) == get_value_for_umask(0o077) - - -@pytest.mark.integration -@pytest.mark.datafiles(DATA_DIR) @pytest.mark.skipif(not HAVE_SANDBOX, reason='Only available with a functioning sandbox') def test_deterministic_source_local(cli, tmpdir, datafiles): """Only user rights should be considered for local source. |