diff options
author | Chandan Singh <chandan@chandansingh.net> | 2020-05-14 18:45:53 +0000 |
---|---|---|
committer | bst-marge-bot <marge-bot@buildstream.build> | 2020-05-18 09:45:43 +0000 |
commit | b8b40314740c118398641a3b86655a8b0434631d (patch) | |
tree | d19365ab5f2359ad3b34c3b958b82a1e0ffefc9b /tests/frontend | |
parent | 4819011147ab67462d9e378938a9139b479d5fe7 (diff) | |
download | buildstream-b8b40314740c118398641a3b86655a8b0434631d.tar.gz |
Ensure there are no duplicates in Elements.dependencies()
When we are not recursing, `Element.dependencies()` uses a much more
light weight codepath since it just needs to print the direct
dependencies. However, this simple codepath was not accounting for
duplicates, in case something is both a build time and run time
dependency.
One way this manifested itself was in `bst show --format %{deps}`, but
it would also affect anything that was using this method to iterate on
the dependencies.
Fixes #1308.
Diffstat (limited to 'tests/frontend')
-rw-r--r-- | tests/frontend/project/elements/format-deps.bst | 17 | ||||
-rw-r--r-- | tests/frontend/show.py | 8 |
2 files changed, 21 insertions, 4 deletions
diff --git a/tests/frontend/project/elements/format-deps.bst b/tests/frontend/project/elements/format-deps.bst new file mode 100644 index 000000000..58a46891b --- /dev/null +++ b/tests/frontend/project/elements/format-deps.bst @@ -0,0 +1,17 @@ +kind: import + +description: > + It is important that this element has both and build and runtime dependencies. + It is also important that it has a dependency that is needed at both build + time and runtime. + +sources: +- kind: local + path: files/etc-files + +depends: +- import-links.bst +build-depends: +- import-dev.bst +runtime-depends: +- import-bin.bst diff --git a/tests/frontend/show.py b/tests/frontend/show.py index 17931ffe3..4be4b72e9 100644 --- a/tests/frontend/show.py +++ b/tests/frontend/show.py @@ -399,14 +399,14 @@ def test_exceed_max_recursion_depth(cli, tmpdir, dependency_depth): @pytest.mark.parametrize( "dep_kind, expected_deps", [ - ("%{deps}", "[import-dev.bst, import-bin.bst]"), - ("%{build-deps}", "[import-dev.bst]"), - ("%{runtime-deps}", "[import-bin.bst]"), + ("%{deps}", "[import-dev.bst, import-links.bst, import-bin.bst]"), + ("%{build-deps}", "[import-dev.bst, import-links.bst]"), + ("%{runtime-deps}", "[import-links.bst, import-bin.bst]"), ], ) def test_format_deps(cli, datafiles, dep_kind, expected_deps): project = str(datafiles) - target = "checkout-deps.bst" + target = "format-deps.bst" result = cli.run( project=project, silent=True, args=["show", "--deps", "none", "--format", "%{name}: " + dep_kind, target] ) |