diff options
author | Josh Smith <qinusty@gmail.com> | 2018-08-29 11:54:47 +0100 |
---|---|---|
committer | Qinusty <jrsmith9822@gmail.com> | 2018-08-29 16:34:22 +0000 |
commit | d41c42d6c53884c63046a1b7df14f5ab87566551 (patch) | |
tree | 1ede0c03cee2b124a02de4acb4b271422613e41c /tests/format | |
parent | 3c8646e368ec50fcfc98bac8f99515249f7b6700 (diff) | |
download | buildstream-d41c42d6c53884c63046a1b7df14f5ab87566551.tar.gz |
Add tests for cyclic variables check
Note: This modifies the docker containers used for testing to supply the
pytest-timeout package.
Diffstat (limited to 'tests/format')
-rw-r--r-- | tests/format/variables.py | 18 | ||||
-rw-r--r-- | tests/format/variables/cyclic_variables/cyclic.bst | 5 | ||||
-rw-r--r-- | tests/format/variables/cyclic_variables/project.conf | 1 |
3 files changed, 24 insertions, 0 deletions
diff --git a/tests/format/variables.py b/tests/format/variables.py index d570bf01d..d01d87e5b 100644 --- a/tests/format/variables.py +++ b/tests/format/variables.py @@ -1,5 +1,6 @@ import os import pytest +import sys from buildstream import _yaml from buildstream._exceptions import ErrorDomain, LoadErrorReason from tests.testutils.runcli import cli @@ -72,3 +73,20 @@ def test_missing_variable(cli, datafiles, tmpdir): ]) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.UNRESOLVED_VARIABLE) + + +@pytest.mark.timeout(3, method="signal") +@pytest.mark.datafiles(os.path.join(DATA_DIR, 'cyclic_variables')) +def test_cyclic_variables(cli, datafiles): + print_warning("Performing cyclic test, if this test times out it will " + + "exit the test sequence") + project = os.path.join(datafiles.dirname, datafiles.basename) + result = cli.run(project=project, silent=True, args=[ + "build", "cyclic.bst" + ]) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.RECURSIVE_VARIABLE) + + +def print_warning(msg): + RED, END = "\033[91m", "\033[0m" + print(("\n{}{}{}").format(RED, msg, END), file=sys.stderr) diff --git a/tests/format/variables/cyclic_variables/cyclic.bst b/tests/format/variables/cyclic_variables/cyclic.bst new file mode 100644 index 000000000..a05a40b27 --- /dev/null +++ b/tests/format/variables/cyclic_variables/cyclic.bst @@ -0,0 +1,5 @@ +kind: manual + +variables: + a: "%{prefix}/a" + prefix: "%{a}/some_prefix/"
\ No newline at end of file diff --git a/tests/format/variables/cyclic_variables/project.conf b/tests/format/variables/cyclic_variables/project.conf new file mode 100644 index 000000000..b32753625 --- /dev/null +++ b/tests/format/variables/cyclic_variables/project.conf @@ -0,0 +1 @@ +name: test |