diff options
Diffstat (limited to 'tests/loader')
96 files changed, 0 insertions, 1114 deletions
diff --git a/tests/loader/__init__.py b/tests/loader/__init__.py deleted file mode 100644 index 812888181..000000000 --- a/tests/loader/__init__.py +++ /dev/null @@ -1,22 +0,0 @@ -import os -from buildstream._context import Context -from buildstream._project import Project -from buildstream._loader import Loader - -# -# This is used by the loader test modules, these should -# be removed in favor of testing the functionality via -# the CLI like in the frontend tests anyway. -# - - -def dummy_handler(message, context): - pass - - -def make_loader(basedir): - context = Context() - context.load(config=os.devnull) - context.set_message_handler(dummy_handler) - project = Project(basedir, context) - return project.loader diff --git a/tests/loader/basics.py b/tests/loader/basics.py deleted file mode 100644 index d7fc28f83..000000000 --- a/tests/loader/basics.py +++ /dev/null @@ -1,99 +0,0 @@ -import os -import pytest - -from buildstream._exceptions import LoadError, LoadErrorReason -from buildstream._loader import Loader, MetaElement -from . import make_loader - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'basics', -) - - -############################################################## -# Basics: Test behavior loading the simplest of projects # -############################################################## -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_one_file(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - element = loader.load(['elements/onefile.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_missing_file(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/missing.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.MISSING_FILE) - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_invalid_reference(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/badreference.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_invalid_yaml(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/badfile.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.INVALID_YAML) - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_fail_fullpath_target(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - fullpath = os.path.join(basedir, 'elements', 'onefile.bst') - - with pytest.raises(LoadError) as exc: - loader = make_loader(basedir) - loader.load([fullpath]) - - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_invalid_key(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/invalidkey.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) - - -@pytest.mark.datafiles(os.path.join(DATA_DIR, 'onefile')) -def test_invalid_directory_load(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/'])[0] - - assert (exc.value.reason == LoadErrorReason.LOADING_DIRECTORY) diff --git a/tests/loader/basics/onefile/elements/badfile.bst b/tests/loader/basics/onefile/elements/badfile.bst deleted file mode 100644 index df68dbf2a..000000000 --- a/tests/loader/basics/onefile/elements/badfile.bst +++ /dev/null @@ -1,5 +0,0 @@ -# This is just invalid YAML -- | - this is malformed yaml. - -) diff --git a/tests/loader/basics/onefile/elements/badreference.bst b/tests/loader/basics/onefile/elements/badreference.bst deleted file mode 100644 index 9d320b2bf..000000000 --- a/tests/loader/basics/onefile/elements/badreference.bst +++ /dev/null @@ -1,3 +0,0 @@ -# This bad YAML file makes a reference to an undefined entity -name: pony -pony: *pony diff --git a/tests/loader/basics/onefile/elements/invalidkey.bst b/tests/loader/basics/onefile/elements/invalidkey.bst deleted file mode 100644 index 5674ab7bd..000000000 --- a/tests/loader/basics/onefile/elements/invalidkey.bst +++ /dev/null @@ -1,3 +0,0 @@ -kind: pony -description: This is the pony -wings: blue diff --git a/tests/loader/basics/onefile/elements/invalidsourcekey.bst b/tests/loader/basics/onefile/elements/invalidsourcekey.bst deleted file mode 100644 index 5677af347..000000000 --- a/tests/loader/basics/onefile/elements/invalidsourcekey.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: pony -description: This is the pony -sources: - - kind: ponyland - url: ptp://pw.ponies.p/ - weather: great diff --git a/tests/loader/basics/onefile/elements/onefile.bst b/tests/loader/basics/onefile/elements/onefile.bst deleted file mode 100644 index ae4950585..000000000 --- a/tests/loader/basics/onefile/elements/onefile.bst +++ /dev/null @@ -1,2 +0,0 @@ -kind: pony -description: This is the pony diff --git a/tests/loader/basics/onefile/project.conf b/tests/loader/basics/onefile/project.conf deleted file mode 100644 index afa0f5475..000000000 --- a/tests/loader/basics/onefile/project.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Basic project -name: foo diff --git a/tests/loader/dependencies.py b/tests/loader/dependencies.py deleted file mode 100644 index 98374f6d0..000000000 --- a/tests/loader/dependencies.py +++ /dev/null @@ -1,236 +0,0 @@ -import os -import pytest - -from buildstream._exceptions import LoadError, LoadErrorReason -from buildstream._loader import Loader, MetaElement -from tests.testutils import cli -from . import make_loader - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'dependencies', -) - - -############################################################## -# Basics: Test behavior loading projects with dependencies # -############################################################## -@pytest.mark.datafiles(DATA_DIR) -def test_two_files(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/target.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.dependencies) == 1) - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - assert(firstdep.kind == 'manual') - - -@pytest.mark.datafiles(DATA_DIR) -def test_shared_dependency(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/shareddeptarget.bst'])[0] - - # Toplevel is 'pony' with 2 dependencies - # - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - assert(len(element.dependencies) == 2) - - # The first specified dependency is 'thefirstdep' - # - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - assert(firstdep.kind == 'manual') - assert(len(firstdep.dependencies) == 0) - - # The second specified dependency is 'shareddep' - # - shareddep = element.dependencies[1] - assert(isinstance(shareddep, MetaElement)) - assert(shareddep.kind == 'shareddep') - assert(len(shareddep.dependencies) == 1) - - # The element which shareddep depends on is - # the same element in memory as firstdep - # - shareddepdep = shareddep.dependencies[0] - assert(isinstance(shareddepdep, MetaElement)) - - # Assert they are in fact the same LoadElement - # - # Note we must use 'is' to test that both variables - # refer to the same object in memory, not a regular - # equality test with '==' which is one of those operator - # overridable thingies. - # - assert(shareddepdep is firstdep) - - -@pytest.mark.datafiles(DATA_DIR) -def test_dependency_dict(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/target-depdict.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.dependencies) == 1) - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - assert(firstdep.kind == 'manual') - - -@pytest.mark.datafiles(DATA_DIR) -def test_invalid_dependency_declaration(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/invaliddep.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) - - -@pytest.mark.datafiles(DATA_DIR) -def test_circular_dependency(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/circulartarget.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.CIRCULAR_DEPENDENCY) - assert ("seconddep" in exc.value.args[0]) - - -@pytest.mark.datafiles(DATA_DIR) -def test_invalid_dependency_type(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - - with pytest.raises(LoadError) as exc: - element = loader.load(['elements/invaliddeptype.bst'])[0] - - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) - - -@pytest.mark.datafiles(DATA_DIR) -def test_build_dependency(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/builddep.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.build_dependencies) == 1) - firstdep = element.build_dependencies[0] - assert(isinstance(firstdep, MetaElement)) - - assert(len(element.dependencies) == 0) - - -@pytest.mark.datafiles(DATA_DIR) -def test_runtime_dependency(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/runtimedep.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.dependencies) == 1) - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - - assert(len(element.build_dependencies) == 0) - - -@pytest.mark.datafiles(DATA_DIR) -def test_build_runtime_dependency(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/target.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.dependencies) == 1) - assert(len(element.build_dependencies) == 1) - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - firstbuilddep = element.build_dependencies[0] - assert(firstdep == firstbuilddep) - - -@pytest.mark.datafiles(DATA_DIR) -def test_all_dependency(datafiles): - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = make_loader(basedir) - element = loader.load(['elements/alldep.bst'])[0] - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - assert(len(element.dependencies) == 1) - assert(len(element.build_dependencies) == 1) - firstdep = element.dependencies[0] - assert(isinstance(firstdep, MetaElement)) - firstbuilddep = element.build_dependencies[0] - assert(firstdep == firstbuilddep) - - -@pytest.mark.datafiles(DATA_DIR) -def test_list_build_dependency(cli, datafiles): - project = str(datafiles) - - # Check that the pipeline includes the build dependency - deps = cli.get_pipeline(project, ['elements/builddep-list.bst'], scope="build") - assert "elements/firstdep.bst" in deps - - -@pytest.mark.datafiles(DATA_DIR) -def test_list_runtime_dependency(cli, datafiles): - project = str(datafiles) - - # Check that the pipeline includes the runtime dependency - deps = cli.get_pipeline(project, ['elements/runtimedep-list.bst'], scope="run") - assert "elements/firstdep.bst" in deps - - -@pytest.mark.datafiles(DATA_DIR) -def test_list_dependencies_combined(cli, datafiles): - project = str(datafiles) - - # Check that runtime deps get combined - rundeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="run") - assert "elements/firstdep.bst" not in rundeps - assert "elements/seconddep.bst" in rundeps - assert "elements/thirddep.bst" in rundeps - - # Check that build deps get combined - builddeps = cli.get_pipeline(project, ['elements/list-combine.bst'], scope="build") - assert "elements/firstdep.bst" in builddeps - assert "elements/seconddep.bst" not in builddeps - assert "elements/thirddep.bst" in builddeps - - -@pytest.mark.datafiles(DATA_DIR) -def test_list_overlap(cli, datafiles): - project = str(datafiles) - - # Check that dependencies get merged - rundeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="run") - assert "elements/firstdep.bst" in rundeps - builddeps = cli.get_pipeline(project, ['elements/list-overlap.bst'], scope="build") - assert "elements/firstdep.bst" in builddeps diff --git a/tests/loader/dependencies/elements/alldep.bst b/tests/loader/dependencies/elements/alldep.bst deleted file mode 100644 index c61c7ea15..000000000 --- a/tests/loader/dependencies/elements/alldep.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: pony -description: This element has a dependency with type 'all' -depends: - - filename: elements/firstdep.bst - type: all diff --git a/tests/loader/dependencies/elements/builddep-list.bst b/tests/loader/dependencies/elements/builddep-list.bst deleted file mode 100644 index 925de3afd..000000000 --- a/tests/loader/dependencies/elements/builddep-list.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -description: This element has a build-only dependency specified via build-depends -build-depends: - - elements/firstdep.bst diff --git a/tests/loader/dependencies/elements/builddep.bst b/tests/loader/dependencies/elements/builddep.bst deleted file mode 100644 index 6d17f8498..000000000 --- a/tests/loader/dependencies/elements/builddep.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: pony -description: This element has a build-only dependency -depends: - - filename: elements/firstdep.bst - type: build diff --git a/tests/loader/dependencies/elements/circular-firstdep.bst b/tests/loader/dependencies/elements/circular-firstdep.bst deleted file mode 100644 index 92f6993a2..000000000 --- a/tests/loader/dependencies/elements/circular-firstdep.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: Depend on another dep which depends on the target -depends: -- elements/circular-seconddep.bst diff --git a/tests/loader/dependencies/elements/circular-seconddep.bst b/tests/loader/dependencies/elements/circular-seconddep.bst deleted file mode 100644 index 12a67ba75..000000000 --- a/tests/loader/dependencies/elements/circular-seconddep.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: Depend on the target, creating a circular dependency -depends: -- elements/circulartarget.bst diff --git a/tests/loader/dependencies/elements/circulartarget.bst b/tests/loader/dependencies/elements/circulartarget.bst deleted file mode 100644 index 14db24682..000000000 --- a/tests/loader/dependencies/elements/circulartarget.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: This is a main target which introduces a circular dependency -depends: -- elements/circular-firstdep.bst diff --git a/tests/loader/dependencies/elements/firstdep.bst b/tests/loader/dependencies/elements/firstdep.bst deleted file mode 100644 index 5c9c1c1e6..000000000 --- a/tests/loader/dependencies/elements/firstdep.bst +++ /dev/null @@ -1,2 +0,0 @@ -kind: manual -description: This is the first dependency diff --git a/tests/loader/dependencies/elements/invaliddep.bst b/tests/loader/dependencies/elements/invaliddep.bst deleted file mode 100644 index 65c43c60a..000000000 --- a/tests/loader/dependencies/elements/invaliddep.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: This is an invalid dependency -depends: - more: it should be a list, not a dict diff --git a/tests/loader/dependencies/elements/invaliddeptype.bst b/tests/loader/dependencies/elements/invaliddeptype.bst deleted file mode 100644 index 50ed798f0..000000000 --- a/tests/loader/dependencies/elements/invaliddeptype.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: pony -description: This is an invalid dependency type -depends: - - filename: elements/firstdep.bst - type: should be build or runtime diff --git a/tests/loader/dependencies/elements/list-combine.bst b/tests/loader/dependencies/elements/list-combine.bst deleted file mode 100644 index 2010d7008..000000000 --- a/tests/loader/dependencies/elements/list-combine.bst +++ /dev/null @@ -1,8 +0,0 @@ -kind: stack -description: This element depends on three elements in different ways -build-depends: -- elements/firstdep.bst -runtime-depends: -- elements/seconddep.bst -depends: -- elements/thirddep.bst diff --git a/tests/loader/dependencies/elements/list-overlap.bst b/tests/loader/dependencies/elements/list-overlap.bst deleted file mode 100644 index 1e98a20a5..000000000 --- a/tests/loader/dependencies/elements/list-overlap.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: stack -description: This element depends on two elements in different ways -build-depends: -- elements/firstdep.bst -depends: -- filename: elements/firstdep.bst - type: runtime diff --git a/tests/loader/dependencies/elements/runtimedep-list.bst b/tests/loader/dependencies/elements/runtimedep-list.bst deleted file mode 100644 index 790fa4d54..000000000 --- a/tests/loader/dependencies/elements/runtimedep-list.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -description: This element has a runtime-only dependency -runtime-depends: - - elements/firstdep.bst diff --git a/tests/loader/dependencies/elements/runtimedep.bst b/tests/loader/dependencies/elements/runtimedep.bst deleted file mode 100644 index a08b59ebf..000000000 --- a/tests/loader/dependencies/elements/runtimedep.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: pony -description: This element has a runtime-only dependency -depends: - - filename: elements/firstdep.bst - type: runtime diff --git a/tests/loader/dependencies/elements/seconddep.bst b/tests/loader/dependencies/elements/seconddep.bst deleted file mode 100644 index 93ded4359..000000000 --- a/tests/loader/dependencies/elements/seconddep.bst +++ /dev/null @@ -1,2 +0,0 @@ -kind: manual -description: This is the second dependency diff --git a/tests/loader/dependencies/elements/shareddep.bst b/tests/loader/dependencies/elements/shareddep.bst deleted file mode 100644 index cb98171f6..000000000 --- a/tests/loader/dependencies/elements/shareddep.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: shareddep -description: This is the first dependency -depends: -- elements/firstdep.bst diff --git a/tests/loader/dependencies/elements/shareddeptarget.bst b/tests/loader/dependencies/elements/shareddeptarget.bst deleted file mode 100644 index 03982d69f..000000000 --- a/tests/loader/dependencies/elements/shareddeptarget.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: pony -description: This is the main target -depends: -- elements/firstdep.bst -- elements/shareddep.bst diff --git a/tests/loader/dependencies/elements/target-depdict.bst b/tests/loader/dependencies/elements/target-depdict.bst deleted file mode 100644 index 22bc87910..000000000 --- a/tests/loader/dependencies/elements/target-depdict.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: This is the main target -depends: -- filename: elements/firstdep.bst diff --git a/tests/loader/dependencies/elements/target.bst b/tests/loader/dependencies/elements/target.bst deleted file mode 100644 index 05c767956..000000000 --- a/tests/loader/dependencies/elements/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: This is the main target -depends: -- elements/firstdep.bst diff --git a/tests/loader/dependencies/elements/thirddep.bst b/tests/loader/dependencies/elements/thirddep.bst deleted file mode 100644 index 39b58e57a..000000000 --- a/tests/loader/dependencies/elements/thirddep.bst +++ /dev/null @@ -1,2 +0,0 @@ -kind: manual -description: This is the third dependency diff --git a/tests/loader/dependencies/project.conf b/tests/loader/dependencies/project.conf deleted file mode 100644 index afa0f5475..000000000 --- a/tests/loader/dependencies/project.conf +++ /dev/null @@ -1,2 +0,0 @@ -# Basic project -name: foo diff --git a/tests/loader/junctions.py b/tests/loader/junctions.py deleted file mode 100644 index d97c9f702..000000000 --- a/tests/loader/junctions.py +++ /dev/null @@ -1,310 +0,0 @@ -import os -import pytest -import shutil - -from buildstream import _yaml, ElementError -from buildstream._exceptions import ErrorDomain, LoadErrorReason -from tests.testutils import cli, create_repo -from tests.testutils.site import HAVE_GIT - - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'junctions', -) - - -def copy_subprojects(project, datafiles, subprojects): - for subproject in subprojects: - shutil.copytree(os.path.join(str(datafiles), subproject), os.path.join(str(project), subproject)) - - -@pytest.mark.datafiles(DATA_DIR) -def test_simple_pipeline(cli, datafiles): - project = os.path.join(str(datafiles), 'foo') - copy_subprojects(project, datafiles, ['base']) - - # Check that the pipeline includes the subproject element - element_list = cli.get_pipeline(project, ['target.bst']) - assert 'base.bst:target.bst' in element_list - - -@pytest.mark.datafiles(DATA_DIR) -def test_simple_build(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'foo') - copy_subprojects(project, datafiles, ['base']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_build_of_same_junction_used_twice(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'inconsistent-names') - - # Check we can build a project that contains the same junction - # that is used twice, but named differently - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - - -@pytest.mark.datafiles(DATA_DIR) -def test_nested_simple(cli, tmpdir, datafiles): - foo = os.path.join(str(datafiles), 'foo') - copy_subprojects(foo, datafiles, ['base']) - - project = os.path.join(str(datafiles), 'nested') - copy_subprojects(project, datafiles, ['foo']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - # Check that the checkout contains the expected files from all subprojects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_nested_double(cli, tmpdir, datafiles): - foo = os.path.join(str(datafiles), 'foo') - copy_subprojects(foo, datafiles, ['base']) - - bar = os.path.join(str(datafiles), 'bar') - copy_subprojects(bar, datafiles, ['base']) - - project = os.path.join(str(datafiles), 'toplevel') - copy_subprojects(project, datafiles, ['base', 'foo', 'bar']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - # Check that the checkout contains the expected files from all subprojects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'bar.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_nested_conflict(cli, datafiles): - foo = os.path.join(str(datafiles), 'foo') - copy_subprojects(foo, datafiles, ['base']) - - bar = os.path.join(str(datafiles), 'bar') - copy_subprojects(bar, datafiles, ['base']) - - project = os.path.join(str(datafiles), 'conflict') - copy_subprojects(project, datafiles, ['foo', 'bar']) - - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CONFLICTING_JUNCTION) - - -# Test that we error correctly when the junction element itself is missing -@pytest.mark.datafiles(DATA_DIR) -def test_missing_junction(cli, datafiles): - project = os.path.join(str(datafiles), 'invalid') - - result = cli.run(project=project, args=['build', 'missing.bst']) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) - - -# Test that we error correctly when an element is not found in the subproject -@pytest.mark.datafiles(DATA_DIR) -def test_missing_subproject_element(cli, datafiles): - project = os.path.join(str(datafiles), 'invalid') - copy_subprojects(project, datafiles, ['base']) - - result = cli.run(project=project, args=['build', 'missing-element.bst']) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE) - - -# Test that we error correctly when a junction itself has dependencies -@pytest.mark.datafiles(DATA_DIR) -def test_invalid_with_deps(cli, datafiles): - project = os.path.join(str(datafiles), 'invalid') - copy_subprojects(project, datafiles, ['base']) - - result = cli.run(project=project, args=['build', 'junction-with-deps.bst']) - result.assert_main_error(ErrorDomain.ELEMENT, 'element-forbidden-depends') - - -# Test that we error correctly when a junction is directly depended on -@pytest.mark.datafiles(DATA_DIR) -def test_invalid_junction_dep(cli, datafiles): - project = os.path.join(str(datafiles), 'invalid') - copy_subprojects(project, datafiles, ['base']) - - result = cli.run(project=project, args=['build', 'junction-dep.bst']) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA) - - -@pytest.mark.datafiles(DATA_DIR) -def test_options_default(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'options-default') - copy_subprojects(project, datafiles, ['options-base']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - assert(os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(not os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_options(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'options') - copy_subprojects(project, datafiles, ['options-base']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_options_inherit(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'options-inherit') - copy_subprojects(project, datafiles, ['options-base']) - - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Build, checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - assert(not os.path.exists(os.path.join(checkoutdir, 'pony.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'horsy.txt'))) - - -@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") -@pytest.mark.datafiles(DATA_DIR) -def test_git_show(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'foo') - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Create the repo from 'base' subdir - repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(str(datafiles), 'base')) - - # Write out junction element with git source - element = { - 'kind': 'junction', - 'sources': [ - repo.source_config(ref=ref) - ] - } - _yaml.dump(element, os.path.join(project, 'base.bst')) - - # Verify that bst show does not implicitly fetch subproject - result = cli.run(project=project, args=['show', 'target.bst']) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.SUBPROJECT_FETCH_NEEDED) - - # Explicitly fetch subproject - result = cli.run(project=project, args=['source', 'fetch', 'base.bst']) - result.assert_success() - - # Check that bst show succeeds now and the pipeline includes the subproject element - element_list = cli.get_pipeline(project, ['target.bst']) - assert 'base.bst:target.bst' in element_list - - -@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available") -@pytest.mark.datafiles(DATA_DIR) -def test_git_build(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'foo') - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Create the repo from 'base' subdir - repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(str(datafiles), 'base')) - - # Write out junction element with git source - element = { - 'kind': 'junction', - 'sources': [ - repo.source_config(ref=ref) - ] - } - _yaml.dump(element, os.path.join(project, 'base.bst')) - - # Build (with implicit fetch of subproject), checkout - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'target.bst', checkoutdir]) - result.assert_success() - - # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) - assert(os.path.exists(os.path.join(checkoutdir, 'foo.txt'))) - - -@pytest.mark.datafiles(DATA_DIR) -def test_cross_junction_names(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'foo') - copy_subprojects(project, datafiles, ['base']) - - element_list = cli.get_pipeline(project, ['base.bst:target.bst']) - assert 'base.bst:target.bst' in element_list - - -@pytest.mark.datafiles(DATA_DIR) -def test_build_git_cross_junction_names(cli, tmpdir, datafiles): - project = os.path.join(str(datafiles), 'foo') - checkoutdir = os.path.join(str(tmpdir), "checkout") - - # Create the repo from 'base' subdir - repo = create_repo('git', str(tmpdir)) - ref = repo.create(os.path.join(str(datafiles), 'base')) - - # Write out junction element with git source - element = { - 'kind': 'junction', - 'sources': [ - repo.source_config(ref=ref) - ] - } - _yaml.dump(element, os.path.join(project, 'base.bst')) - - print(element) - print(cli.get_pipeline(project, ['base.bst'])) - - # Build (with implicit fetch of subproject), checkout - result = cli.run(project=project, args=['build', 'base.bst:target.bst']) - result.assert_success() - result = cli.run(project=project, args=['checkout', 'base.bst:target.bst', checkoutdir]) - result.assert_success() - - # Check that the checkout contains the expected files from both projects - assert(os.path.exists(os.path.join(checkoutdir, 'base.txt'))) diff --git a/tests/loader/junctions/bar/app.bst b/tests/loader/junctions/bar/app.bst deleted file mode 100644 index a1a7a0ed9..000000000 --- a/tests/loader/junctions/bar/app.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: import -sources: -- kind: local - path: bar.txt -depends: -- junction: base.bst - filename: target.bst diff --git a/tests/loader/junctions/bar/bar.txt b/tests/loader/junctions/bar/bar.txt deleted file mode 100644 index 5716ca598..000000000 --- a/tests/loader/junctions/bar/bar.txt +++ /dev/null @@ -1 +0,0 @@ -bar diff --git a/tests/loader/junctions/bar/base.bst b/tests/loader/junctions/bar/base.bst deleted file mode 100644 index 10ce559a9..000000000 --- a/tests/loader/junctions/bar/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: base diff --git a/tests/loader/junctions/bar/project.conf b/tests/loader/junctions/bar/project.conf deleted file mode 100644 index f8ed6621d..000000000 --- a/tests/loader/junctions/bar/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: bar diff --git a/tests/loader/junctions/bar/target.bst b/tests/loader/junctions/bar/target.bst deleted file mode 100644 index 70b78a3fc..000000000 --- a/tests/loader/junctions/bar/target.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: stack -depends: -- junction: base.bst - filename: target.bst -- app.bst diff --git a/tests/loader/junctions/base/base.txt b/tests/loader/junctions/base/base.txt deleted file mode 100644 index a496efee8..000000000 --- a/tests/loader/junctions/base/base.txt +++ /dev/null @@ -1 +0,0 @@ -This is a text file diff --git a/tests/loader/junctions/base/project.conf b/tests/loader/junctions/base/project.conf deleted file mode 100644 index 951ea1a34..000000000 --- a/tests/loader/junctions/base/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: base diff --git a/tests/loader/junctions/base/target.bst b/tests/loader/junctions/base/target.bst deleted file mode 100644 index 2b61c518b..000000000 --- a/tests/loader/junctions/base/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: import -sources: -- kind: local - path: base.txt diff --git a/tests/loader/junctions/conflict/bar.bst b/tests/loader/junctions/conflict/bar.bst deleted file mode 100644 index 62eee825a..000000000 --- a/tests/loader/junctions/conflict/bar.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: bar diff --git a/tests/loader/junctions/conflict/foo.bst b/tests/loader/junctions/conflict/foo.bst deleted file mode 100644 index 1feb4010b..000000000 --- a/tests/loader/junctions/conflict/foo.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: foo diff --git a/tests/loader/junctions/conflict/project.conf b/tests/loader/junctions/conflict/project.conf deleted file mode 100644 index 395bb8423..000000000 --- a/tests/loader/junctions/conflict/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: conflict diff --git a/tests/loader/junctions/conflict/target.bst b/tests/loader/junctions/conflict/target.bst deleted file mode 100644 index 5e280e542..000000000 --- a/tests/loader/junctions/conflict/target.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: stack -depends: -- junction: foo.bst - filename: target.bst -- junction: bar.bst - filename: target.bst diff --git a/tests/loader/junctions/foo/app.bst b/tests/loader/junctions/foo/app.bst deleted file mode 100644 index e658628b0..000000000 --- a/tests/loader/junctions/foo/app.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: import -sources: -- kind: local - path: foo.txt -depends: -- junction: base.bst - filename: target.bst diff --git a/tests/loader/junctions/foo/base.bst b/tests/loader/junctions/foo/base.bst deleted file mode 100644 index 10ce559a9..000000000 --- a/tests/loader/junctions/foo/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: base diff --git a/tests/loader/junctions/foo/foo.txt b/tests/loader/junctions/foo/foo.txt deleted file mode 100644 index 257cc5642..000000000 --- a/tests/loader/junctions/foo/foo.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/loader/junctions/foo/project.conf b/tests/loader/junctions/foo/project.conf deleted file mode 100644 index 5a240e3ed..000000000 --- a/tests/loader/junctions/foo/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: foo diff --git a/tests/loader/junctions/foo/target.bst b/tests/loader/junctions/foo/target.bst deleted file mode 100644 index 70b78a3fc..000000000 --- a/tests/loader/junctions/foo/target.bst +++ /dev/null @@ -1,5 +0,0 @@ -kind: stack -depends: -- junction: base.bst - filename: target.bst -- app.bst diff --git a/tests/loader/junctions/inconsistent-names/elements/junction-A.bst b/tests/loader/junctions/inconsistent-names/elements/junction-A.bst deleted file mode 100644 index 74079f990..000000000 --- a/tests/loader/junctions/inconsistent-names/elements/junction-A.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: junctionA diff --git a/tests/loader/junctions/inconsistent-names/elements/junction-B-diff-name.bst b/tests/loader/junctions/inconsistent-names/elements/junction-B-diff-name.bst deleted file mode 100644 index 3b33406e5..000000000 --- a/tests/loader/junctions/inconsistent-names/elements/junction-B-diff-name.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: junctionA/junctionB diff --git a/tests/loader/junctions/inconsistent-names/elements/target.bst b/tests/loader/junctions/inconsistent-names/elements/target.bst deleted file mode 100644 index 7eba141de..000000000 --- a/tests/loader/junctions/inconsistent-names/elements/target.bst +++ /dev/null @@ -1,9 +0,0 @@ -kind: import -sources: -- kind: local - path: files/foo -depends: -- filename: lib2.bst - junction: junction-B-diff-name.bst -- filename: lib.bst - junction: junction-A.bst diff --git a/tests/loader/junctions/inconsistent-names/files/foo b/tests/loader/junctions/inconsistent-names/files/foo deleted file mode 100644 index e69de29bb..000000000 --- a/tests/loader/junctions/inconsistent-names/files/foo +++ /dev/null diff --git a/tests/loader/junctions/inconsistent-names/junctionA/elements/app.bst b/tests/loader/junctions/inconsistent-names/junctionA/elements/app.bst deleted file mode 100644 index 473aaee0b..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/elements/app.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: import -sources: -- kind: local - path: files/app -depends: -- lib.bst diff --git a/tests/loader/junctions/inconsistent-names/junctionA/elements/junction-B.bst b/tests/loader/junctions/inconsistent-names/junctionA/elements/junction-B.bst deleted file mode 100644 index bc66d7851..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/elements/junction-B.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: junctionB diff --git a/tests/loader/junctions/inconsistent-names/junctionA/elements/lib.bst b/tests/loader/junctions/inconsistent-names/junctionA/elements/lib.bst deleted file mode 100644 index 684a64315..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/elements/lib.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: import -sources: -- kind: local - path: files/lib -depends: -- filename: base.bst - junction: junction-B.bst diff --git a/tests/loader/junctions/inconsistent-names/junctionA/files/app b/tests/loader/junctions/inconsistent-names/junctionA/files/app deleted file mode 100644 index e69de29bb..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/files/app +++ /dev/null diff --git a/tests/loader/junctions/inconsistent-names/junctionA/files/lib b/tests/loader/junctions/inconsistent-names/junctionA/files/lib deleted file mode 100644 index e69de29bb..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/files/lib +++ /dev/null diff --git a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/base/baseimg b/tests/loader/junctions/inconsistent-names/junctionA/junctionB/base/baseimg deleted file mode 100644 index e69de29bb..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/base/baseimg +++ /dev/null diff --git a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst b/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst deleted file mode 100644 index ecdc57c79..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: import -sources: -- kind: local - path: base diff --git a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst b/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst deleted file mode 100644 index 5a7c17b99..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: import -sources: -- kind: local - path: files/lib2 -depends: -- base.bst diff --git a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/files/lib2 b/tests/loader/junctions/inconsistent-names/junctionA/junctionB/files/lib2 deleted file mode 100644 index e69de29bb..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/files/lib2 +++ /dev/null diff --git a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/project.conf b/tests/loader/junctions/inconsistent-names/junctionA/junctionB/project.conf deleted file mode 100644 index 2e96170f8..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/junctionB/project.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Unique project name -name: projectB - -# Subdirectory where elements are stored -element-path: elements diff --git a/tests/loader/junctions/inconsistent-names/junctionA/project.conf b/tests/loader/junctions/inconsistent-names/junctionA/project.conf deleted file mode 100644 index 166c4b78c..000000000 --- a/tests/loader/junctions/inconsistent-names/junctionA/project.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Unique project name -name: projectA - -# Subdirectory where elements are stored -element-path: elements diff --git a/tests/loader/junctions/inconsistent-names/project.conf b/tests/loader/junctions/inconsistent-names/project.conf deleted file mode 100644 index 064bbc588..000000000 --- a/tests/loader/junctions/inconsistent-names/project.conf +++ /dev/null @@ -1,5 +0,0 @@ -# Unique project name -name: inconsistent-names - -# Subdirectory where elements are stored -element-path: elements diff --git a/tests/loader/junctions/invalid/app.bst b/tests/loader/junctions/invalid/app.bst deleted file mode 100644 index 9906149a6..000000000 --- a/tests/loader/junctions/invalid/app.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: import -sources: -- kind: local - path: foo.txt diff --git a/tests/loader/junctions/invalid/base-with-deps.bst b/tests/loader/junctions/invalid/base-with-deps.bst deleted file mode 100644 index a30eb3a52..000000000 --- a/tests/loader/junctions/invalid/base-with-deps.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: junction -sources: -- kind: local - path: base -depends: -- app.bst diff --git a/tests/loader/junctions/invalid/base.bst b/tests/loader/junctions/invalid/base.bst deleted file mode 100644 index 10ce559a9..000000000 --- a/tests/loader/junctions/invalid/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: base diff --git a/tests/loader/junctions/invalid/foo.txt b/tests/loader/junctions/invalid/foo.txt deleted file mode 100644 index 257cc5642..000000000 --- a/tests/loader/junctions/invalid/foo.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/loader/junctions/invalid/junction-dep.bst b/tests/loader/junctions/invalid/junction-dep.bst deleted file mode 100644 index 20fd30011..000000000 --- a/tests/loader/junctions/invalid/junction-dep.bst +++ /dev/null @@ -1,3 +0,0 @@ -kind: stack -depends: -- base.bst diff --git a/tests/loader/junctions/invalid/junction-with-deps.bst b/tests/loader/junctions/invalid/junction-with-deps.bst deleted file mode 100644 index d2ca337dd..000000000 --- a/tests/loader/junctions/invalid/junction-with-deps.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: base-with-deps.bst - filename: target.bst diff --git a/tests/loader/junctions/invalid/missing-element.bst b/tests/loader/junctions/invalid/missing-element.bst deleted file mode 100644 index 4c29221af..000000000 --- a/tests/loader/junctions/invalid/missing-element.bst +++ /dev/null @@ -1,9 +0,0 @@ -# This refers to the `foo.bst` element through -# the `base.bst` junction. The `base.bst` junction -# exists but the `foo.bst` element does not exist -# in the subproject. -# -kind: stack -depends: -- junction: base.bst - filename: foo.bst diff --git a/tests/loader/junctions/invalid/missing.bst b/tests/loader/junctions/invalid/missing.bst deleted file mode 100644 index 672e967fe..000000000 --- a/tests/loader/junctions/invalid/missing.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: missingfile.bst - filename: target.bst diff --git a/tests/loader/junctions/invalid/project.conf b/tests/loader/junctions/invalid/project.conf deleted file mode 100644 index 38070bf71..000000000 --- a/tests/loader/junctions/invalid/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: invalid diff --git a/tests/loader/junctions/nested/foo.bst b/tests/loader/junctions/nested/foo.bst deleted file mode 100644 index 1feb4010b..000000000 --- a/tests/loader/junctions/nested/foo.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: foo diff --git a/tests/loader/junctions/nested/project.conf b/tests/loader/junctions/nested/project.conf deleted file mode 100644 index 551f51c6a..000000000 --- a/tests/loader/junctions/nested/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: nested diff --git a/tests/loader/junctions/nested/target.bst b/tests/loader/junctions/nested/target.bst deleted file mode 100644 index db59499a7..000000000 --- a/tests/loader/junctions/nested/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: foo.bst - filename: target.bst diff --git a/tests/loader/junctions/options-base/horsy.txt b/tests/loader/junctions/options-base/horsy.txt deleted file mode 100644 index 063dad656..000000000 --- a/tests/loader/junctions/options-base/horsy.txt +++ /dev/null @@ -1 +0,0 @@ -horsy diff --git a/tests/loader/junctions/options-base/pony.txt b/tests/loader/junctions/options-base/pony.txt deleted file mode 100644 index f62144808..000000000 --- a/tests/loader/junctions/options-base/pony.txt +++ /dev/null @@ -1 +0,0 @@ -pony diff --git a/tests/loader/junctions/options-base/project.conf b/tests/loader/junctions/options-base/project.conf deleted file mode 100644 index a98ebd5ed..000000000 --- a/tests/loader/junctions/options-base/project.conf +++ /dev/null @@ -1,9 +0,0 @@ -name: options-base -options: - animal: - type: enum - description: The kind of animal - values: - - pony - - horsy - default: pony diff --git a/tests/loader/junctions/options-base/target.bst b/tests/loader/junctions/options-base/target.bst deleted file mode 100644 index cda17af98..000000000 --- a/tests/loader/junctions/options-base/target.bst +++ /dev/null @@ -1,8 +0,0 @@ -kind: import -sources: -- kind: local - (?): - - animal == "pony": - path: pony.txt - - animal == "horsy": - path: horsy.txt diff --git a/tests/loader/junctions/options-default/base.bst b/tests/loader/junctions/options-default/base.bst deleted file mode 100644 index 5d42e5c31..000000000 --- a/tests/loader/junctions/options-default/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: options-base diff --git a/tests/loader/junctions/options-default/project.conf b/tests/loader/junctions/options-default/project.conf deleted file mode 100644 index b9e58a582..000000000 --- a/tests/loader/junctions/options-default/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: options-default diff --git a/tests/loader/junctions/options-default/target.bst b/tests/loader/junctions/options-default/target.bst deleted file mode 100644 index 8395c0c77..000000000 --- a/tests/loader/junctions/options-default/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: base.bst - filename: target.bst diff --git a/tests/loader/junctions/options-inherit/base.bst b/tests/loader/junctions/options-inherit/base.bst deleted file mode 100644 index 8623d0d01..000000000 --- a/tests/loader/junctions/options-inherit/base.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: junction -sources: -- kind: local - path: options-base -config: - options: - animal: '%{animal}' diff --git a/tests/loader/junctions/options-inherit/project.conf b/tests/loader/junctions/options-inherit/project.conf deleted file mode 100644 index 1e0ea4464..000000000 --- a/tests/loader/junctions/options-inherit/project.conf +++ /dev/null @@ -1,10 +0,0 @@ -name: options-inherit -options: - animal: - type: enum - description: The kind of animal - values: - - pony - - horsy - default: horsy - variable: animal diff --git a/tests/loader/junctions/options-inherit/target.bst b/tests/loader/junctions/options-inherit/target.bst deleted file mode 100644 index 8395c0c77..000000000 --- a/tests/loader/junctions/options-inherit/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: base.bst - filename: target.bst diff --git a/tests/loader/junctions/options/base.bst b/tests/loader/junctions/options/base.bst deleted file mode 100644 index a100e5e1e..000000000 --- a/tests/loader/junctions/options/base.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: junction -sources: -- kind: local - path: options-base -config: - options: - animal: horsy diff --git a/tests/loader/junctions/options/project.conf b/tests/loader/junctions/options/project.conf deleted file mode 100644 index de53ae176..000000000 --- a/tests/loader/junctions/options/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: options diff --git a/tests/loader/junctions/options/target.bst b/tests/loader/junctions/options/target.bst deleted file mode 100644 index 8395c0c77..000000000 --- a/tests/loader/junctions/options/target.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: stack -depends: -- junction: base.bst - filename: target.bst diff --git a/tests/loader/junctions/toplevel/bar.bst b/tests/loader/junctions/toplevel/bar.bst deleted file mode 100644 index 62eee825a..000000000 --- a/tests/loader/junctions/toplevel/bar.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: bar diff --git a/tests/loader/junctions/toplevel/base.bst b/tests/loader/junctions/toplevel/base.bst deleted file mode 100644 index 10ce559a9..000000000 --- a/tests/loader/junctions/toplevel/base.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: base diff --git a/tests/loader/junctions/toplevel/foo.bst b/tests/loader/junctions/toplevel/foo.bst deleted file mode 100644 index 1feb4010b..000000000 --- a/tests/loader/junctions/toplevel/foo.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: junction -sources: -- kind: local - path: foo diff --git a/tests/loader/junctions/toplevel/project.conf b/tests/loader/junctions/toplevel/project.conf deleted file mode 100644 index 496c82128..000000000 --- a/tests/loader/junctions/toplevel/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: toplevel diff --git a/tests/loader/junctions/toplevel/target.bst b/tests/loader/junctions/toplevel/target.bst deleted file mode 100644 index 5e280e542..000000000 --- a/tests/loader/junctions/toplevel/target.bst +++ /dev/null @@ -1,6 +0,0 @@ -kind: stack -depends: -- junction: foo.bst - filename: target.bst -- junction: bar.bst - filename: target.bst diff --git a/tests/loader/variables.py b/tests/loader/variables.py deleted file mode 100644 index 9871d63c6..000000000 --- a/tests/loader/variables.py +++ /dev/null @@ -1,99 +0,0 @@ -import os -import pytest - -from buildstream import _yaml -from buildstream._exceptions import ErrorDomain, LoadErrorReason -from tests.testutils import cli - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'variables', -) - -PROTECTED_VARIABLES = [('project-name'), ('element-name'), ('max-jobs')] - - -@pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) -@pytest.mark.datafiles(DATA_DIR) -def test_use_of_protected_var_project_conf(cli, tmpdir, datafiles, protected_var): - project = os.path.join(str(datafiles), 'simple') - - conf = { - 'name': 'test', - 'variables': { - protected_var: 'some-value' - } - } - _yaml.dump(conf, os.path.join(project, 'project.conf')) - - element = { - 'kind': 'import', - 'sources': [ - { - 'kind': 'local', - 'path': 'foo.txt' - } - ], - } - _yaml.dump(element, os.path.join(project, 'target.bst')) - - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_main_error(ErrorDomain.LOAD, - LoadErrorReason.PROTECTED_VARIABLE_REDEFINED) - - -@pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) -@pytest.mark.datafiles(DATA_DIR) -def test_use_of_protected_var_element_overrides(cli, tmpdir, datafiles, protected_var): - project = os.path.join(str(datafiles), 'simple') - - conf = { - 'name': 'test', - 'elements': { - 'manual': { - 'variables': { - protected_var: 'some-value' - } - } - } - } - _yaml.dump(conf, os.path.join(project, 'project.conf')) - - element = { - 'kind': 'manual', - 'sources': [ - { - 'kind': 'local', - 'path': 'foo.txt' - } - ], - } - _yaml.dump(element, os.path.join(project, 'target.bst')) - - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_main_error(ErrorDomain.LOAD, - LoadErrorReason.PROTECTED_VARIABLE_REDEFINED) - - -@pytest.mark.parametrize('protected_var', PROTECTED_VARIABLES) -@pytest.mark.datafiles(DATA_DIR) -def test_use_of_protected_var_in_element(cli, tmpdir, datafiles, protected_var): - project = os.path.join(str(datafiles), 'simple') - - element = { - 'kind': 'import', - 'sources': [ - { - 'kind': 'local', - 'path': 'foo.txt' - } - ], - 'variables': { - protected_var: 'some-value' - } - } - _yaml.dump(element, os.path.join(project, 'target.bst')) - - result = cli.run(project=project, args=['build', 'target.bst']) - result.assert_main_error(ErrorDomain.LOAD, - LoadErrorReason.PROTECTED_VARIABLE_REDEFINED) diff --git a/tests/loader/variables/simple/foo.txt b/tests/loader/variables/simple/foo.txt deleted file mode 100644 index 257cc5642..000000000 --- a/tests/loader/variables/simple/foo.txt +++ /dev/null @@ -1 +0,0 @@ -foo diff --git a/tests/loader/variables/simple/project.conf b/tests/loader/variables/simple/project.conf deleted file mode 100644 index 5a240e3ed..000000000 --- a/tests/loader/variables/simple/project.conf +++ /dev/null @@ -1 +0,0 @@ -name: foo |