summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-05 16:27:21 +0900
committerTristan van Berkom <tristan.vanberkom@codethink.co.uk>2020-06-08 23:50:34 +0900
commitd7242d40824e058eff00bb13fe83debf24dad8be (patch)
treea9c4416141c4124e5873e6090096dbb04070a215 /tests
parent13f8266bc41c018f153a8124718fcda267332e64 (diff)
downloadbuildstream-d7242d40824e058eff00bb13fe83debf24dad8be.tar.gz
tests/format/junctions.py: Test loading dependencies and targets with full paths
Diffstat (limited to 'tests')
-rw-r--r--tests/format/junctions.py52
-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/junction-full-path-notfound.bst4
-rw-r--r--tests/format/junctions/toplevel/junction-full-path.bst4
5 files changed, 66 insertions, 0 deletions
diff --git a/tests/format/junctions.py b/tests/format/junctions.py
index f097e0b8b..b60d16816 100644
--- a/tests/format/junctions.py
+++ b/tests/format/junctions.py
@@ -417,3 +417,55 @@ def test_junction_show(cli, tmpdir, datafiles):
# 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"])
+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"])
+
+ 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()
+ result = cli.run(project=project, args=["artifact", "checkout", target, "--directory", checkoutdir])
+ result.assert_success()
+
+ # Check that the checkout contains the expected file from base
+ assert os.path.exists(os.path.join(checkoutdir, "base.txt"))
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize(
+ "target,provenance",
+ [
+ ("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),
+ ],
+)
+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"))
+
+ # Build
+ result = cli.run(project=project, args=["build", target])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Check that provenance was provided if expected
+ if provenance:
+ assert provenance in result.stderr
diff --git a/tests/format/junctions/toplevel/element-full-path-notfound.bst b/tests/format/junctions/toplevel/element-full-path-notfound.bst
new file mode 100644
index 000000000..55efaca10
--- /dev/null
+++ b/tests/format/junctions/toplevel/element-full-path-notfound.bst
@@ -0,0 +1,3 @@
+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
new file mode 100644
index 000000000..f58559a76
--- /dev/null
+++ b/tests/format/junctions/toplevel/element-full-path.bst
@@ -0,0 +1,3 @@
+kind: stack
+depends:
+- foo.bst:base.bst:target.bst
diff --git a/tests/format/junctions/toplevel/junction-full-path-notfound.bst b/tests/format/junctions/toplevel/junction-full-path-notfound.bst
new file mode 100644
index 000000000..a57d6ba76
--- /dev/null
+++ b/tests/format/junctions/toplevel/junction-full-path-notfound.bst
@@ -0,0 +1,4 @@
+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
new file mode 100644
index 000000000..4a4f67d19
--- /dev/null
+++ b/tests/format/junctions/toplevel/junction-full-path.bst
@@ -0,0 +1,4 @@
+kind: stack
+depends:
+- junction: foo.bst:base.bst
+ filename: target.bst