diff options
Diffstat (limited to 'tests/frontend/overlaps')
-rw-r--r-- | tests/frontend/overlaps/multistage-overlap-error.bst | 12 | ||||
-rw-r--r-- | tests/frontend/overlaps/multistage-overlap-ignore.bst | 12 | ||||
-rw-r--r-- | tests/frontend/overlaps/multistage-overlap.bst | 12 | ||||
-rw-r--r-- | tests/frontend/overlaps/plugins/overlap.py | 56 | ||||
-rw-r--r-- | tests/frontend/overlaps/relocated-unstaged.bst | 9 | ||||
-rw-r--r-- | tests/frontend/overlaps/relocated.bst | 15 | ||||
-rw-r--r-- | tests/frontend/overlaps/subdir-a.bst | 7 |
7 files changed, 123 insertions, 0 deletions
diff --git a/tests/frontend/overlaps/multistage-overlap-error.bst b/tests/frontend/overlaps/multistage-overlap-error.bst new file mode 100644 index 000000000..5b06c671b --- /dev/null +++ b/tests/frontend/overlaps/multistage-overlap-error.bst @@ -0,0 +1,12 @@ +kind: overlap + +build-depends: +- filename: subdir-a.bst + config: + location: / +- filename: c.bst + config: + location: /opt + +config: + action: error diff --git a/tests/frontend/overlaps/multistage-overlap-ignore.bst b/tests/frontend/overlaps/multistage-overlap-ignore.bst new file mode 100644 index 000000000..d40ae9a8f --- /dev/null +++ b/tests/frontend/overlaps/multistage-overlap-ignore.bst @@ -0,0 +1,12 @@ +kind: overlap + +build-depends: +- filename: subdir-a.bst + config: + location: / +- filename: c.bst + config: + location: /opt + +config: + action: ignore diff --git a/tests/frontend/overlaps/multistage-overlap.bst b/tests/frontend/overlaps/multistage-overlap.bst new file mode 100644 index 000000000..bf8984d5a --- /dev/null +++ b/tests/frontend/overlaps/multistage-overlap.bst @@ -0,0 +1,12 @@ +kind: overlap + +build-depends: +- filename: subdir-a.bst + config: + location: / +- filename: c.bst + config: + location: /opt + +config: + action: warning diff --git a/tests/frontend/overlaps/plugins/overlap.py b/tests/frontend/overlaps/plugins/overlap.py new file mode 100644 index 000000000..b1d8642a2 --- /dev/null +++ b/tests/frontend/overlaps/plugins/overlap.py @@ -0,0 +1,56 @@ +from buildstream import Element, OverlapAction + + +# A testing element to test the behavior of staging overlapping files +# +class OverlapElement(Element): + + BST_MIN_VERSION = "2.0" + + def configure(self, node): + node.validate_keys(["action"]) + self.overlap_action = node.get_enum("action", OverlapAction) + + def configure_dependencies(self, dependencies): + self.layout = {} + + for dep in dependencies: + location = "/" + if dep.config: + dep.config.validate_keys(["location"]) + location = dep.config.get_str("location") + try: + element_list = self.layout[location] + except KeyError: + element_list = [] + self.layout[location] = element_list + + element_list.append((dep.element, dep.path)) + + def preflight(self): + pass + + def get_unique_key(self): + sorted_locations = sorted(self.layout) + layout_key = { + location: [dependency_path for _, dependency_path in self.layout[location]] + for location in sorted_locations + } + return {"action": str(self.overlap_action), "layout": layout_key} + + def configure_sandbox(self, sandbox): + for location in self.layout: + sandbox.mark_directory(location, artifact=True) + + def stage(self, sandbox): + sorted_locations = sorted(self.layout) + for location in sorted_locations: + element_list = [element for element, _ in self.layout[location]] + self.stage_dependency_artifacts(sandbox, element_list, path=location, action=self.overlap_action) + + def assemble(self, sandbox): + return "/" + + +def setup(): + return OverlapElement diff --git a/tests/frontend/overlaps/relocated-unstaged.bst b/tests/frontend/overlaps/relocated-unstaged.bst new file mode 100644 index 000000000..65592a3dc --- /dev/null +++ b/tests/frontend/overlaps/relocated-unstaged.bst @@ -0,0 +1,9 @@ +kind: overlap + +build-depends: +- filename: directory-file.bst + config: + location: /opt + +config: + action: warning diff --git a/tests/frontend/overlaps/relocated.bst b/tests/frontend/overlaps/relocated.bst new file mode 100644 index 000000000..a7aea4f1f --- /dev/null +++ b/tests/frontend/overlaps/relocated.bst @@ -0,0 +1,15 @@ +kind: overlap + +build-depends: +- filename: a.bst + config: + location: /opt +- filename: b.bst + config: + location: /opt +- filename: c.bst + config: + location: /opt + +config: + action: warning diff --git a/tests/frontend/overlaps/subdir-a.bst b/tests/frontend/overlaps/subdir-a.bst new file mode 100644 index 000000000..b4da5b851 --- /dev/null +++ b/tests/frontend/overlaps/subdir-a.bst @@ -0,0 +1,7 @@ +kind: import +config: + source: / + target: /opt +sources: +- kind: local + path: "a" |