summaryrefslogtreecommitdiff
path: root/tests/frontend/logging
diff options
context:
space:
mode:
Diffstat (limited to 'tests/frontend/logging')
-rw-r--r--tests/frontend/logging/elements/bar.bst4
-rw-r--r--tests/frontend/logging/elements/foo.bst4
-rw-r--r--tests/frontend/logging/elements/logtest.bst5
-rw-r--r--tests/frontend/logging/files/bar0
-rw-r--r--tests/frontend/logging/files/foo0
-rw-r--r--tests/frontend/logging/plugins/logtest.py44
-rw-r--r--tests/frontend/logging/project.conf10
7 files changed, 67 insertions, 0 deletions
diff --git a/tests/frontend/logging/elements/bar.bst b/tests/frontend/logging/elements/bar.bst
new file mode 100644
index 000000000..db6f66526
--- /dev/null
+++ b/tests/frontend/logging/elements/bar.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: files/bar
diff --git a/tests/frontend/logging/elements/foo.bst b/tests/frontend/logging/elements/foo.bst
new file mode 100644
index 000000000..487b8e2a5
--- /dev/null
+++ b/tests/frontend/logging/elements/foo.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: files/foo
diff --git a/tests/frontend/logging/elements/logtest.bst b/tests/frontend/logging/elements/logtest.bst
new file mode 100644
index 000000000..cbfbaf86f
--- /dev/null
+++ b/tests/frontend/logging/elements/logtest.bst
@@ -0,0 +1,5 @@
+kind: logtest
+
+depends:
+- foo.bst
+- bar.bst
diff --git a/tests/frontend/logging/files/bar b/tests/frontend/logging/files/bar
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/logging/files/bar
diff --git a/tests/frontend/logging/files/foo b/tests/frontend/logging/files/foo
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/tests/frontend/logging/files/foo
diff --git a/tests/frontend/logging/plugins/logtest.py b/tests/frontend/logging/plugins/logtest.py
new file mode 100644
index 000000000..0817a92d8
--- /dev/null
+++ b/tests/frontend/logging/plugins/logtest.py
@@ -0,0 +1,44 @@
+from buildstream import Element
+
+
+class LogTest(Element):
+ BST_MIN_VERSION = "2.0"
+
+ def configure(self, node):
+ pass
+
+ def preflight(self):
+ pass
+
+ def get_unique_key(self):
+ return {}
+
+ def configure_sandbox(self, sandbox):
+ pass
+
+ def stage(self, sandbox):
+ # Here we stage the artifacts of dependencies individually without
+ # using a timed activity or suppressing the logging.
+ #
+ # This allows us to test the logging behavior when log lines are
+ # triggered by an element which is not the element being processed.
+ #
+ # * The master build log should show the element name and cache key
+ # of the task element, i.e. the element currently being built, not
+ # the element issuing the message.
+ #
+ # * In the individual task log, we expect to see the name and cache
+ # key of the element issuing messages, since the entire log file
+ # is contextual to the task, it makes more sense to provide the
+ # full context of the element issuing the log in this case.
+ #
+ for dep in self.dependencies():
+ dep.stage_artifact(sandbox)
+
+ def assemble(self, sandbox):
+ return "/"
+
+
+# Plugin entry point
+def setup():
+ return LogTest
diff --git a/tests/frontend/logging/project.conf b/tests/frontend/logging/project.conf
new file mode 100644
index 000000000..151b0cd1a
--- /dev/null
+++ b/tests/frontend/logging/project.conf
@@ -0,0 +1,10 @@
+# Project config for frontend build test
+name: test
+min-version: 2.0
+element-path: elements
+
+plugins:
+- origin: local
+ path: plugins
+ elements:
+ - logtest