Commit e55a9703 authored by Jürg Billeter's avatar Jürg Billeter

Merge branch 'element-path_not_validated' into 'master'

Element path not validated before use

See merge request !937
parents e6e03451 56a54161
Pipeline #36565969 failed with stages
in 855 minutes and 42 seconds
......@@ -219,6 +219,19 @@ class Project():
return self._cache_key
def _validate_node(self, node):
_yaml.node_validate(node, [
'element-path', 'variables',
'environment', 'environment-nocache',
'split-rules', 'elements', 'plugins',
'aliases', 'name',
'artifacts', 'options',
'fail-on-overlap', 'shell', 'fatal-warnings',
'ref-storage', 'sandbox', 'mirrors', 'remote-execution',
'sources', '(@)'
# create_element()
# Instantiate and return an element
......@@ -402,6 +415,8 @@ class Project():
"Project requested format version {}, but BuildStream {}.{} only supports up until format version {}"
.format(format_version, major, minor, BST_FORMAT_VERSION))
# Performing this check manually in the absense
......@@ -467,16 +482,7 @@ class Project():
self._load_pass(config, self.config)
_yaml.node_validate(config, [
'element-path', 'variables',
'environment', 'environment-nocache',
'split-rules', 'elements', 'plugins',
'aliases', 'name',
'artifacts', 'options',
'fail-on-overlap', 'shell', 'fatal-warnings',
'ref-storage', 'sandbox', 'mirrors', 'remote-execution'
# Now all YAML composition is done, from here on we just load
# Project config for frontend build test
name: test
elephant-path: elements
......@@ -36,6 +36,19 @@ def test_show(cli, datafiles, target, format, expected):
.format(expected, result.output))
def test_show_invalid_element_path(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename)
result =, silent=True, args=[
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
@pytest.mark.parametrize("target,except_,expected", [
('target.bst', 'import-bin.bst', ['import-dev.bst', 'compose-all.bst', 'target.bst']),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment