diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-09-22 12:16:45 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2017-10-08 17:03:36 +0900 |
commit | bc8a2ebb3b0d8e0f535b2956b9c6a3ad0a05fcef (patch) | |
tree | 3539adb821e527613bb13bc4242ae0b6c1665532 /tests/loader | |
parent | e1df2e2d0a33667993c9800ca567b755037704a0 (diff) | |
download | buildstream-bc8a2ebb3b0d8e0f535b2956b9c6a3ad0a05fcef.tar.gz |
Updating test cases to construct the project/loader properly again.
This had changed when we added project variants and had to split
up the loading steps a bit, now all is back to normal without variants.
Diffstat (limited to 'tests/loader')
-rw-r--r-- | tests/loader/arches.py | 144 | ||||
-rw-r--r-- | tests/loader/arches/elements/variant-arch-conditional.bst | 25 | ||||
-rw-r--r-- | tests/loader/basics.py | 12 | ||||
-rw-r--r-- | tests/loader/dependencies.py | 20 |
4 files changed, 22 insertions, 179 deletions
diff --git a/tests/loader/arches.py b/tests/loader/arches.py index eb823c6f3..041fbb7e1 100644 --- a/tests/loader/arches.py +++ b/tests/loader/arches.py @@ -19,7 +19,7 @@ def test_simple_conditional_nomatch(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', None, 'arm', None, []) + basedir, 'elements/simple-conditional.bst', 'arm', None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -34,7 +34,7 @@ def test_simple_conditional_x86_64(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', None, 'x86_64', None, []) + basedir, 'elements/simple-conditional.bst', 'x86_64', None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -49,7 +49,7 @@ def test_simple_conditional_x86_32(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/simple-conditional.bst', None, 'x86_32', None, []) + basedir, 'elements/simple-conditional.bst', 'x86_32', None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -69,7 +69,7 @@ def test_host_arch_conditional_armv8(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', None, 'armv8', None, []) + basedir, 'elements/host-arch-conditional.bst', 'armv8', None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -84,7 +84,7 @@ def test_host_arch_conditional_ignores_target_arch(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', None, 'armv8', 'x86_32', []) + basedir, 'elements/host-arch-conditional.bst', 'armv8', 'x86_32') element = loader.load() assert(isinstance(element, MetaElement)) @@ -100,7 +100,7 @@ def test_host_arch_conditional_overridden(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) loader = Loader( - basedir, 'elements/host-arch-conditional.bst', None, 'armv8', 'x86_64', []) + basedir, 'elements/host-arch-conditional.bst', 'armv8', 'x86_64') element = loader.load() assert(isinstance(element, MetaElement)) @@ -109,135 +109,3 @@ def test_host_arch_conditional_overridden(datafiles): # The 'arches' conditional follows the target architecture, and overrides # anything specified in 'host-arches'. assert(number == 6) - - -############################################################## -# Test Arch Conditionals inside Variants # -############################################################## -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_default(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', None, 'arm', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - # The default "pink" variant sets number to 6 - assert(number == 6) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_default_x86_64(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', None, 'x86_64', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 7) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_default_x86_32(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', None, 'x86_32', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 8) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_pink_pony(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'pink', 'arm', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - # The default "pink" variant sets number to 6 - assert(number == 6) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_pink_pony_x86_64(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'pink', 'x86_64', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 7) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_pink_pony_x86_32(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'pink', 'x86_32', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 8) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_blue_pony(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'blue', 'arm', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - # The "blue" variant sets number to 4 - assert(number == 4) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_blue_pony_x86_64(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'blue', 'x86_64', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 3) - - -@pytest.mark.datafiles(DATA_DIR) -def test_variant_arch_blue_pony_x86_32(datafiles): - - basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader( - basedir, 'elements/variant-arch-conditional.bst', 'blue', 'x86_32', None, []) - - element = loader.load() - assert(isinstance(element, MetaElement)) - number = element.config.get('number') - - assert(number == 2) diff --git a/tests/loader/arches/elements/variant-arch-conditional.bst b/tests/loader/arches/elements/variant-arch-conditional.bst deleted file mode 100644 index 1171911d7..000000000 --- a/tests/loader/arches/elements/variant-arch-conditional.bst +++ /dev/null @@ -1,25 +0,0 @@ -kind: pony -description: Test out arch conditionals nested inside variant declarations -config: - number: 5 -variants: -- variant: pink - config: - number: 6 - arches: - x86_64: - config: - number: 7 - x86_32: - config: - number: 8 -- variant: blue - config: - number: 4 - arches: - x86_64: - config: - number: 3 - x86_32: - config: - number: 2 diff --git a/tests/loader/basics.py b/tests/loader/basics.py index ef2a2158a..a395d3768 100644 --- a/tests/loader/basics.py +++ b/tests/loader/basics.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( def test_one_file(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/onefile.bst', None, None, None, []) + loader = Loader(basedir, 'elements/onefile.bst', None, None) element = loader.load() @@ -30,7 +30,7 @@ def test_one_file(datafiles): def test_missing_file(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/missing.bst', None, None, None, []) + loader = Loader(basedir, 'elements/missing.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -42,7 +42,7 @@ def test_missing_file(datafiles): def test_invalid_reference(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/badreference.bst', None, None, None, []) + loader = Loader(basedir, 'elements/badreference.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -54,7 +54,7 @@ def test_invalid_reference(datafiles): def test_invalid_yaml(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/badfile.bst', None, None, None, []) + loader = Loader(basedir, 'elements/badfile.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -69,7 +69,7 @@ def test_fail_fullpath_target(datafiles): fullpath = os.path.join(basedir, 'elements', 'onefile.bst') with pytest.raises(LoadError) as exc: - loader = Loader(basedir, fullpath, None, None, None, []) + loader = Loader(basedir, fullpath, None, None) assert (exc.value.reason == LoadErrorReason.INVALID_DATA) @@ -78,7 +78,7 @@ def test_fail_fullpath_target(datafiles): def test_invalid_key(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invalidkey.bst', None, None, None, []) + loader = Loader(basedir, 'elements/invalidkey.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() diff --git a/tests/loader/dependencies.py b/tests/loader/dependencies.py index d4f9956c1..3850a0086 100644 --- a/tests/loader/dependencies.py +++ b/tests/loader/dependencies.py @@ -18,7 +18,7 @@ DATA_DIR = os.path.join( def test_two_files(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target.bst', None, None, None, []) + loader = Loader(basedir, 'elements/target.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -34,7 +34,7 @@ def test_two_files(datafiles): def test_shared_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/shareddeptarget.bst', None, None, None, []) + loader = Loader(basedir, 'elements/shareddeptarget.bst', None, None) element = loader.load() # Toplevel is 'pony' with 2 dependencies @@ -77,7 +77,7 @@ def test_shared_dependency(datafiles): def test_dependency_dict(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target-depdict.bst', None, None, None, []) + loader = Loader(basedir, 'elements/target-depdict.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -92,7 +92,7 @@ def test_dependency_dict(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_invalid_dependency_declaration(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invaliddep.bst', None, None, None, []) + loader = Loader(basedir, 'elements/invaliddep.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -103,7 +103,7 @@ def test_invalid_dependency_declaration(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_circular_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/circulartarget.bst', None, None, None, []) + loader = Loader(basedir, 'elements/circulartarget.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -114,7 +114,7 @@ def test_circular_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_invalid_dependency_type(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/invaliddeptype.bst', None, None, None, []) + loader = Loader(basedir, 'elements/invaliddeptype.bst', None, None) with pytest.raises(LoadError) as exc: element = loader.load() @@ -125,7 +125,7 @@ def test_invalid_dependency_type(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/builddep.bst', None, None, None, []) + loader = Loader(basedir, 'elements/builddep.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -141,7 +141,7 @@ def test_build_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_runtime_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/runtimedep.bst', None, None, None, []) + loader = Loader(basedir, 'elements/runtimedep.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -157,7 +157,7 @@ def test_runtime_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_build_runtime_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/target.bst', None, None, None, []) + loader = Loader(basedir, 'elements/target.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) @@ -174,7 +174,7 @@ def test_build_runtime_dependency(datafiles): @pytest.mark.datafiles(DATA_DIR) def test_all_dependency(datafiles): basedir = os.path.join(datafiles.dirname, datafiles.basename) - loader = Loader(basedir, 'elements/alldep.bst', None, None, None, []) + loader = Loader(basedir, 'elements/alldep.bst', None, None) element = loader.load() assert(isinstance(element, MetaElement)) |