diff options
author | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-07-20 16:56:39 +0900 |
---|---|---|
committer | Tristan van Berkom <tristan.vanberkom@codethink.co.uk> | 2020-07-22 18:37:33 +0900 |
commit | d053a61b30013164fb9c9de78a58fa6c2fb4b81f (patch) | |
tree | 2588a58a3b3bf7f08519bd48cc4f75bcbd1a5f95 /tests | |
parent | 64d257e6e34382f4e90b834a05da36f31e1167f9 (diff) | |
download | buildstream-d053a61b30013164fb9c9de78a58fa6c2fb4b81f.tar.gz |
_variables.pyx: Rewrite Variables code.
Main enhancements here include:
* Support for deeply nested variable declarations, removing the
limitations of the recursive variable resolution algorithm.
We were unable to achieve equal performance with the iterative
resolution algorithm, so we now have the recursive approach as
the fast path and only support 200 recursions with this approach
before falling back on the iterative code path, which will support
deep variable resolution and take care of error reporting.
* Better error reporting for undefined variables.
Variables.subst() now requires a ScalarNode and not a simple `str`,
making it more difficult for the core to substitute an undefined
variable without providing the provenance of where that value
expression was declared.
Code changes:
* _variables.pyx: Complete rewrite
* exceptions.py: Added new LoadErrorReason.CIRCULAR_REFERENCE_VARIABLE
* element.py: Pass ScalarNode to Variable.subst() when substituting overlap
whitelists.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/format/variables.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/format/variables.py b/tests/format/variables.py index c5e8eebad..242c97acc 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -67,7 +67,7 @@ def test_simple_cyclic_variables(cli, datafiles): print_warning("Performing cyclic test, if this test times out it will " + "exit the test sequence") project = str(datafiles) result = cli.run(project=project, silent=True, args=["build", "simple-cyclic.bst"]) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.RECURSIVE_VARIABLE) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CIRCULAR_REFERENCE_VARIABLE) @pytest.mark.timeout(15, method="signal") @@ -76,7 +76,7 @@ def test_cyclic_variables(cli, datafiles): print_warning("Performing cyclic test, if this test times out it will " + "exit the test sequence") project = str(datafiles) result = cli.run(project=project, silent=True, args=["build", "cyclic.bst"]) - result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.RECURSIVE_VARIABLE) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CIRCULAR_REFERENCE_VARIABLE) @pytest.mark.parametrize("protected_var", PROTECTED_VARIABLES) |