diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-16 18:44:30 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2016-12-19 16:45:27 +0900 |
commit | 756f29394a2ff41f733e7af9a6fe882c960dde1a (patch) | |
tree | 71ef841c26539e10d57a03a176e15fe4246eb11c /tests/loader | |
parent | c1c3c2e63ffb8bdec17dd1e79166d5ae25661ef7 (diff) | |
download | buildstream-756f29394a2ff41f733e7af9a6fe882c960dde1a.tar.gz |
Removed code and tests related to stacks and includes.
Stacks should still exist but they are purely an element
implementation detail.
Diffstat (limited to 'tests/loader')
21 files changed, 0 insertions, 650 deletions
diff --git a/tests/loader/includes.py b/tests/loader/includes.py deleted file mode 100644 index ecda62cc2..000000000 --- a/tests/loader/includes.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import pytest - -from buildstream import LoadError, LoadErrorReason -from buildstream._loader import Loader -from buildstream._metaelement import MetaElement - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'includes', -) - - -############################################################## -# Test Basic Include Functionality # -############################################################## -@pytest.mark.datafiles(DATA_DIR) -def test_basic_include(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target.bst', None, None) - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'pony') - - # Assert that the stuff from the include got into the element data - assert(element.config.get('pony') == 'Someone rides their pony') - - thelist = element.config.get('list', None) - assert(isinstance(thelist, list)) - assert(thelist[0] == 'Element 1') - assert(thelist[1] == 'Element 2') - - -@pytest.mark.datafiles(DATA_DIR) -def test_invalid_type_include(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invalidinclude.bst', None, None) - - with pytest.raises(LoadError) as exc: - element = loader.load() - - assert (exc.value.reason == LoadErrorReason.ILLEGAL_COMPOSITE) - - -@pytest.mark.datafiles(DATA_DIR) -def test_overwrite_kind_include(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/overwriting.bst', None, None) - - with pytest.raises(LoadError) as exc: - element = loader.load() - - assert (exc.value.reason == LoadErrorReason.ILLEGAL_COMPOSITE) - - -@pytest.mark.datafiles(DATA_DIR) -def test_missing_include(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/missing.bst', None, None) - - with pytest.raises(LoadError) as exc: - element = loader.load() - - assert (exc.value.reason == LoadErrorReason.MISSING_FILE) diff --git a/tests/loader/includes/elements/invalidinclude.bst b/tests/loader/includes/elements/invalidinclude.bst deleted file mode 100644 index ea1cad06f..000000000 --- a/tests/loader/includes/elements/invalidinclude.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: pony -description: This includes a file which tries to override a regular attribute with a dict -include: include/invalidtype.bst -somekey: pony diff --git a/tests/loader/includes/elements/missing.bst b/tests/loader/includes/elements/missing.bst deleted file mode 100644 index aaaaf1712..000000000 --- a/tests/loader/includes/elements/missing.bst +++ /dev/null @@ -1,3 +0,0 @@ -kind: pony -description: This is a missing include file that does not exist -include: include/missinginclude.bst diff --git a/tests/loader/includes/elements/overwriting.bst b/tests/loader/includes/elements/overwriting.bst deleted file mode 100644 index 0f33473d4..000000000 --- a/tests/loader/includes/elements/overwriting.bst +++ /dev/null @@ -1,3 +0,0 @@ -kind: pony -description: This includes a file which tries to override the 'kind', overwriting from an include is not allowed -include: include/overwritekind.bst diff --git a/tests/loader/includes/elements/target.bst b/tests/loader/includes/elements/target.bst deleted file mode 100644 index 740af38c0..000000000 --- a/tests/loader/includes/elements/target.bst +++ /dev/null @@ -1,3 +0,0 @@ -kind: pony -description: This is the main target, which includes another file -include: include/basicinclude.bst diff --git a/tests/loader/includes/include/basicinclude.bst b/tests/loader/includes/include/basicinclude.bst deleted file mode 100644 index a7e85e8eb..000000000 --- a/tests/loader/includes/include/basicinclude.bst +++ /dev/null @@ -1,5 +0,0 @@ -config: - pony: "Someone rides their pony" - list: - - "Element 1" - - "Element 2" diff --git a/tests/loader/includes/include/invalidtype.bst b/tests/loader/includes/include/invalidtype.bst deleted file mode 100644 index f561c4705..000000000 --- a/tests/loader/includes/include/invalidtype.bst +++ /dev/null @@ -1,4 +0,0 @@ -pony: "Someone rides their pony" -somekey: - this: "pony" - that: "foo" diff --git a/tests/loader/includes/include/overwritekind.bst b/tests/loader/includes/include/overwritekind.bst deleted file mode 100644 index ee8df0ca1..000000000 --- a/tests/loader/includes/include/overwritekind.bst +++ /dev/null @@ -1,2 +0,0 @@ -# You cannot overwrite members specified in the including element -kind: horse diff --git a/tests/loader/stacks.py b/tests/loader/stacks.py deleted file mode 100644 index 5c6a880eb..000000000 --- a/tests/loader/stacks.py +++ /dev/null @@ -1,423 +0,0 @@ -import os -import pytest - -from buildstream import LoadError, LoadErrorReason -from buildstream._loader import Loader -from buildstream._metaelement import MetaElement - -DATA_DIR = os.path.join( - os.path.dirname(os.path.realpath(__file__)), - 'stacks', -) - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_basic(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - filename = os.path.join('elements', 'stack.bst') - loader = Loader(basedir, filename, None, 'x86_64') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - - # Assert that the stuff from the include got into the element data, - # first check that we depend on both elements - assert(len(element.dependencies) == 2) - - pony = element.dependencies[0] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - - horse = element.dependencies[1] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_dependencies(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - filename = os.path.join('elements', 'stackdepends.bst') - loader = Loader(basedir, filename, None, 'x86_64') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - - # Assert that the stuff from the include got into the element data, - # first check that we depend on both elements - assert(len(element.dependencies) == 3) - - leaf = element.dependencies[0] - assert(isinstance(leaf, MetaElement)) - assert(leaf.kind == 'element') - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - assert(len(pony.dependencies) == 1) - - # By virtue of being embedded in a stack which - # depends on the leaf 'element', this element - # also depends on the leaf 'element' - ponyleaf = pony.dependencies[0] - assert(isinstance(ponyleaf, MetaElement)) - assert(ponyleaf.kind == 'element') - - horse = element.dependencies[2] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - assert(len(horse.dependencies) == 1) - - # By virtue of being embedded in a stack which - # depends on the leaf 'element', this element - # also depends on the leaf 'element' - horseleaf = horse.dependencies[0] - assert(isinstance(horseleaf, MetaElement)) - assert(horseleaf.kind == 'element') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_includes(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/includingstack.bst', None, None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - - # Assert that the stuff from the include got into the element data, - # first check that we depend on both elements - assert(len(element.dependencies) == 2) - - pony = element.dependencies[0] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - - horse = element.dependencies[1] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - - # Now check that the config data from the includes made it in - assert(pony.config.get('pony') == 'Someone rides their pony') - assert(horse.config.get('horse') == 'Riding a horse') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_arch_default(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/archstack.bst', None, None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'archstack') - - # Only one dependency, no known arch was selected - assert(len(element.dependencies) == 1) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_arch_x86_64(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/archstack.bst', None, 'x86_64') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'archstack') - - # Two dependencies for x86_64 - assert(len(element.dependencies) == 2) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_arch_x86_32(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/archstack.bst', None, 'x86_32') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'archstack') - - # Two dependencies for x86_64 - assert(len(element.dependencies) == 2) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - horse = element.dependencies[1] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_arch_default(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedarchstack.bst', None, None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedarchstack') - - # No specified arch, the color remains brown by default - assert(len(element.dependencies) == 1) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('color') == 'brown') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_arch_x86_64(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedarchstack.bst', None, 'x86_64') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedarchstack') - - # x86_64, the color is now pink - assert(len(element.dependencies) == 1) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('color') == 'pink') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_arch_x86_32(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedarchstack.bst', None, 'x86_32') - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedarchstack') - - # x86_32, the color is now pink - assert(len(element.dependencies) == 1) - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('color') == 'blue') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_variant_default(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/variantstack.bst', None, None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'variantstack') - - # No specified variant, we get a pony by default - assert(len(element.dependencies) == 2) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_variant_pony(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/variantstack.bst', 'pony', None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'variantstack') - - # We asked for the pony variant, we get a pony - assert(len(element.dependencies) == 2) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_variant_horse(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/variantstack.bst', 'horse', None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'variantstack') - - # We asked for the horse variant, we get a horse - assert(len(element.dependencies) == 2) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - - horse = element.dependencies[1] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_variant_default(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedvariantstack.bst', None, None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedvariantstack') - - # No specified variant, we get a pony by default - assert(len(element.dependencies) == 3) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('number') == 6) - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - assert(pony.config.get('number') == 6) - - horse = element.dependencies[2] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - assert(horse.config.get('number') == 5) - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_variant_pony(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedvariantstack.bst', 'pony', None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedvariantstack') - - # We asked for a pony, we get a pony - assert(len(element.dependencies) == 3) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('number') == 6) - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - assert(pony.config.get('number') == 6) - - horse = element.dependencies[2] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - assert(horse.config.get('number') == 5) - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_nested_variant_horse(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/nestedvariantstack.bst', 'horse', None) - - element = loader.load() - - assert(isinstance(element, MetaElement)) - assert(element.kind == 'stack') - assert(element.name == 'nestedvariantstack') - - # We asked for a horse, we get a horse - assert(len(element.dependencies) == 3) - - rider = element.dependencies[0] - assert(isinstance(rider, MetaElement)) - assert(rider.kind == 'rider') - assert(rider.config.get('number') == 7) - - pony = element.dependencies[1] - assert(isinstance(pony, MetaElement)) - assert(pony.kind == 'pony') - assert(pony.config.get('number') == 5) - - horse = element.dependencies[2] - assert(isinstance(horse, MetaElement)) - assert(horse.kind == 'horsy') - assert(horse.config.get('number') == 7) - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_internal_circular_dependency(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/circulardepstack.bst', None, None) - - with pytest.raises(LoadError) as exc: - element = loader.load() - - assert (exc.value.reason == LoadErrorReason.CIRCULAR_DEPENDENCY) - - -@pytest.mark.datafiles(DATA_DIR) -def test_stack_embedded_in_stack(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/stackinstack.bst', None, None) - - with pytest.raises(LoadError) as exc: - element = loader.load() - - assert (exc.value.reason == LoadErrorReason.INVALID_DATA) diff --git a/tests/loader/stacks/elements/archstack.bst b/tests/loader/stacks/elements/archstack.bst deleted file mode 100644 index 08239c345..000000000 --- a/tests/loader/stacks/elements/archstack.bst +++ /dev/null @@ -1,15 +0,0 @@ -kind: stack -description: This is a stack, and it's elements include stuff -embeds: -- name: rider - kind: rider -arches: - x86_64: - embeds: - - name: pony - kind: pony - x86_32: - embeds: - - name: horse - kind: horsy -
\ No newline at end of file diff --git a/tests/loader/stacks/elements/circulardepstack.bst b/tests/loader/stacks/elements/circulardepstack.bst deleted file mode 100644 index 9a65ff485..000000000 --- a/tests/loader/stacks/elements/circulardepstack.bst +++ /dev/null @@ -1,15 +0,0 @@ -kind: stack -description: This is a stack with an internal circular dependency -embeds: -- name: horse - kind: horsy - depends: - - rider -- name: pony - kind: pony - depends: - - horse -- name: rider - kind: rider - depends: - - pony diff --git a/tests/loader/stacks/elements/element.bst b/tests/loader/stacks/elements/element.bst deleted file mode 100644 index 366429eb1..000000000 --- a/tests/loader/stacks/elements/element.bst +++ /dev/null @@ -1,4 +0,0 @@ -kind: element -description: This is just a leaf element -config: - type: leaf diff --git a/tests/loader/stacks/elements/includingstack.bst b/tests/loader/stacks/elements/includingstack.bst deleted file mode 100644 index 79187e3ec..000000000 --- a/tests/loader/stacks/elements/includingstack.bst +++ /dev/null @@ -1,10 +0,0 @@ -kind: stack -description: This is a stack, and it's elements include stuff -embeds: -- name: pony - kind: pony - include: include/pony.bst -- name: horse - kind: horsy - include: include/horse.bst - diff --git a/tests/loader/stacks/elements/nestedarchstack.bst b/tests/loader/stacks/elements/nestedarchstack.bst deleted file mode 100644 index ddef648e4..000000000 --- a/tests/loader/stacks/elements/nestedarchstack.bst +++ /dev/null @@ -1,14 +0,0 @@ -kind: stack -description: This is a stack whos embedded elements have arch conditionals -embeds: -- name: rider - kind: rider - config: - color: brown - arches: - x86_64: - config: - color: pink - x86_32: - config: - color: blue diff --git a/tests/loader/stacks/elements/nestedvariantstack.bst b/tests/loader/stacks/elements/nestedvariantstack.bst deleted file mode 100644 index 3f6879fde..000000000 --- a/tests/loader/stacks/elements/nestedvariantstack.bst +++ /dev/null @@ -1,33 +0,0 @@ -kind: stack -description: This is a stack, and variants define how the embedded elements are configured -embeds: -- name: rider - kind: rider - config: - number: 5 - variants: - - variant: pony - config: - number: 6 - - variant: horse - config: - number: 7 -- name: pony - kind: pony - config: - number: 5 - variants: - - variant: pony - config: - number: 6 -- name: horse - kind: horsy - config: - number: 5 - variants: - - variant: horse - config: - number: 7 -variants: -- variant: pony -- variant: horse diff --git a/tests/loader/stacks/elements/stack.bst b/tests/loader/stacks/elements/stack.bst deleted file mode 100644 index 1900e389b..000000000 --- a/tests/loader/stacks/elements/stack.bst +++ /dev/null @@ -1,7 +0,0 @@ -kind: stack -description: This is a stack, and it's elements include stuff -embeds: -- name: pony - kind: pony -- name: horse - kind: horsy diff --git a/tests/loader/stacks/elements/stackdepends.bst b/tests/loader/stacks/elements/stackdepends.bst deleted file mode 100644 index 0d35f8464..000000000 --- a/tests/loader/stacks/elements/stackdepends.bst +++ /dev/null @@ -1,9 +0,0 @@ -kind: stack -description: This is a stack, and it's elements include stuff -depends: -- elements/element.bst -embeds: -- name: pony - kind: pony -- name: horse - kind: horsy diff --git a/tests/loader/stacks/elements/stackinstack.bst b/tests/loader/stacks/elements/stackinstack.bst deleted file mode 100644 index 5b91128d2..000000000 --- a/tests/loader/stacks/elements/stackinstack.bst +++ /dev/null @@ -1,9 +0,0 @@ -kind: stack -description: This is a stack embedded in a stack -embeds: -- name: horse - kind: stack - embeds: - - name: impossible - kind: mission - description: You cannot embed stacks inside stacks diff --git a/tests/loader/stacks/elements/variantstack.bst b/tests/loader/stacks/elements/variantstack.bst deleted file mode 100644 index 6b8b2c8a6..000000000 --- a/tests/loader/stacks/elements/variantstack.bst +++ /dev/null @@ -1,14 +0,0 @@ -kind: stack -description: This is a stack, and variants define what other elements to embed -embeds: -- name: rider - kind: rider -variants: -- variant: pony - embeds: - - name: pony - kind: pony -- variant: horse - embeds: - - name: horse - kind: horsy diff --git a/tests/loader/stacks/include/horse.bst b/tests/loader/stacks/include/horse.bst deleted file mode 100644 index 1003c9073..000000000 --- a/tests/loader/stacks/include/horse.bst +++ /dev/null @@ -1,2 +0,0 @@ -config: - horse: "Riding a horse" diff --git a/tests/loader/stacks/include/pony.bst b/tests/loader/stacks/include/pony.bst deleted file mode 100644 index 3e33614b5..000000000 --- a/tests/loader/stacks/include/pony.bst +++ /dev/null @@ -1,2 +0,0 @@ -config: - pony: "Someone rides their pony" |