summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-03-09 18:51:49 +0900
committerbst-marge-bot <marge-bot@buildstream.build>2019-03-12 07:14:58 +0000
commitf4a92e16ad2913de845ab5de866bbb0b963f349a (patch)
treed3ef8066cf5e2a039e850db2980e079d52548638
parentbb44f093f6169aee5db41a7e4523affff12ed412 (diff)
downloadbuildstream-f4a92e16ad2913de845ab5de866bbb0b963f349a.tar.gz
tests/format/project.py: Added tests for missing files and missing junctions
These also assert that the provenance of the references to missing files are reported, guarding for regressions of issue #947
-rw-r--r--tests/format/project.py20
-rw-r--r--tests/format/project/missing-element/manual.bst4
-rw-r--r--tests/format/project/missing-element/project.conf1
-rw-r--r--tests/format/project/missing-junction/manual.bst5
-rw-r--r--tests/format/project/missing-junction/project.conf1
5 files changed, 31 insertions, 0 deletions
diff --git a/tests/format/project.py b/tests/format/project.py
index c746409bb..0f29cac1e 100644
--- a/tests/format/project.py
+++ b/tests/format/project.py
@@ -29,6 +29,26 @@ def test_missing_project_name(cli, datafiles):
@pytest.mark.datafiles(os.path.join(DATA_DIR))
+def test_missing_element(cli, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename, "missing-element")
+ result = cli.run(project=project, args=['show', 'manual.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Assert that we have the expected provenance encoded into the error
+ assert "manual.bst [line 4 column 2]" in result.stderr
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
+def test_missing_junction(cli, datafiles):
+ project = os.path.join(datafiles.dirname, datafiles.basename, "missing-junction")
+ result = cli.run(project=project, args=['show', 'manual.bst'])
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.MISSING_FILE)
+
+ # Assert that we have the expected provenance encoded into the error
+ assert "manual.bst [line 4 column 2]" in result.stderr
+
+
+@pytest.mark.datafiles(os.path.join(DATA_DIR))
def test_empty_project_name(cli, datafiles):
project = os.path.join(datafiles.dirname, datafiles.basename, "emptyname")
result = cli.run(project=project, args=['workspace', 'list'])
diff --git a/tests/format/project/missing-element/manual.bst b/tests/format/project/missing-element/manual.bst
new file mode 100644
index 000000000..6dd3d7178
--- /dev/null
+++ b/tests/format/project/missing-element/manual.bst
@@ -0,0 +1,4 @@
+kind: manual
+
+depends:
+- missing.bst
diff --git a/tests/format/project/missing-element/project.conf b/tests/format/project/missing-element/project.conf
new file mode 100644
index 000000000..b32753625
--- /dev/null
+++ b/tests/format/project/missing-element/project.conf
@@ -0,0 +1 @@
+name: test
diff --git a/tests/format/project/missing-junction/manual.bst b/tests/format/project/missing-junction/manual.bst
new file mode 100644
index 000000000..0e0ae0860
--- /dev/null
+++ b/tests/format/project/missing-junction/manual.bst
@@ -0,0 +1,5 @@
+kind: manual
+
+depends:
+- filename: element.bst
+ junction: missing.bst
diff --git a/tests/format/project/missing-junction/project.conf b/tests/format/project/missing-junction/project.conf
new file mode 100644
index 000000000..b32753625
--- /dev/null
+++ b/tests/format/project/missing-junction/project.conf
@@ -0,0 +1 @@
+name: test