summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-07 17:52:58 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-19 17:22:31 +0900
commita4a9b5f24ccd1574744abf75c3c39068b72ba7bf (patch)
tree61462839720e8cdfe7788dace00ed4bb3303d73a
parented0275786967c0c55369b9604f613a39426c381f (diff)
downloadbuildstream-a4a9b5f24ccd1574744abf75c3c39068b72ba7bf.tar.gz
tests/format/junctions.py: Major refactor
This commit refactors the junctions test to use more parameterization and to remove copy_subproject(), using statically committed data as much as possible. This is because copy_subproject() causes data to be shared among tests in such a way that when such data get's modified, it easily causes unintended side effects on adjacent test cases, better to keep this data separate. Overview of changes: * Remove copy_subproject() * Split up test data into case specific directories, sometimes reusing a directory among various related tests * Use @pytest.mark.parameterize() as much as possible for better coverage and more clearly expressed test cases * Adds update_project() to modify a project.conf inline, as is done in some other tests like tests/plugins/loading.py * Removes tests related to junction name coalescing, this feature will be removed later in this branch and other tests related to junction overrides will replace these. * Removes some redundant tests * Removes a comment about how junction name coalescing can cause errors when trying to open a junction but the project.conf is missing. We continue to test missing project.conf files in a variety of scenarios, but the comment will be rendered irrelevant with the removal of junction name coalescing. * Change the git related tests to use tar instead, this serves the same purpose, but tar will remain a core plugin in BuildStream 2.
-rw-r--r--tests/format/junctions.py480
-rw-r--r--tests/format/junctions/bar/app.bst7
-rw-r--r--tests/format/junctions/bar/bar.txt1
-rw-r--r--tests/format/junctions/bar/target.bst5
-rw-r--r--tests/format/junctions/conflict/target.bst6
-rw-r--r--tests/format/junctions/foo/app.bst7
-rw-r--r--tests/format/junctions/foo/foo.txt1
-rw-r--r--tests/format/junctions/full-path/element-full-path-notfound.bst3
-rw-r--r--tests/format/junctions/full-path/element-full-path.bst3
-rw-r--r--tests/format/junctions/full-path/junction-full-path-notfound.bst4
-rw-r--r--tests/format/junctions/full-path/junction-full-path.bst4
-rw-r--r--tests/format/junctions/full-path/project.conf (renamed from tests/format/junctions/bar/project.conf)2
-rw-r--r--tests/format/junctions/full-path/subproject.bst (renamed from tests/format/junctions/conflict/foo.bst)2
-rw-r--r--tests/format/junctions/full-path/subproject/project.conf (renamed from tests/format/junctions/conflict/project.conf)2
-rw-r--r--tests/format/junctions/full-path/subproject/sub.txt1
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject.bst (renamed from tests/format/junctions/conflict/bar.bst)2
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/project.conf2
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/subsub.txt1
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject.bst4
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/project.conf2
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/subsubsub.txt1
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/target.bst4
-rw-r--r--tests/format/junctions/full-path/subproject/subsubproject/target.bst4
-rw-r--r--tests/format/junctions/full-path/subproject/target.bst (renamed from tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst)2
-rw-r--r--tests/format/junctions/inconsistent-names/elements/junction-A.bst4
-rw-r--r--tests/format/junctions/inconsistent-names/elements/junction-B-diff-name.bst4
-rw-r--r--tests/format/junctions/inconsistent-names/elements/target.bst9
-rw-r--r--tests/format/junctions/inconsistent-names/files/foo0
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/elements/app.bst6
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/elements/junction-B.bst4
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/elements/lib.bst7
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/files/app0
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/files/lib0
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/junctionB/base/baseimg0
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst6
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/junctionB/files/lib20
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/junctionB/project.conf8
-rw-r--r--tests/format/junctions/inconsistent-names/junctionA/project.conf8
-rw-r--r--tests/format/junctions/inconsistent-names/project.conf8
-rw-r--r--tests/format/junctions/invalid/base/base.txt (renamed from tests/format/junctions/base/base.txt)0
-rw-r--r--tests/format/junctions/invalid/base/project.conf (renamed from tests/format/junctions/base/project.conf)0
-rw-r--r--tests/format/junctions/invalid/base/target.bst (renamed from tests/format/junctions/base/target.bst)0
-rw-r--r--tests/format/junctions/invalid/missing-element.bst9
-rw-r--r--tests/format/junctions/missing-element/bad-junction.bst (renamed from tests/format/junctions/invalid/missing.bst)0
-rw-r--r--tests/format/junctions/nested/deeptarget.bst6
-rw-r--r--tests/format/junctions/nested/foo.bst4
-rw-r--r--tests/format/junctions/nested/project.conf2
-rw-r--r--tests/format/junctions/nested/subproject.bst (renamed from tests/format/junctions/foo/base.bst)2
-rw-r--r--tests/format/junctions/nested/subproject/project.conf2
-rw-r--r--tests/format/junctions/nested/subproject/sub.txt1
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/project.conf2
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subsub.txt1
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subsubsubproject.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/project.conf2
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/subsubsub.txt1
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/target.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/subtarget.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subsubproject/target.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subsubtarget.bst4
-rw-r--r--tests/format/junctions/nested/subproject/subtarget.bst4
-rw-r--r--tests/format/junctions/nested/subproject/target.bst4
-rw-r--r--tests/format/junctions/nested/target.bst5
-rw-r--r--tests/format/junctions/options-default/project.conf2
-rw-r--r--tests/format/junctions/options-inherit/project.conf11
-rw-r--r--tests/format/junctions/options/base-default.bst (renamed from tests/format/junctions/options-default/base.bst)0
-rw-r--r--tests/format/junctions/options/base-explicit.bst (renamed from tests/format/junctions/options/base.bst)0
-rw-r--r--tests/format/junctions/options/base-propagate.bst (renamed from tests/format/junctions/options-inherit/base.bst)0
-rw-r--r--tests/format/junctions/options/options-base/horsy.txt (renamed from tests/format/junctions/options-base/horsy.txt)0
-rw-r--r--tests/format/junctions/options/options-base/pony.txt (renamed from tests/format/junctions/options-base/pony.txt)0
-rw-r--r--tests/format/junctions/options/options-base/project.conf (renamed from tests/format/junctions/options-base/project.conf)0
-rw-r--r--tests/format/junctions/options/options-base/target.bst (renamed from tests/format/junctions/options-base/target.bst)0
-rw-r--r--tests/format/junctions/options/target-default.bst (renamed from tests/format/junctions/options-inherit/target.bst)2
-rw-r--r--tests/format/junctions/options/target-explicit.bst (renamed from tests/format/junctions/options/target.bst)2
-rw-r--r--tests/format/junctions/options/target-propagate.bst (renamed from tests/format/junctions/foo/target.bst)3
-rw-r--r--tests/format/junctions/simple/project.conf2
-rw-r--r--tests/format/junctions/simple/subproject.bst (renamed from tests/format/junctions/bar/base.bst)2
-rw-r--r--tests/format/junctions/simple/subproject/base.txt1
-rw-r--r--tests/format/junctions/simple/subproject/project.conf2
-rw-r--r--tests/format/junctions/simple/subproject/target.bst4
-rw-r--r--tests/format/junctions/simple/target.bst4
-rw-r--r--tests/format/junctions/toplevel/bar.bst4
-rw-r--r--tests/format/junctions/toplevel/base.bst4
-rw-r--r--tests/format/junctions/toplevel/element-full-path-notfound.bst3
-rw-r--r--tests/format/junctions/toplevel/element-full-path.bst3
-rw-r--r--tests/format/junctions/toplevel/foo.bst4
-rw-r--r--tests/format/junctions/toplevel/junction-full-path-notfound.bst4
-rw-r--r--tests/format/junctions/toplevel/junction-full-path.bst4
-rw-r--r--tests/format/junctions/toplevel/project.conf2
-rw-r--r--tests/format/junctions/toplevel/target.bst6
-rw-r--r--tests/format/junctions/use-repo/baserepo/base.txt1
-rw-r--r--tests/format/junctions/use-repo/baserepo/project.conf2
-rw-r--r--tests/format/junctions/use-repo/baserepo/target.bst4
-rw-r--r--tests/format/junctions/use-repo/project.conf (renamed from tests/format/junctions/foo/project.conf)0
-rw-r--r--tests/format/junctions/use-repo/target.bst (renamed from tests/format/junctions/options-default/target.bst)0
95 files changed, 305 insertions, 454 deletions
diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index b60d16816..0cdbc6183 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -2,7 +2,6 @@
# pylint: disable=redefined-outer-name
import os
-import shutil
import pytest
@@ -10,31 +9,35 @@ from buildstream import _yaml
from buildstream.exceptions import ErrorDomain, LoadErrorReason
from buildstream.testing import cli # pylint: disable=unused-import
from buildstream.testing import create_repo
-from buildstream.testing._utils.site import HAVE_GIT
DATA_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "junctions",)
-def copy_subprojects(project, datafiles, subprojects):
- for subproject in subprojects:
- shutil.copytree(os.path.join(str(datafiles), subproject), os.path.join(str(project), subproject))
+def update_project(project_path, updated_configuration):
+ project_conf_path = os.path.join(project_path, "project.conf")
+ project_conf = _yaml.roundtrip_load(project_conf_path)
+ project_conf.update(updated_configuration)
-@pytest.mark.datafiles(DATA_DIR)
-def test_simple_pipeline(cli, datafiles):
- project = os.path.join(str(datafiles), "foo")
- copy_subprojects(project, datafiles, ["base"])
+ _yaml.roundtrip_dump(project_conf, project_conf_path)
- # Check that the pipeline includes the subproject element
- element_list = cli.get_pipeline(project, ["target.bst"])
- assert "base.bst:target.bst" in element_list
+
+#
+# Test behavior of `bst show` on a junction element
+#
+@pytest.mark.datafiles(DATA_DIR)
+def test_simple_show(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "simple")
+ assert cli.get_element_state(project, "subproject.bst") == "junction"
+#
+# Test that we can build build a pipeline with a junction
+#
@pytest.mark.datafiles(DATA_DIR)
def test_simple_build(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
- copy_subprojects(project, datafiles, ["base"])
+ project = os.path.join(str(datafiles), "simple")
checkoutdir = os.path.join(str(tmpdir), "checkout")
@@ -44,280 +47,209 @@ def test_simple_build(cli, tmpdir, datafiles):
result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
result.assert_success()
- # Check that the checkout contains the expected files from both projects
+ # Check that the checkout contains the expected file from the subproject
assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "foo.txt"))
+#
+# Test failure when there is a missing project.conf
+#
@pytest.mark.datafiles(DATA_DIR)
def test_junction_missing_project_conf(cli, datafiles):
- project = datafiles / "foo"
- copy_subprojects(project, datafiles, ["base"])
-
- # TODO: see if datafiles can tidy this concat up
-
- os.remove(project / "base" / "project.conf")
-
- # Note that both 'foo' and 'base' projects have a 'target.bst'. The
- # 'app.bst' in 'foo' depends on the 'target.bst' in 'base', i.e.:
- #
- # foo/base/target.bst
- # foo/app.bst -> foo/base/target.bst
- # foo/target.bst -> foo/app.bst, foor/base/target.bst
- #
- # In a previous bug (issue #960) if the 'project.conf' was not found in the
- # junction's dir then we were continuing the search in the parent dirs.
- #
- # This would mean that the dep on 'target.bst' would resolve to
- # 'foo/target.bst' instead of 'foo/base/target.bst'.
- #
- # That would lead to a 'circular dependency error' in this setup, when we
- # expect an 'invalid junction'.
- #
- result = cli.run(project=project, args=["build", "app.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
+ project = os.path.join(str(datafiles), "simple")
- # Assert that we have the expected provenance encoded into the error
- assert "app.bst [line 6 column 2]" in result.stderr
+ # Just remove the project.conf from the simple test and assert the error
+ os.remove(os.path.join(project, "subproject", "project.conf"))
+
+ result = cli.run(project=project, args=["build", "target.bst"])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
+ assert "target.bst [line 4 column 2]" in result.stderr
+#
+# Test failure when there is a missing project.conf in a workspaced junction
+#
@pytest.mark.datafiles(DATA_DIR)
def test_workspaced_junction_missing_project_conf(cli, datafiles):
- # See test_junction_missing_project_conf for some more background.
+ project = os.path.join(str(datafiles), "simple")
- project = datafiles / "foo"
- workspace_dir = project / "base_workspace"
- copy_subprojects(project, datafiles, ["base"])
+ workspace_dir = os.path.join(project, "workspace")
- result = cli.run(project=project, args=["workspace", "open", "base.bst", "--directory", workspace_dir])
- print(result)
+ result = cli.run(project=project, args=["workspace", "open", "subproject.bst", "--directory", workspace_dir])
result.assert_success()
- os.remove(workspace_dir / "project.conf")
-
- result = cli.run(project=project, args=["build", "app.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
-
- # Assert that we have the expected provenance encoded into the error
- assert "app.bst [line 6 column 2]" in result.stderr
-
+ # Remove the project.conf from the workspace directory
+ os.remove(os.path.join(workspace_dir, "project.conf"))
-@pytest.mark.datafiles(DATA_DIR)
-def test_build_of_same_junction_used_twice(cli, datafiles):
- project = os.path.join(str(datafiles), "inconsistent-names")
-
- # Check we can build a project that contains the same junction
- # that is used twice, but named differently
+ # Assert the same missing project.conf error
result = cli.run(project=project, args=["build", "target.bst"])
- result.assert_success()
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_missing_file_in_subproject(cli, datafiles):
- project = os.path.join(str(datafiles), "missing-element")
- result = cli.run(project=project, args=["show", "target.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
# Assert that we have the expected provenance encoded into the error
assert "target.bst [line 4 column 2]" in result.stderr
+#
+# Test successful builds of deeply nested targets
+#
@pytest.mark.datafiles(DATA_DIR)
-def test_missing_file_in_subsubproject(cli, datafiles):
- project = os.path.join(str(datafiles), "missing-element")
- result = cli.run(project=project, args=["show", "sub-target.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
-
- # Assert that we have the expected provenance encoded into the error
- assert "junction-A.bst:target.bst [line 4 column 2]" in result.stderr
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_missing_junction_in_subproject(cli, datafiles):
- project = os.path.join(str(datafiles), "missing-element")
- result = cli.run(project=project, args=["show", "sub-target-bad-junction.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
-
- # Assert that we have the expected provenance encoded into the error
- assert "junction-A.bst:bad-junction-target.bst [line 4 column 2]" in result.stderr
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_nested_simple(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
- copy_subprojects(project, datafiles, ["base"])
-
+@pytest.mark.parametrize(
+ "target,expected",
+ [("target.bst", ["sub.txt", "subsub.txt"]), ("deeptarget.bst", ["sub.txt", "subsub.txt", "subsubsub.txt"]),],
+ ids=["simple", "deep"],
+)
+def test_nested(cli, tmpdir, datafiles, target, expected):
project = os.path.join(str(datafiles), "nested")
- copy_subprojects(project, datafiles, ["foo"])
-
- checkoutdir = os.path.join(str(tmpdir), "checkout")
-
- # Build, checkout
- result = cli.run(project=project, args=["build", "target.bst"])
- result.assert_success()
- result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
- result.assert_success()
-
- # Check that the checkout contains the expected files from all subprojects
- assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "foo.txt"))
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_nested_double(cli, tmpdir, datafiles):
- project_foo = os.path.join(str(datafiles), "foo")
- copy_subprojects(project_foo, datafiles, ["base"])
-
- project_bar = os.path.join(str(datafiles), "bar")
- copy_subprojects(project_bar, datafiles, ["base"])
-
- project = os.path.join(str(datafiles), "toplevel")
- copy_subprojects(project, datafiles, ["base", "foo", "bar"])
-
checkoutdir = os.path.join(str(tmpdir), "checkout")
# Build, checkout
- result = cli.run(project=project, args=["build", "target.bst"])
+ result = cli.run(project=project, args=["build", target])
result.assert_success()
- result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
+ result = cli.run(project=project, args=["artifact", "checkout", target, "--directory", checkoutdir])
result.assert_success()
# Check that the checkout contains the expected files from all subprojects
- assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "foo.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "bar.txt"))
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_nested_conflict(cli, datafiles):
- project_foo = os.path.join(str(datafiles), "foo")
- copy_subprojects(project_foo, datafiles, ["base"])
-
- project_bar = os.path.join(str(datafiles), "bar")
- copy_subprojects(project_bar, datafiles, ["base"])
-
- project = os.path.join(str(datafiles), "conflict")
- copy_subprojects(project, datafiles, ["foo", "bar"])
-
- result = cli.run(project=project, args=["build", "target.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CONFLICTING_JUNCTION)
-
- assert "bar.bst:target.bst [line 3 column 2]" in result.stderr
-
-
-# Test that we error correctly when the junction element itself is missing
-@pytest.mark.datafiles(DATA_DIR)
-def test_missing_junction(cli, datafiles):
- project = os.path.join(str(datafiles), "invalid")
-
- result = cli.run(project=project, args=["build", "missing.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+ for filename in expected:
+ assert os.path.exists(os.path.join(checkoutdir, filename))
-# Test that we error correctly when an element is not found in the subproject
+#
+# Test missing elements/junctions in subprojects
+#
@pytest.mark.datafiles(DATA_DIR)
-def test_missing_subproject_element(cli, datafiles):
- project = os.path.join(str(datafiles), "invalid")
- copy_subprojects(project, datafiles, ["base"])
-
- result = cli.run(project=project, args=["build", "missing-element.bst"])
+@pytest.mark.parametrize(
+ "target,provenance",
+ [
+ ("target.bst", "target.bst [line 4 column 2]"),
+ ("sub-target.bst", "junction-A.bst:target.bst [line 4 column 2]"),
+ ("bad-junction.bst", "bad-junction.bst [line 3 column 2]"),
+ ("sub-target-bad-junction.bst", "junction-A.bst:bad-junction-target.bst [line 4 column 2]"),
+ ],
+ ids=["subproject-target", "subsubproject-target", "local-junction", "subproject-junction"],
+)
+def test_missing_files(cli, datafiles, target, provenance):
+ project = os.path.join(str(datafiles), "missing-element")
+ result = cli.run(project=project, args=["show", target])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
-
-# Test that we error correctly when a junction itself has dependencies
-@pytest.mark.datafiles(DATA_DIR)
-def test_invalid_with_deps(cli, datafiles):
- project = os.path.join(str(datafiles), "invalid")
- copy_subprojects(project, datafiles, ["base"])
-
- result = cli.run(project=project, args=["build", "junction-with-deps.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
-
-
-# Test that we error correctly when a junction is directly depended on
-@pytest.mark.datafiles(DATA_DIR)
-def test_invalid_junction_dep(cli, datafiles):
- project = os.path.join(str(datafiles), "invalid")
- copy_subprojects(project, datafiles, ["base"])
-
- result = cli.run(project=project, args=["build", "junction-dep.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
+ # Assert that we have the expected provenance encoded into the error
+ assert provenance in result.stderr
-# Test that we error correctly when we junction-depend on a non-junction
+#
+# Test various invalid junction configuraions
+#
@pytest.mark.datafiles(DATA_DIR)
-def test_invalid_junctiondep_not_a_junction(cli, datafiles):
+@pytest.mark.parametrize(
+ "target,reason,provenance",
+ [
+ # Test a junction which itself has dependencies
+ ("junction-with-deps.bst", LoadErrorReason.INVALID_JUNCTION, "base-with-deps.bst [line 6 column 2]"),
+ # Test having a dependency directly on a junction
+ ("junction-dep.bst", LoadErrorReason.INVALID_DATA, "junction-dep.bst [line 3 column 2]"),
+ # Test that we error correctly when we junction-depend on a non-junction
+ (
+ "junctiondep-not-a-junction.bst",
+ LoadErrorReason.INVALID_DATA,
+ "junctiondep-not-a-junction.bst [line 3 column 2]",
+ ),
+ ],
+ ids=["junction-with-deps", "deps-on-junction", "use-element-as-junction"],
+)
+def test_invalid(cli, datafiles, target, reason, provenance):
project = os.path.join(str(datafiles), "invalid")
- copy_subprojects(project, datafiles, ["base"])
-
- result = cli.run(project=project, args=["build", "junctiondep-not-a-junction.bst"])
- result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
-
- # Assert that we have the expected provenance encoded into the error
- assert "junctiondep-not-a-junction.bst [line 3 column 2]" in result.stderr
+ result = cli.run(project=project, args=["build", target])
+ result.assert_main_error(ErrorDomain.LOAD, reason)
+ assert provenance in result.stderr
@pytest.mark.datafiles(DATA_DIR)
-def test_options_default(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "options-default")
- copy_subprojects(project, datafiles, ["options-base"])
-
+@pytest.mark.parametrize(
+ "target,expect_exists,expect_not_exists",
+ [("target-default.bst", "pony.txt", "horsy.txt"), ("target-explicit.bst", "horsy.txt", "pony.txt"),],
+ ids=["check-values", "set-explicit-values"],
+)
+def test_options(cli, tmpdir, datafiles, target, expect_exists, expect_not_exists):
+ project = os.path.join(str(datafiles), "options")
checkoutdir = os.path.join(str(tmpdir), "checkout")
# Build, checkout
- result = cli.run(project=project, args=["build", "target.bst"])
+ result = cli.run(project=project, args=["build", target])
result.assert_success()
- result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
+ result = cli.run(project=project, args=["artifact", "checkout", target, "--directory", checkoutdir])
result.assert_success()
- assert os.path.exists(os.path.join(checkoutdir, "pony.txt"))
- assert not os.path.exists(os.path.join(checkoutdir, "horsy.txt"))
+ assert os.path.exists(os.path.join(checkoutdir, expect_exists))
+ assert not os.path.exists(os.path.join(checkoutdir, expect_not_exists))
+#
+# Test propagation of options through a junction
+#
@pytest.mark.datafiles(DATA_DIR)
-def test_options(cli, tmpdir, datafiles):
+@pytest.mark.parametrize(
+ "animal,expect_exists,expect_not_exists",
+ [("pony", "pony.txt", "horsy.txt"), ("horsy", "horsy.txt", "pony.txt"),],
+ ids=["pony", "horsy"],
+)
+def test_options_propagate(cli, tmpdir, datafiles, animal, expect_exists, expect_not_exists):
project = os.path.join(str(datafiles), "options")
- copy_subprojects(project, datafiles, ["options-base"])
-
checkoutdir = os.path.join(str(tmpdir), "checkout")
- # Build, checkout
- result = cli.run(project=project, args=["build", "target.bst"])
- result.assert_success()
- result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
- result.assert_success()
-
- assert not os.path.exists(os.path.join(checkoutdir, "pony.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "horsy.txt"))
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_options_inherit(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "options-inherit")
- copy_subprojects(project, datafiles, ["options-base"])
-
- checkoutdir = os.path.join(str(tmpdir), "checkout")
+ update_project(
+ project,
+ {
+ "options": {
+ "animal": {
+ "type": "enum",
+ "description": "The kind of animal",
+ "values": ["pony", "horsy"],
+ "default": "pony",
+ "variable": "animal",
+ }
+ }
+ },
+ )
# Build, checkout
- result = cli.run(project=project, args=["build", "target.bst"])
+ result = cli.run(project=project, args=["--option", "animal", animal, "build", "target-propagate.bst"])
result.assert_success()
- result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
+ result = cli.run(
+ project=project,
+ args=[
+ "--option",
+ "animal",
+ animal,
+ "artifact",
+ "checkout",
+ "target-propagate.bst",
+ "--directory",
+ checkoutdir,
+ ],
+ )
result.assert_success()
- assert not os.path.exists(os.path.join(checkoutdir, "pony.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "horsy.txt"))
+ assert os.path.exists(os.path.join(checkoutdir, expect_exists))
+ assert not os.path.exists(os.path.join(checkoutdir, expect_not_exists))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
+#
+# A lot of testing is using local sources for the junctions for
+# speed and convenience, however there are some internal optimizations
+# for local sources, so we need to test some things using a real
+# source which involves triggering fetches.
+#
+# We use the tar source for this since it is a core plugin.
+#
@pytest.mark.datafiles(DATA_DIR)
-def test_git_show(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
+def test_tar_show(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "use-repo")
- # Create the repo from 'base' subdir
- repo = create_repo("git", str(tmpdir))
- ref = repo.create(os.path.join(str(datafiles), "base"))
+ # Create the repo from 'baserepo' subdir
+ repo = create_repo("tar", str(tmpdir))
+ ref = repo.create(os.path.join(project, "baserepo"))
- # Write out junction element with git source
+ # Write out junction element with tar source
element = {"kind": "junction", "sources": [repo.source_config(ref=ref)]}
_yaml.roundtrip_dump(element, os.path.join(project, "base.bst"))
@@ -327,17 +259,16 @@ def test_git_show(cli, tmpdir, datafiles):
assert "base.bst:target.bst" in element_list
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@pytest.mark.datafiles(DATA_DIR)
-def test_git_build(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
+def test_tar_build(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "use-repo")
checkoutdir = os.path.join(str(tmpdir), "checkout")
- # Create the repo from 'base' subdir
- repo = create_repo("git", str(tmpdir))
- ref = repo.create(os.path.join(str(datafiles), "base"))
+ # Create the repo from 'baserepo' subdir
+ repo = create_repo("tar", str(tmpdir))
+ ref = repo.create(os.path.join(project, "baserepo"))
- # Write out junction element with git source
+ # Write out junction element with tar source
element = {"kind": "junction", "sources": [repo.source_config(ref=ref)]}
_yaml.roundtrip_dump(element, os.path.join(project, "base.bst"))
@@ -347,59 +278,45 @@ def test_git_build(cli, tmpdir, datafiles):
result = cli.run(project=project, args=["artifact", "checkout", "target.bst", "--directory", checkoutdir])
result.assert_success()
- # Check that the checkout contains the expected files from both projects
+ # Check that the checkout contains the expected file from the subproject
assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "foo.txt"))
-@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@pytest.mark.datafiles(DATA_DIR)
-def test_git_missing_project_conf(cli, tmpdir, datafiles):
- project = datafiles / "foo"
+def test_tar_missing_project_conf(cli, tmpdir, datafiles):
+ project = datafiles / "use-repo"
- # See test_junction_missing_project_conf for some more background.
- os.remove(datafiles / "base" / "project.conf")
+ # Remove the project.conf from this repo
+ os.remove(datafiles / "use-repo" / "baserepo" / "project.conf")
# Create the repo from 'base' subdir
- repo = create_repo("git", str(tmpdir))
- ref = repo.create(os.path.join(str(datafiles), "base"))
+ repo = create_repo("tar", str(tmpdir))
+ ref = repo.create(os.path.join(project, "baserepo"))
- # Write out junction element with git source
+ # Write out junction element with tar source
element = {"kind": "junction", "sources": [repo.source_config(ref=ref)]}
_yaml.roundtrip_dump(element, str(project / "base.bst"))
- result = cli.run(project=project, args=["build", "app.bst"])
+ result = cli.run(project=project, args=["build", "target.bst"])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION)
# Assert that we have the expected provenance encoded into the error
- assert "app.bst [line 6 column 2]" in result.stderr
-
-
-@pytest.mark.datafiles(DATA_DIR)
-def test_cross_junction_names(cli, datafiles):
- project = os.path.join(str(datafiles), "foo")
- copy_subprojects(project, datafiles, ["base"])
-
- element_list = cli.get_pipeline(project, ["base.bst:target.bst"])
- assert "base.bst:target.bst" in element_list
+ assert "target.bst [line 3 column 2]" in result.stderr
@pytest.mark.datafiles(DATA_DIR)
-def test_build_git_cross_junction_names(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
+def test_build_tar_cross_junction_names(cli, tmpdir, datafiles):
+ project = os.path.join(str(datafiles), "use-repo")
checkoutdir = os.path.join(str(tmpdir), "checkout")
# Create the repo from 'base' subdir
- repo = create_repo("git", str(tmpdir))
- ref = repo.create(os.path.join(str(datafiles), "base"))
+ repo = create_repo("tar", str(tmpdir))
+ ref = repo.create(os.path.join(project, "baserepo"))
- # Write out junction element with git source
+ # Write out junction element with tar source
element = {"kind": "junction", "sources": [repo.source_config(ref=ref)]}
_yaml.roundtrip_dump(element, os.path.join(project, "base.bst"))
- print(element)
- print(cli.get_pipeline(project, ["base.bst"]))
-
# Build (with implicit fetch of subproject), checkout
result = cli.run(project=project, args=["build", "base.bst:target.bst"])
result.assert_success()
@@ -411,28 +328,19 @@ def test_build_git_cross_junction_names(cli, tmpdir, datafiles):
@pytest.mark.datafiles(DATA_DIR)
-def test_junction_show(cli, tmpdir, datafiles):
- project = os.path.join(str(datafiles), "foo")
- copy_subprojects(project, datafiles, ["base"])
-
- # Show, assert that it says junction
- assert cli.get_element_state(project, "base.bst") == "junction"
-
-
-@pytest.mark.datafiles(DATA_DIR)
-@pytest.mark.parametrize("target", ["junction-full-path.bst", "element-full-path.bst", "foo.bst:base.bst:target.bst"])
+@pytest.mark.parametrize(
+ "target",
+ [
+ "junction-full-path.bst",
+ "element-full-path.bst",
+ "subproject.bst:subsubproject.bst:subsubsubproject.bst:target.bst",
+ ],
+ ids=["junction", "element", "command-line"],
+)
def test_full_path(cli, tmpdir, datafiles, target):
- project_foo = os.path.join(str(datafiles), "foo")
- copy_subprojects(project_foo, datafiles, ["base"])
-
- project = os.path.join(str(datafiles), "toplevel")
- copy_subprojects(project, datafiles, ["base", "foo", "bar"])
-
+ project = os.path.join(str(datafiles), "full-path")
checkoutdir = os.path.join(str(tmpdir), "checkout")
- # FIXME: This file can be removed after removing the junction coalescing feature
- os.remove(os.path.join(project, "base.bst"))
-
# Build, checkout
result = cli.run(project=project, args=["build", target])
result.assert_success()
@@ -440,7 +348,7 @@ def test_full_path(cli, tmpdir, datafiles, target):
result.assert_success()
# Check that the checkout contains the expected file from base
- assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
+ assert os.path.exists(os.path.join(checkoutdir, "subsubsub.txt"))
@pytest.mark.datafiles(DATA_DIR)
@@ -449,18 +357,12 @@ def test_full_path(cli, tmpdir, datafiles, target):
[
("junction-full-path-notfound.bst", "junction-full-path-notfound.bst [line 3 column 2]"),
("element-full-path-notfound.bst", "element-full-path-notfound.bst [line 3 column 2]"),
- ("foo.bst:base.bst:pony.bst", None),
+ ("subproject.bst:subsubproject.bst:pony.bst", None),
],
+ ids=["junction", "element", "command-line"],
)
def test_full_path_not_found(cli, tmpdir, datafiles, target, provenance):
- project_foo = os.path.join(str(datafiles), "foo")
- copy_subprojects(project_foo, datafiles, ["base"])
-
- project = os.path.join(str(datafiles), "toplevel")
- copy_subprojects(project, datafiles, ["base", "foo", "bar"])
-
- # FIXME: This file can be removed after removing the junction coalescing feature
- os.remove(os.path.join(project, "base.bst"))
+ project = os.path.join(str(datafiles), "full-path")
# Build
result = cli.run(project=project, args=["build", target])
diff --git a/tests/format/junctions/bar/app.bst b/tests/format/junctions/bar/app.bst
deleted file mode 100644
index a1a7a0ed9..000000000
--- a/tests/format/junctions/bar/app.bst
+++ /dev/null
@@ -1,7 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: bar.txt
-depends:
-- junction: base.bst
- filename: target.bst
diff --git a/tests/format/junctions/bar/bar.txt b/tests/format/junctions/bar/bar.txt
deleted file mode 100644
index 5716ca598..000000000
--- a/tests/format/junctions/bar/bar.txt
+++ /dev/null
@@ -1 +0,0 @@
-bar
diff --git a/tests/format/junctions/bar/target.bst b/tests/format/junctions/bar/target.bst
deleted file mode 100644
index 70b78a3fc..000000000
--- a/tests/format/junctions/bar/target.bst
+++ /dev/null
@@ -1,5 +0,0 @@
-kind: stack
-depends:
-- junction: base.bst
- filename: target.bst
-- app.bst
diff --git a/tests/format/junctions/conflict/target.bst b/tests/format/junctions/conflict/target.bst
deleted file mode 100644
index 5e280e542..000000000
--- a/tests/format/junctions/conflict/target.bst
+++ /dev/null
@@ -1,6 +0,0 @@
-kind: stack
-depends:
-- junction: foo.bst
- filename: target.bst
-- junction: bar.bst
- filename: target.bst
diff --git a/tests/format/junctions/foo/app.bst b/tests/format/junctions/foo/app.bst
deleted file mode 100644
index e658628b0..000000000
--- a/tests/format/junctions/foo/app.bst
+++ /dev/null
@@ -1,7 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: foo.txt
-depends:
-- junction: base.bst
- filename: target.bst
diff --git a/tests/format/junctions/foo/foo.txt b/tests/format/junctions/foo/foo.txt
deleted file mode 100644
index 257cc5642..000000000
--- a/tests/format/junctions/foo/foo.txt
+++ /dev/null
@@ -1 +0,0 @@
-foo
diff --git a/tests/format/junctions/full-path/element-full-path-notfound.bst b/tests/format/junctions/full-path/element-full-path-notfound.bst
new file mode 100644
index 000000000..8797b1d93
--- /dev/null
+++ b/tests/format/junctions/full-path/element-full-path-notfound.bst
@@ -0,0 +1,3 @@
+kind: stack
+depends:
+- subproject.bst:subsubproject.bst:pony.bst
diff --git a/tests/format/junctions/full-path/element-full-path.bst b/tests/format/junctions/full-path/element-full-path.bst
new file mode 100644
index 000000000..b483ef466
--- /dev/null
+++ b/tests/format/junctions/full-path/element-full-path.bst
@@ -0,0 +1,3 @@
+kind: stack
+depends:
+- subproject.bst:subsubproject.bst:subsubsubproject.bst:target.bst
diff --git a/tests/format/junctions/full-path/junction-full-path-notfound.bst b/tests/format/junctions/full-path/junction-full-path-notfound.bst
new file mode 100644
index 000000000..7d2cb8da7
--- /dev/null
+++ b/tests/format/junctions/full-path/junction-full-path-notfound.bst
@@ -0,0 +1,4 @@
+kind: stack
+depends:
+- junction: subproject.bst:subsubproject.bst
+ filename: pony.bst
diff --git a/tests/format/junctions/full-path/junction-full-path.bst b/tests/format/junctions/full-path/junction-full-path.bst
new file mode 100644
index 000000000..dc8aa3af5
--- /dev/null
+++ b/tests/format/junctions/full-path/junction-full-path.bst
@@ -0,0 +1,4 @@
+kind: stack
+depends:
+- junction: subproject.bst:subsubproject.bst:subsubsubproject.bst
+ filename: target.bst
diff --git a/tests/format/junctions/bar/project.conf b/tests/format/junctions/full-path/project.conf
index 42d288416..20636c446 100644
--- a/tests/format/junctions/bar/project.conf
+++ b/tests/format/junctions/full-path/project.conf
@@ -1,2 +1,2 @@
-name: bar
+name: test
min-version: 2.0
diff --git a/tests/format/junctions/conflict/foo.bst b/tests/format/junctions/full-path/subproject.bst
index 1feb4010b..c88189cb0 100644
--- a/tests/format/junctions/conflict/foo.bst
+++ b/tests/format/junctions/full-path/subproject.bst
@@ -1,4 +1,4 @@
kind: junction
sources:
- kind: local
- path: foo
+ path: subproject
diff --git a/tests/format/junctions/conflict/project.conf b/tests/format/junctions/full-path/subproject/project.conf
index 660ab4fa2..39a53e2ab 100644
--- a/tests/format/junctions/conflict/project.conf
+++ b/tests/format/junctions/full-path/subproject/project.conf
@@ -1,2 +1,2 @@
-name: conflict
+name: subtest
min-version: 2.0
diff --git a/tests/format/junctions/full-path/subproject/sub.txt b/tests/format/junctions/full-path/subproject/sub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/sub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/conflict/bar.bst b/tests/format/junctions/full-path/subproject/subsubproject.bst
index 62eee825a..f535ab0e0 100644
--- a/tests/format/junctions/conflict/bar.bst
+++ b/tests/format/junctions/full-path/subproject/subsubproject.bst
@@ -1,4 +1,4 @@
kind: junction
sources:
- kind: local
- path: bar
+ path: subsubproject
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/project.conf b/tests/format/junctions/full-path/subproject/subsubproject/project.conf
new file mode 100644
index 000000000..d11bcbb30
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/project.conf
@@ -0,0 +1,2 @@
+name: subsubtest
+min-version: 2.0
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/subsub.txt b/tests/format/junctions/full-path/subproject/subsubproject/subsub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/subsub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject.bst b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject.bst
new file mode 100644
index 000000000..bce64597b
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject.bst
@@ -0,0 +1,4 @@
+kind: junction
+sources:
+- kind: local
+ path: subsubsubproject
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/project.conf b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/project.conf
new file mode 100644
index 000000000..e508da808
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/project.conf
@@ -0,0 +1,2 @@
+name: subsubsubtest
+min-version: 2.0
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/subsubsub.txt b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/subsubsub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/subsubsub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/target.bst b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/target.bst
new file mode 100644
index 000000000..351c9a22d
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/subsubsubproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: subsubsub.txt
diff --git a/tests/format/junctions/full-path/subproject/subsubproject/target.bst b/tests/format/junctions/full-path/subproject/subsubproject/target.bst
new file mode 100644
index 000000000..afafac601
--- /dev/null
+++ b/tests/format/junctions/full-path/subproject/subsubproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: subsub.txt
diff --git a/tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst b/tests/format/junctions/full-path/subproject/target.bst
index ecdc57c79..e24d9bbb4 100644
--- a/tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/base.bst
+++ b/tests/format/junctions/full-path/subproject/target.bst
@@ -1,4 +1,4 @@
kind: import
sources:
- kind: local
- path: base
+ path: sub.txt
diff --git a/tests/format/junctions/inconsistent-names/elements/junction-A.bst b/tests/format/junctions/inconsistent-names/elements/junction-A.bst
deleted file mode 100644
index 74079f990..000000000
--- a/tests/format/junctions/inconsistent-names/elements/junction-A.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: junctionA
diff --git a/tests/format/junctions/inconsistent-names/elements/junction-B-diff-name.bst b/tests/format/junctions/inconsistent-names/elements/junction-B-diff-name.bst
deleted file mode 100644
index 3b33406e5..000000000
--- a/tests/format/junctions/inconsistent-names/elements/junction-B-diff-name.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: junctionA/junctionB
diff --git a/tests/format/junctions/inconsistent-names/elements/target.bst b/tests/format/junctions/inconsistent-names/elements/target.bst
deleted file mode 100644
index 7eba141de..000000000
--- a/tests/format/junctions/inconsistent-names/elements/target.bst
+++ /dev/null
@@ -1,9 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: files/foo
-depends:
-- filename: lib2.bst
- junction: junction-B-diff-name.bst
-- filename: lib.bst
- junction: junction-A.bst
diff --git a/tests/format/junctions/inconsistent-names/files/foo b/tests/format/junctions/inconsistent-names/files/foo
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/format/junctions/inconsistent-names/files/foo
+++ /dev/null
diff --git a/tests/format/junctions/inconsistent-names/junctionA/elements/app.bst b/tests/format/junctions/inconsistent-names/junctionA/elements/app.bst
deleted file mode 100644
index 473aaee0b..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/elements/app.bst
+++ /dev/null
@@ -1,6 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: files/app
-depends:
-- lib.bst
diff --git a/tests/format/junctions/inconsistent-names/junctionA/elements/junction-B.bst b/tests/format/junctions/inconsistent-names/junctionA/elements/junction-B.bst
deleted file mode 100644
index bc66d7851..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/elements/junction-B.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: junctionB
diff --git a/tests/format/junctions/inconsistent-names/junctionA/elements/lib.bst b/tests/format/junctions/inconsistent-names/junctionA/elements/lib.bst
deleted file mode 100644
index 684a64315..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/elements/lib.bst
+++ /dev/null
@@ -1,7 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: files/lib
-depends:
-- filename: base.bst
- junction: junction-B.bst
diff --git a/tests/format/junctions/inconsistent-names/junctionA/files/app b/tests/format/junctions/inconsistent-names/junctionA/files/app
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/files/app
+++ /dev/null
diff --git a/tests/format/junctions/inconsistent-names/junctionA/files/lib b/tests/format/junctions/inconsistent-names/junctionA/files/lib
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/files/lib
+++ /dev/null
diff --git a/tests/format/junctions/inconsistent-names/junctionA/junctionB/base/baseimg b/tests/format/junctions/inconsistent-names/junctionA/junctionB/base/baseimg
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/junctionB/base/baseimg
+++ /dev/null
diff --git a/tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst b/tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst
deleted file mode 100644
index 5a7c17b99..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/junctionB/elements/lib2.bst
+++ /dev/null
@@ -1,6 +0,0 @@
-kind: import
-sources:
-- kind: local
- path: files/lib2
-depends:
-- base.bst
diff --git a/tests/format/junctions/inconsistent-names/junctionA/junctionB/files/lib2 b/tests/format/junctions/inconsistent-names/junctionA/junctionB/files/lib2
deleted file mode 100644
index e69de29bb..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/junctionB/files/lib2
+++ /dev/null
diff --git a/tests/format/junctions/inconsistent-names/junctionA/junctionB/project.conf b/tests/format/junctions/inconsistent-names/junctionA/junctionB/project.conf
deleted file mode 100644
index 6bdff02c5..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/junctionB/project.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Unique project name
-name: projectB
-
-# Minimum required BuildStream version
-min-version: 2.0
-
-# Subdirectory where elements are stored
-element-path: elements
diff --git a/tests/format/junctions/inconsistent-names/junctionA/project.conf b/tests/format/junctions/inconsistent-names/junctionA/project.conf
deleted file mode 100644
index 8af914819..000000000
--- a/tests/format/junctions/inconsistent-names/junctionA/project.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Unique project name
-name: projectA
-
-# Minimum required BuildStream version
-min-version: 2.0
-
-# Subdirectory where elements are stored
-element-path: elements
diff --git a/tests/format/junctions/inconsistent-names/project.conf b/tests/format/junctions/inconsistent-names/project.conf
deleted file mode 100644
index 8eef10e76..000000000
--- a/tests/format/junctions/inconsistent-names/project.conf
+++ /dev/null
@@ -1,8 +0,0 @@
-# Unique project name
-name: inconsistent-names
-
-# Minimum required BuildStream version
-min-version: 2.0
-
-# Subdirectory where elements are stored
-element-path: elements
diff --git a/tests/format/junctions/base/base.txt b/tests/format/junctions/invalid/base/base.txt
index a496efee8..a496efee8 100644
--- a/tests/format/junctions/base/base.txt
+++ b/tests/format/junctions/invalid/base/base.txt
diff --git a/tests/format/junctions/base/project.conf b/tests/format/junctions/invalid/base/project.conf
index 7e258e29f..7e258e29f 100644
--- a/tests/format/junctions/base/project.conf
+++ b/tests/format/junctions/invalid/base/project.conf
diff --git a/tests/format/junctions/base/target.bst b/tests/format/junctions/invalid/base/target.bst
index 2b61c518b..2b61c518b 100644
--- a/tests/format/junctions/base/target.bst
+++ b/tests/format/junctions/invalid/base/target.bst
diff --git a/tests/format/junctions/invalid/missing-element.bst b/tests/format/junctions/invalid/missing-element.bst
deleted file mode 100644
index 4c29221af..000000000
--- a/tests/format/junctions/invalid/missing-element.bst
+++ /dev/null
@@ -1,9 +0,0 @@
-# This refers to the `foo.bst` element through
-# the `base.bst` junction. The `base.bst` junction
-# exists but the `foo.bst` element does not exist
-# in the subproject.
-#
-kind: stack
-depends:
-- junction: base.bst
- filename: foo.bst
diff --git a/tests/format/junctions/invalid/missing.bst b/tests/format/junctions/missing-element/bad-junction.bst
index 672e967fe..672e967fe 100644
--- a/tests/format/junctions/invalid/missing.bst
+++ b/tests/format/junctions/missing-element/bad-junction.bst
diff --git a/tests/format/junctions/nested/deeptarget.bst b/tests/format/junctions/nested/deeptarget.bst
new file mode 100644
index 000000000..8d7aae29d
--- /dev/null
+++ b/tests/format/junctions/nested/deeptarget.bst
@@ -0,0 +1,6 @@
+kind: stack
+
+depends:
+- subproject.bst:target.bst
+- subproject.bst:subtarget.bst
+- subproject.bst:subsubtarget.bst
diff --git a/tests/format/junctions/nested/foo.bst b/tests/format/junctions/nested/foo.bst
deleted file mode 100644
index 1feb4010b..000000000
--- a/tests/format/junctions/nested/foo.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: foo
diff --git a/tests/format/junctions/nested/project.conf b/tests/format/junctions/nested/project.conf
index eba806781..20636c446 100644
--- a/tests/format/junctions/nested/project.conf
+++ b/tests/format/junctions/nested/project.conf
@@ -1,2 +1,2 @@
-name: nested
+name: test
min-version: 2.0
diff --git a/tests/format/junctions/foo/base.bst b/tests/format/junctions/nested/subproject.bst
index 10ce559a9..c88189cb0 100644
--- a/tests/format/junctions/foo/base.bst
+++ b/tests/format/junctions/nested/subproject.bst
@@ -1,4 +1,4 @@
kind: junction
sources:
- kind: local
- path: base
+ path: subproject
diff --git a/tests/format/junctions/nested/subproject/project.conf b/tests/format/junctions/nested/subproject/project.conf
new file mode 100644
index 000000000..39a53e2ab
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/project.conf
@@ -0,0 +1,2 @@
+name: subtest
+min-version: 2.0
diff --git a/tests/format/junctions/nested/subproject/sub.txt b/tests/format/junctions/nested/subproject/sub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/sub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/nested/subproject/subsubproject.bst b/tests/format/junctions/nested/subproject/subsubproject.bst
new file mode 100644
index 000000000..f535ab0e0
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject.bst
@@ -0,0 +1,4 @@
+kind: junction
+sources:
+- kind: local
+ path: subsubproject
diff --git a/tests/format/junctions/nested/subproject/subsubproject/project.conf b/tests/format/junctions/nested/subproject/subsubproject/project.conf
new file mode 100644
index 000000000..d11bcbb30
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/project.conf
@@ -0,0 +1,2 @@
+name: subsubtest
+min-version: 2.0
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subsub.txt b/tests/format/junctions/nested/subproject/subsubproject/subsub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subsub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject.bst b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject.bst
new file mode 100644
index 000000000..bce64597b
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject.bst
@@ -0,0 +1,4 @@
+kind: junction
+sources:
+- kind: local
+ path: subsubsubproject
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/project.conf b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/project.conf
new file mode 100644
index 000000000..e508da808
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/project.conf
@@ -0,0 +1,2 @@
+name: subsubsubtest
+min-version: 2.0
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/subsubsub.txt b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/subsubsub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/subsubsub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/target.bst b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/target.bst
new file mode 100644
index 000000000..351c9a22d
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subsubsubproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: subsubsub.txt
diff --git a/tests/format/junctions/nested/subproject/subsubproject/subtarget.bst b/tests/format/junctions/nested/subproject/subsubproject/subtarget.bst
new file mode 100644
index 000000000..b6fea5b2a
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/subtarget.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- subsubsubproject.bst:target.bst
diff --git a/tests/format/junctions/nested/subproject/subsubproject/target.bst b/tests/format/junctions/nested/subproject/subsubproject/target.bst
new file mode 100644
index 000000000..afafac601
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: subsub.txt
diff --git a/tests/format/junctions/nested/subproject/subsubtarget.bst b/tests/format/junctions/nested/subproject/subsubtarget.bst
new file mode 100644
index 000000000..050e0118c
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subsubtarget.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- subsubproject.bst:subtarget.bst
diff --git a/tests/format/junctions/nested/subproject/subtarget.bst b/tests/format/junctions/nested/subproject/subtarget.bst
new file mode 100644
index 000000000..c4549b373
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/subtarget.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- subsubproject.bst:target.bst
diff --git a/tests/format/junctions/nested/subproject/target.bst b/tests/format/junctions/nested/subproject/target.bst
new file mode 100644
index 000000000..e24d9bbb4
--- /dev/null
+++ b/tests/format/junctions/nested/subproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: sub.txt
diff --git a/tests/format/junctions/nested/target.bst b/tests/format/junctions/nested/target.bst
index db59499a7..32bbc75bc 100644
--- a/tests/format/junctions/nested/target.bst
+++ b/tests/format/junctions/nested/target.bst
@@ -1,4 +1,5 @@
kind: stack
+
depends:
-- junction: foo.bst
- filename: target.bst
+- subproject.bst:target.bst
+- subproject.bst:subtarget.bst
diff --git a/tests/format/junctions/options-default/project.conf b/tests/format/junctions/options-default/project.conf
deleted file mode 100644
index c362c12b6..000000000
--- a/tests/format/junctions/options-default/project.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-name: options-default
-min-version: 2.0
diff --git a/tests/format/junctions/options-inherit/project.conf b/tests/format/junctions/options-inherit/project.conf
deleted file mode 100644
index b5680a792..000000000
--- a/tests/format/junctions/options-inherit/project.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-name: options-inherit
-min-version: 2.0
-options:
- animal:
- type: enum
- description: The kind of animal
- values:
- - pony
- - horsy
- default: horsy
- variable: animal
diff --git a/tests/format/junctions/options-default/base.bst b/tests/format/junctions/options/base-default.bst
index 5d42e5c31..5d42e5c31 100644
--- a/tests/format/junctions/options-default/base.bst
+++ b/tests/format/junctions/options/base-default.bst
diff --git a/tests/format/junctions/options/base.bst b/tests/format/junctions/options/base-explicit.bst
index a100e5e1e..a100e5e1e 100644
--- a/tests/format/junctions/options/base.bst
+++ b/tests/format/junctions/options/base-explicit.bst
diff --git a/tests/format/junctions/options-inherit/base.bst b/tests/format/junctions/options/base-propagate.bst
index 8623d0d01..8623d0d01 100644
--- a/tests/format/junctions/options-inherit/base.bst
+++ b/tests/format/junctions/options/base-propagate.bst
diff --git a/tests/format/junctions/options-base/horsy.txt b/tests/format/junctions/options/options-base/horsy.txt
index 063dad656..063dad656 100644
--- a/tests/format/junctions/options-base/horsy.txt
+++ b/tests/format/junctions/options/options-base/horsy.txt
diff --git a/tests/format/junctions/options-base/pony.txt b/tests/format/junctions/options/options-base/pony.txt
index f62144808..f62144808 100644
--- a/tests/format/junctions/options-base/pony.txt
+++ b/tests/format/junctions/options/options-base/pony.txt
diff --git a/tests/format/junctions/options-base/project.conf b/tests/format/junctions/options/options-base/project.conf
index 58bfa55e5..58bfa55e5 100644
--- a/tests/format/junctions/options-base/project.conf
+++ b/tests/format/junctions/options/options-base/project.conf
diff --git a/tests/format/junctions/options-base/target.bst b/tests/format/junctions/options/options-base/target.bst
index cda17af98..cda17af98 100644
--- a/tests/format/junctions/options-base/target.bst
+++ b/tests/format/junctions/options/options-base/target.bst
diff --git a/tests/format/junctions/options-inherit/target.bst b/tests/format/junctions/options/target-default.bst
index 8395c0c77..6de0bb89d 100644
--- a/tests/format/junctions/options-inherit/target.bst
+++ b/tests/format/junctions/options/target-default.bst
@@ -1,4 +1,4 @@
kind: stack
depends:
-- junction: base.bst
+- junction: base-default.bst
filename: target.bst
diff --git a/tests/format/junctions/options/target.bst b/tests/format/junctions/options/target-explicit.bst
index 8395c0c77..25d923b8e 100644
--- a/tests/format/junctions/options/target.bst
+++ b/tests/format/junctions/options/target-explicit.bst
@@ -1,4 +1,4 @@
kind: stack
depends:
-- junction: base.bst
+- junction: base-explicit.bst
filename: target.bst
diff --git a/tests/format/junctions/foo/target.bst b/tests/format/junctions/options/target-propagate.bst
index 70b78a3fc..7f2f4b798 100644
--- a/tests/format/junctions/foo/target.bst
+++ b/tests/format/junctions/options/target-propagate.bst
@@ -1,5 +1,4 @@
kind: stack
depends:
-- junction: base.bst
+- junction: base-propagate.bst
filename: target.bst
-- app.bst
diff --git a/tests/format/junctions/simple/project.conf b/tests/format/junctions/simple/project.conf
new file mode 100644
index 000000000..20636c446
--- /dev/null
+++ b/tests/format/junctions/simple/project.conf
@@ -0,0 +1,2 @@
+name: test
+min-version: 2.0
diff --git a/tests/format/junctions/bar/base.bst b/tests/format/junctions/simple/subproject.bst
index 10ce559a9..c88189cb0 100644
--- a/tests/format/junctions/bar/base.bst
+++ b/tests/format/junctions/simple/subproject.bst
@@ -1,4 +1,4 @@
kind: junction
sources:
- kind: local
- path: base
+ path: subproject
diff --git a/tests/format/junctions/simple/subproject/base.txt b/tests/format/junctions/simple/subproject/base.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/junctions/simple/subproject/base.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/junctions/simple/subproject/project.conf b/tests/format/junctions/simple/subproject/project.conf
new file mode 100644
index 000000000..39a53e2ab
--- /dev/null
+++ b/tests/format/junctions/simple/subproject/project.conf
@@ -0,0 +1,2 @@
+name: subtest
+min-version: 2.0
diff --git a/tests/format/junctions/simple/subproject/target.bst b/tests/format/junctions/simple/subproject/target.bst
new file mode 100644
index 000000000..2b61c518b
--- /dev/null
+++ b/tests/format/junctions/simple/subproject/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: base.txt
diff --git a/tests/format/junctions/simple/target.bst b/tests/format/junctions/simple/target.bst
new file mode 100644
index 000000000..8ecfd7d56
--- /dev/null
+++ b/tests/format/junctions/simple/target.bst
@@ -0,0 +1,4 @@
+kind: stack
+
+depends:
+- subproject.bst:target.bst
diff --git a/tests/format/junctions/toplevel/bar.bst b/tests/format/junctions/toplevel/bar.bst
deleted file mode 100644
index 62eee825a..000000000
--- a/tests/format/junctions/toplevel/bar.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: bar
diff --git a/tests/format/junctions/toplevel/base.bst b/tests/format/junctions/toplevel/base.bst
deleted file mode 100644
index 10ce559a9..000000000
--- a/tests/format/junctions/toplevel/base.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: base
diff --git a/tests/format/junctions/toplevel/element-full-path-notfound.bst b/tests/format/junctions/toplevel/element-full-path-notfound.bst
deleted file mode 100644
index 55efaca10..000000000
--- a/tests/format/junctions/toplevel/element-full-path-notfound.bst
+++ /dev/null
@@ -1,3 +0,0 @@
-kind: stack
-depends:
-- foo.bst:base.bst:pony.bst
diff --git a/tests/format/junctions/toplevel/element-full-path.bst b/tests/format/junctions/toplevel/element-full-path.bst
deleted file mode 100644
index f58559a76..000000000
--- a/tests/format/junctions/toplevel/element-full-path.bst
+++ /dev/null
@@ -1,3 +0,0 @@
-kind: stack
-depends:
-- foo.bst:base.bst:target.bst
diff --git a/tests/format/junctions/toplevel/foo.bst b/tests/format/junctions/toplevel/foo.bst
deleted file mode 100644
index 1feb4010b..000000000
--- a/tests/format/junctions/toplevel/foo.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: junction
-sources:
-- kind: local
- path: foo
diff --git a/tests/format/junctions/toplevel/junction-full-path-notfound.bst b/tests/format/junctions/toplevel/junction-full-path-notfound.bst
deleted file mode 100644
index a57d6ba76..000000000
--- a/tests/format/junctions/toplevel/junction-full-path-notfound.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: stack
-depends:
-- junction: foo.bst:base.bst
- filename: pony.bst
diff --git a/tests/format/junctions/toplevel/junction-full-path.bst b/tests/format/junctions/toplevel/junction-full-path.bst
deleted file mode 100644
index 4a4f67d19..000000000
--- a/tests/format/junctions/toplevel/junction-full-path.bst
+++ /dev/null
@@ -1,4 +0,0 @@
-kind: stack
-depends:
-- junction: foo.bst:base.bst
- filename: target.bst
diff --git a/tests/format/junctions/toplevel/project.conf b/tests/format/junctions/toplevel/project.conf
deleted file mode 100644
index d35b2b8f8..000000000
--- a/tests/format/junctions/toplevel/project.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-name: toplevel
-min-version: 2.0
diff --git a/tests/format/junctions/toplevel/target.bst b/tests/format/junctions/toplevel/target.bst
deleted file mode 100644
index 5e280e542..000000000
--- a/tests/format/junctions/toplevel/target.bst
+++ /dev/null
@@ -1,6 +0,0 @@
-kind: stack
-depends:
-- junction: foo.bst
- filename: target.bst
-- junction: bar.bst
- filename: target.bst
diff --git a/tests/format/junctions/use-repo/baserepo/base.txt b/tests/format/junctions/use-repo/baserepo/base.txt
new file mode 100644
index 000000000..a496efee8
--- /dev/null
+++ b/tests/format/junctions/use-repo/baserepo/base.txt
@@ -0,0 +1 @@
+This is a text file
diff --git a/tests/format/junctions/use-repo/baserepo/project.conf b/tests/format/junctions/use-repo/baserepo/project.conf
new file mode 100644
index 000000000..7e258e29f
--- /dev/null
+++ b/tests/format/junctions/use-repo/baserepo/project.conf
@@ -0,0 +1,2 @@
+name: base
+min-version: 2.0
diff --git a/tests/format/junctions/use-repo/baserepo/target.bst b/tests/format/junctions/use-repo/baserepo/target.bst
new file mode 100644
index 000000000..2b61c518b
--- /dev/null
+++ b/tests/format/junctions/use-repo/baserepo/target.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: base.txt
diff --git a/tests/format/junctions/foo/project.conf b/tests/format/junctions/use-repo/project.conf
index 43a09bb5e..43a09bb5e 100644
--- a/tests/format/junctions/foo/project.conf
+++ b/tests/format/junctions/use-repo/project.conf
diff --git a/tests/format/junctions/options-default/target.bst b/tests/format/junctions/use-repo/target.bst
index 8395c0c77..8395c0c77 100644
--- a/tests/format/junctions/options-default/target.bst
+++ b/tests/format/junctions/use-repo/target.bst