summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2020-04-28 19:23:31 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2020-04-29 16:24:59 +0900
commita311a14f4b0a649b5f872ab020885b0a1d6e09d1 (patch)
treec94ddb9ff24108b72d4e0c2e8902bf24d6702b95 /tests
parentb3556a3284708b904f20586d4636c31a91106809 (diff)
downloadbuildstream-a311a14f4b0a649b5f872ab020885b0a1d6e09d1.tar.gz
plugin.py/pluginfactory.py: Implementing BST_MIN_VERSION
The BST_MIN_VERSION guards assert that the BuildStream core which loaded the plugin is compatible with the plugin itself. This commit adds BST_MIN_VERSION to the base plugin.py with documentation informing Plugin authors how to set the minimum version, and also adds the assertions at plugin loading time in pluginfactory.py. This commit also: * Adds the BST_MIN_VERSION specification to all current core plugins * Adds the BST_MIN_VERSION specification to plugins used in test cases
Diffstat (limited to 'tests')
-rw-r--r--tests/elements/filter/basic/element_plugins/dynamic.py3
-rw-r--r--tests/format/project/plugin-allowed/plugins/foo.py3
-rw-r--r--tests/format/project/plugin-forbidden/forbidden-plugins/forbidden-plugin.py3
-rw-r--r--tests/format/project/plugin-no-load-ref/plugins/noloadref.py3
-rw-r--r--tests/format/project/plugin-preflight-error/errorplugin/preflighterror.py3
-rw-r--r--tests/frontend/configuredwarning/plugins/corewarn.py3
-rw-r--r--tests/frontend/configuredwarning/plugins/warninga.py3
-rw-r--r--tests/frontend/configuredwarning/plugins/warningb.py3
-rw-r--r--tests/frontend/consistencyerror/plugins/consistencybug.py3
-rw-r--r--tests/frontend/consistencyerror/plugins/consistencyerror.py3
-rw-r--r--tests/frontend/project/plugins/randomelement.py3
-rw-r--r--tests/frontend/project/sources/fetch_source.py3
-rw-r--r--tests/internals/pluginloading/customelement/pluginelements/foo.py3
-rw-r--r--tests/internals/pluginloading/customsource/pluginsources/foo.py3
-rw-r--r--tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py1
-rw-r--r--tests/sourcecache/project/plugins/elements/always_fail.py3
-rw-r--r--tests/sources/no-fetch-cached/plugins/sources/always_cached.py2
-rw-r--r--tests/sources/previous_source_access/plugins/sources/foo_transform.py1
-rw-r--r--tests/sources/project_key_test/plugins/sources/key-test.py2
19 files changed, 51 insertions, 0 deletions
diff --git a/tests/elements/filter/basic/element_plugins/dynamic.py b/tests/elements/filter/basic/element_plugins/dynamic.py
index bf079111f..db92a6647 100644
--- a/tests/elements/filter/basic/element_plugins/dynamic.py
+++ b/tests/elements/filter/basic/element_plugins/dynamic.py
@@ -3,6 +3,9 @@ from buildstream import Element, Scope
# Copies files from the dependent element but inserts split-rules using dynamic data
class DynamicElement(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
node.validate_keys(["split-rules"])
self.split_rules = {key: value.as_str_list() for key, value in node.get_mapping("split-rules").items()}
diff --git a/tests/format/project/plugin-allowed/plugins/foo.py b/tests/format/project/plugin-allowed/plugins/foo.py
index bf884233c..76d9bfd3c 100644
--- a/tests/format/project/plugin-allowed/plugins/foo.py
+++ b/tests/format/project/plugin-allowed/plugins/foo.py
@@ -2,6 +2,9 @@ from buildstream import Element
class FooElement(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, config):
pass
diff --git a/tests/format/project/plugin-forbidden/forbidden-plugins/forbidden-plugin.py b/tests/format/project/plugin-forbidden/forbidden-plugins/forbidden-plugin.py
index bf884233c..76d9bfd3c 100644
--- a/tests/format/project/plugin-forbidden/forbidden-plugins/forbidden-plugin.py
+++ b/tests/format/project/plugin-forbidden/forbidden-plugins/forbidden-plugin.py
@@ -2,6 +2,9 @@ from buildstream import Element
class FooElement(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, config):
pass
diff --git a/tests/format/project/plugin-no-load-ref/plugins/noloadref.py b/tests/format/project/plugin-no-load-ref/plugins/noloadref.py
index e2fe0ac46..2b8fd0b51 100644
--- a/tests/format/project/plugin-no-load-ref/plugins/noloadref.py
+++ b/tests/format/project/plugin-no-load-ref/plugins/noloadref.py
@@ -6,6 +6,9 @@ from buildstream import Source
# Use this to test that the core behaves as expected with such plugins.
#
class NoLoadRefSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/format/project/plugin-preflight-error/errorplugin/preflighterror.py b/tests/format/project/plugin-preflight-error/errorplugin/preflighterror.py
index db2895f8b..a03cb64ee 100644
--- a/tests/format/project/plugin-preflight-error/errorplugin/preflighterror.py
+++ b/tests/format/project/plugin-preflight-error/errorplugin/preflighterror.py
@@ -2,6 +2,9 @@ from buildstream import Source, SourceError
class PreflightErrorSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/configuredwarning/plugins/corewarn.py b/tests/frontend/configuredwarning/plugins/corewarn.py
index bef0a4904..bcd40753c 100644
--- a/tests/frontend/configuredwarning/plugins/corewarn.py
+++ b/tests/frontend/configuredwarning/plugins/corewarn.py
@@ -3,6 +3,9 @@ from buildstream.plugin import CoreWarnings
class CoreWarn(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/configuredwarning/plugins/warninga.py b/tests/frontend/configuredwarning/plugins/warninga.py
index 9fd8dc61b..4ad0f3d20 100644
--- a/tests/frontend/configuredwarning/plugins/warninga.py
+++ b/tests/frontend/configuredwarning/plugins/warninga.py
@@ -4,6 +4,9 @@ WARNING_A = "warning-a"
class WarningA(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/configuredwarning/plugins/warningb.py b/tests/frontend/configuredwarning/plugins/warningb.py
index 64d25ef39..c7a995cf8 100644
--- a/tests/frontend/configuredwarning/plugins/warningb.py
+++ b/tests/frontend/configuredwarning/plugins/warningb.py
@@ -4,6 +4,9 @@ WARNING_B = "warning-b"
class WarningB(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/consistencyerror/plugins/consistencybug.py b/tests/frontend/consistencyerror/plugins/consistencybug.py
index abcbbc997..1952894ca 100644
--- a/tests/frontend/consistencyerror/plugins/consistencybug.py
+++ b/tests/frontend/consistencyerror/plugins/consistencybug.py
@@ -2,6 +2,9 @@ from buildstream import Source
class ConsistencyBugSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/consistencyerror/plugins/consistencyerror.py b/tests/frontend/consistencyerror/plugins/consistencyerror.py
index 2e30d4842..34af45782 100644
--- a/tests/frontend/consistencyerror/plugins/consistencyerror.py
+++ b/tests/frontend/consistencyerror/plugins/consistencyerror.py
@@ -2,6 +2,9 @@ from buildstream import Source, SourceError
class ConsistencyErrorSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/project/plugins/randomelement.py b/tests/frontend/project/plugins/randomelement.py
index e9be98fc7..12afaaa6d 100644
--- a/tests/frontend/project/plugins/randomelement.py
+++ b/tests/frontend/project/plugins/randomelement.py
@@ -4,6 +4,9 @@ from buildstream import Element
class RandomElement(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/frontend/project/sources/fetch_source.py b/tests/frontend/project/sources/fetch_source.py
index c62d1d29a..6078e5e5f 100644
--- a/tests/frontend/project/sources/fetch_source.py
+++ b/tests/frontend/project/sources/fetch_source.py
@@ -32,6 +32,9 @@ class FetchFetcher(SourceFetcher):
class FetchSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
# Read config to know which URLs to fetch
def configure(self, node):
self.original_urls = node.get_str_list("urls")
diff --git a/tests/internals/pluginloading/customelement/pluginelements/foo.py b/tests/internals/pluginloading/customelement/pluginelements/foo.py
index c6a85a5b1..bdb6c8982 100644
--- a/tests/internals/pluginloading/customelement/pluginelements/foo.py
+++ b/tests/internals/pluginloading/customelement/pluginelements/foo.py
@@ -2,6 +2,9 @@ from buildstream import Element
class FooElement(Element):
+
+ BST_MIN_VERSION = "2.0"
+
def preflight(self):
pass
diff --git a/tests/internals/pluginloading/customsource/pluginsources/foo.py b/tests/internals/pluginloading/customsource/pluginsources/foo.py
index fce5239b1..c5229f3e2 100644
--- a/tests/internals/pluginloading/customsource/pluginsources/foo.py
+++ b/tests/internals/pluginloading/customsource/pluginsources/foo.py
@@ -2,6 +2,9 @@ from buildstream import Source
class FooSource(Source):
+
+ BST_MIN_VERSION = "2.0"
+
def preflight(self):
pass
diff --git a/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py
index 1badf59af..244009764 100644
--- a/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py
+++ b/tests/plugins/deprecationwarnings/plugins/elements/deprecated_plugin.py
@@ -2,6 +2,7 @@ from buildstream import BuildElement
class DeprecatedPlugin(BuildElement):
+ BST_MIN_VERSION = "2.0"
BST_PLUGIN_DEPRECATED = True
BST_PLUGIN_DEPRECATION_MESSAGE = "Here is some detail."
diff --git a/tests/sourcecache/project/plugins/elements/always_fail.py b/tests/sourcecache/project/plugins/elements/always_fail.py
index 43dba5626..bc3ed57b6 100644
--- a/tests/sourcecache/project/plugins/elements/always_fail.py
+++ b/tests/sourcecache/project/plugins/elements/always_fail.py
@@ -23,6 +23,9 @@ from buildstream.buildelement import BuildElement
class AlwaysFail(BuildElement):
+
+ BST_MIN_VERSION = "2.0"
+
def assemble(self, sandbox):
raise ElementError("Always fails")
diff --git a/tests/sources/no-fetch-cached/plugins/sources/always_cached.py b/tests/sources/no-fetch-cached/plugins/sources/always_cached.py
index aef13279b..b5dfd772c 100644
--- a/tests/sources/no-fetch-cached/plugins/sources/always_cached.py
+++ b/tests/sources/no-fetch-cached/plugins/sources/always_cached.py
@@ -11,6 +11,8 @@ from buildstream import Source
class AlwaysCachedSource(Source):
+ BST_MIN_VERSION = "2.0"
+
def configure(self, node):
pass
diff --git a/tests/sources/previous_source_access/plugins/sources/foo_transform.py b/tests/sources/previous_source_access/plugins/sources/foo_transform.py
index dbc44c8aa..15fef43f8 100644
--- a/tests/sources/previous_source_access/plugins/sources/foo_transform.py
+++ b/tests/sources/previous_source_access/plugins/sources/foo_transform.py
@@ -14,6 +14,7 @@ from buildstream import Source, SourceError, utils
class FooTransformSource(Source):
+ BST_MIN_VERSION = "2.0"
# We need access to previous both at track time and fetch time
BST_REQUIRES_PREVIOUS_SOURCES_TRACK = True
diff --git a/tests/sources/project_key_test/plugins/sources/key-test.py b/tests/sources/project_key_test/plugins/sources/key-test.py
index 88a211738..046034804 100644
--- a/tests/sources/project_key_test/plugins/sources/key-test.py
+++ b/tests/sources/project_key_test/plugins/sources/key-test.py
@@ -7,6 +7,8 @@ class KeyTest(Source):
""" This plugin should fail if get_unique_key is called before track
"""
+ BST_MIN_VERSION = "2.0"
+
def preflight(self):
pass