summaryrefslogtreecommitdiff
path: root/tests/frontend
diff options
context:
space:
mode:
authorJosh Smith <joshsmith@codethink.co.uk>2018-08-03 11:32:29 +0100
committerJosh Smith <qinusty@gmail.com>2018-08-15 12:15:58 +0100
commitf3d58233793cf0249cbac51f72d5c459eb256d44 (patch)
tree1ac54367e79ac7ac3e53f5e66484d05e916b7237 /tests/frontend
parent9f675c640d47e844712cb8917018fda163d5e070 (diff)
downloadbuildstream-f3d58233793cf0249cbac51f72d5c459eb256d44.tar.gz
_project.py: Add fatal-warnings configuration item
This allows for users to configure fatal-warnings to be either a list of warnings. This commit deprecates the use of fail-on-overlap within project.conf, this will now use the fatal-warnings configuration item. element.py: Cache key calculation now takes into account all of the fatal-warnings tests: This modifys the tests/frontend/overlaps.py tests to support the new fatal-warnings configuration. Backwards compatibility is also tested for `fail-on-overlap` _versions.py: BST_FORMAT_VERSION bumped to 15 for fatal-warnings BST_CORE_ARTIFACT_VERSION bumpted to 5 for fatal-warnings Fixes: #526
Diffstat (limited to 'tests/frontend')
-rw-r--r--tests/frontend/overlaps.py27
1 files changed, 17 insertions, 10 deletions
diff --git a/tests/frontend/overlaps.py b/tests/frontend/overlaps.py
index 36e15acd7..27be8deac 100644
--- a/tests/frontend/overlaps.py
+++ b/tests/frontend/overlaps.py
@@ -3,6 +3,7 @@ import pytest
from tests.testutils.runcli import cli
from buildstream._exceptions import ErrorDomain
from buildstream import _yaml
+from buildstream.plugin import CoreWarnings
# Project directory
DATA_DIR = os.path.join(
@@ -16,30 +17,35 @@ project_template = {
}
-def gen_project(project_dir, fail_on_overlap):
+def gen_project(project_dir, fail_on_overlap, use_fatal_warnings=True):
template = dict(project_template)
- template["fail-on-overlap"] = fail_on_overlap
+ if use_fatal_warnings:
+ template["fatal-warnings"] = [CoreWarnings.OVERLAPS] if fail_on_overlap else []
+ else:
+ template["fail-on-overlap"] = fail_on_overlap
projectfile = os.path.join(project_dir, "project.conf")
_yaml.dump(template, projectfile)
@pytest.mark.datafiles(DATA_DIR)
-def test_overlaps(cli, datafiles):
+@pytest.mark.parametrize("use_fatal_warnings", [True, False])
+def test_overlaps(cli, datafiles, use_fatal_warnings):
project_dir = str(datafiles)
- gen_project(project_dir, False)
+ gen_project(project_dir, False, use_fatal_warnings)
result = cli.run(project=project_dir, silent=True, args=[
'build', 'collect.bst'])
result.assert_success()
@pytest.mark.datafiles(DATA_DIR)
-def test_overlaps_error(cli, datafiles):
+@pytest.mark.parametrize("use_fatal_warnings", [True, False])
+def test_overlaps_error(cli, datafiles, use_fatal_warnings):
project_dir = str(datafiles)
- gen_project(project_dir, True)
+ gen_project(project_dir, True, use_fatal_warnings)
result = cli.run(project=project_dir, silent=True, args=[
'build', 'collect.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
- result.assert_task_error(ErrorDomain.ELEMENT, "overlap-error")
+ result.assert_task_error(ErrorDomain.PLUGIN, CoreWarnings.OVERLAPS)
@pytest.mark.datafiles(DATA_DIR)
@@ -70,15 +76,16 @@ def test_overlaps_whitelist_on_overlapper(cli, datafiles):
result = cli.run(project=project_dir, silent=True, args=[
'build', 'collect-partially-whitelisted.bst'])
result.assert_main_error(ErrorDomain.STREAM, None)
- result.assert_task_error(ErrorDomain.ELEMENT, "overlap-error")
+ result.assert_task_error(ErrorDomain.PLUGIN, CoreWarnings.OVERLAPS)
@pytest.mark.datafiles(DATA_DIR)
-def test_overlaps_script(cli, datafiles):
+@pytest.mark.parametrize("use_fatal_warnings", [True, False])
+def test_overlaps_script(cli, datafiles, use_fatal_warnings):
# Test overlaps with script element to test
# Element.stage_dependency_artifacts() with Scope.RUN
project_dir = str(datafiles)
- gen_project(project_dir, False)
+ gen_project(project_dir, False, use_fatal_warnings)
result = cli.run(project=project_dir, silent=True, args=[
'build', 'script.bst'])
result.assert_success()