This is an automated email from the ASF dual-hosted git repository. juergbi pushed a commit to branch jbilleter/loader in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 9f0c6dace105b51c2470baa6ade863c541ab0bf5 Author: Harry Sarson <[email protected]> AuthorDate: Wed Aug 13 15:43:11 2025 +0100 tests/format/junctions.py: Test include from nested junction This creates a variant of the include-complex test project where the subproject is moved into a new intermediate project and the subproject.bst junction element is replaced by a link element. Including a file from a nested junction via a link element in the top level project.conf file tests more code paths in the loader. This change shows a bug in the loader, running `bst show --deps none target.bst` in the `tests/format/junctions/include-complex-nested` directory gives the following output: ``` 20:02:32 --:--:-- main:core activity START Loading elements 20:02:32 00:00:00 main:core activity FAILURE Loading elements intermediate-project.bst:project.conf [line 5 column 2]: Circular reference while searching for 'subproject.bst' Already searching for 'subproject.bst' at: subproject.bst [line 4 column 10] ``` --- tests/format/junctions.py | 36 ++++++++++++++++++++++ .../alternative-placeholder.bst | 1 + .../intermediate-project.bst | 12 ++++++++ .../intermediate-project/project.conf | 15 +++++++++ .../intermediate-project/subproject.bst | 9 ++++++ .../intermediate-project/subproject/include.yml | 8 +++++ .../subproject/placeholder.bst | 1 + .../intermediate-project/subproject/project.conf | 12 ++++++++ .../intermediate-project/subproject/target.bst | 4 +++ .../junctions/include-complex-nested/project.conf | 15 +++++++++ .../include-complex-nested/subproject.bst | 4 +++ .../junctions/include-complex-nested/target.bst | 4 +++ 12 files changed, 121 insertions(+) diff --git a/tests/format/junctions.py b/tests/format/junctions.py index 2aaaaede3..dda59afea 100644 --- a/tests/format/junctions.py +++ b/tests/format/junctions.py @@ -981,3 +981,39 @@ def test_include_vars_cross_junction_element(cli, datafiles, target, animal, exp result.assert_success() result_vars = _yaml.load_data(result.output) assert result_vars.get_str("target_animal_variable") == expected_result + + [email protected](DATA_DIR) [email protected]( + "target", + ["target.bst", "subproject.bst:target.bst", "intermediate-project.bst:subproject.bst:target.bst"], + ids=["toplevel-target", "subproject-target", "nested-link-target"], +) [email protected]( + "animal,expected_result", + [ + ("pony", "target pony"), + ("horsy", "target horsy"), + ], + ids=["branch1", "branch2"], +) +def test_include_vars_cross_junction_element_nested(cli, datafiles, target, animal, expected_result): + project = os.path.join(str(datafiles), "include-complex-nested") + result = cli.run( + project=project, + silent=True, + args=[ + "--option", + "animal", + animal, + "show", + "--deps", + "none", + "--format", + "%{vars}", + target, + ], + ) + result.assert_success() + result_vars = _yaml.load_data(result.output) + assert result_vars.get_str("target_animal_variable") == expected_result diff --git a/tests/format/junctions/include-complex-nested/alternative-placeholder.bst b/tests/format/junctions/include-complex-nested/alternative-placeholder.bst new file mode 100644 index 000000000..066a03328 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/alternative-placeholder.bst @@ -0,0 +1 @@ +kind: stack diff --git a/tests/format/junctions/include-complex-nested/intermediate-project.bst b/tests/format/junctions/include-complex-nested/intermediate-project.bst new file mode 100644 index 000000000..25d9930f5 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project.bst @@ -0,0 +1,12 @@ +kind: junction + +sources: +- kind: local + path: intermediate-project + +config: + overrides: + subproject.bst:placeholder.bst: alternative-placeholder.bst + + options: + animal: '%{animal}' diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/project.conf b/tests/format/junctions/include-complex-nested/intermediate-project/project.conf new file mode 100644 index 000000000..9a00c9e7f --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/project.conf @@ -0,0 +1,15 @@ +name: intermediate-project +min-version: 2.0 + +(@): +- subproject.bst:include.yml + +options: + animal: + type: enum + description: the animal + values: + - pony + - horsy + default: pony + variable: animal diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/subproject.bst b/tests/format/junctions/include-complex-nested/intermediate-project/subproject.bst new file mode 100644 index 000000000..4d1041390 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/subproject.bst @@ -0,0 +1,9 @@ +kind: junction +sources: +- kind: local + path: subproject + +config: + + options: + target_animal: '%{animal}' diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/subproject/include.yml b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/include.yml new file mode 100644 index 000000000..e47d22f8c --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/include.yml @@ -0,0 +1,8 @@ + +variables: + target_animal_variable: "no target animal" + (?): + - target_animal == "pony": + target_animal_variable: "target pony" + - target_animal == "horsy": + target_animal_variable: "target horsy" diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/subproject/placeholder.bst b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/placeholder.bst new file mode 100644 index 000000000..066a03328 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/placeholder.bst @@ -0,0 +1 @@ +kind: stack diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/subproject/project.conf b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/project.conf new file mode 100644 index 000000000..700da1a30 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/project.conf @@ -0,0 +1,12 @@ +name: subtest +min-version: 2.0 + +options: + target_animal: + type: enum + description: the target animal + values: + - pony + - horsy + default: pony + variable: target_animal diff --git a/tests/format/junctions/include-complex-nested/intermediate-project/subproject/target.bst b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/target.bst new file mode 100644 index 000000000..9349a1854 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/intermediate-project/subproject/target.bst @@ -0,0 +1,4 @@ +kind: stack + +(@): +- include.yml diff --git a/tests/format/junctions/include-complex-nested/project.conf b/tests/format/junctions/include-complex-nested/project.conf new file mode 100644 index 000000000..eb7f3c746 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/project.conf @@ -0,0 +1,15 @@ +name: test +min-version: 2.0 + +(@): +- subproject.bst:include.yml + +options: + animal: + type: enum + description: the animal + values: + - pony + - horsy + default: pony + variable: animal diff --git a/tests/format/junctions/include-complex-nested/subproject.bst b/tests/format/junctions/include-complex-nested/subproject.bst new file mode 100644 index 000000000..191cd8051 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/subproject.bst @@ -0,0 +1,4 @@ +kind: link + +config: + target: intermediate-project.bst:subproject.bst diff --git a/tests/format/junctions/include-complex-nested/target.bst b/tests/format/junctions/include-complex-nested/target.bst new file mode 100644 index 000000000..7cb4b6c32 --- /dev/null +++ b/tests/format/junctions/include-complex-nested/target.bst @@ -0,0 +1,4 @@ +kind: manual + +depends: +- subproject.bst:target.bst
