summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-09-26 17:10:15 +0900
committerbst-marge-bot <marge-bot@buildstream.build>2020-09-28 09:26:09 +0000
commit295d65b9c753d378c97cafd132275016b9cea3f5 (patch)
tree98c814eef73ff9e78b70cc9067dda3044a2d9cb1 /tests
parent14f9e473406d64c9b176412bd965a212553ca809 (diff)
downloadbuildstream-295d65b9c753d378c97cafd132275016b9cea3f5.tar.gz
tests/format/dependencies.py: Testing shorthand dependency configurations
Diffstat (limited to 'tests')
-rw-r--r--tests/format/dependencies.py13
-rw-r--r--tests/format/dependencies3/elements/dep2.bst2
-rw-r--r--tests/format/dependencies3/elements/shorthand-config.bst10
-rw-r--r--tests/format/dependencies3/elements/shorthand-junction.bst11
-rw-r--r--tests/format/dependencies3/elements/subproject.bst4
-rw-r--r--tests/format/dependencies3/subproject/project.conf2
-rw-r--r--tests/format/dependencies3/subproject/sub.txt1
-rw-r--r--tests/format/dependencies3/subproject/target-a.bst4
-rw-r--r--tests/format/dependencies3/subproject/target-b.bst4
9 files changed, 51 insertions, 0 deletions
diff --git a/tests/format/dependencies.py b/tests/format/dependencies.py
index 12eb19d3a..0e2d4a1a7 100644
--- a/tests/format/dependencies.py
+++ b/tests/format/dependencies.py
@@ -281,3 +281,16 @@ def test_config_runtime_error(cli, datafiles):
#
result = cli.run(project=project, args=["show", "runtime-error.bst"])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize(
+ "target,number", [("shorthand-config.bst", 2), ("shorthand-junction.bst", 2),], ids=["config", "junction"],
+)
+def test_shorthand(cli, datafiles, target, number):
+ project = os.path.join(str(datafiles), "dependencies3")
+
+ result = cli.run(project=project, args=["show", target])
+ result.assert_success()
+
+ assert "TEST PLUGIN FOUND {} ENABLED DEPENDENCIES".format(number) in result.stderr
diff --git a/tests/format/dependencies3/elements/dep2.bst b/tests/format/dependencies3/elements/dep2.bst
new file mode 100644
index 000000000..9e5cf96b6
--- /dev/null
+++ b/tests/format/dependencies3/elements/dep2.bst
@@ -0,0 +1,2 @@
+kind: manual
+description: Some kinda element
diff --git a/tests/format/dependencies3/elements/shorthand-config.bst b/tests/format/dependencies3/elements/shorthand-config.bst
new file mode 100644
index 000000000..72020c0d8
--- /dev/null
+++ b/tests/format/dependencies3/elements/shorthand-config.bst
@@ -0,0 +1,10 @@
+kind: configsupported
+
+# Here we test specification of multiple files with the same configuration
+#
+depends:
+- filename:
+ - dep.bst
+ - dep2.bst
+ config:
+ enabled: true
diff --git a/tests/format/dependencies3/elements/shorthand-junction.bst b/tests/format/dependencies3/elements/shorthand-junction.bst
new file mode 100644
index 000000000..842a70dff
--- /dev/null
+++ b/tests/format/dependencies3/elements/shorthand-junction.bst
@@ -0,0 +1,11 @@
+kind: configsupported
+
+# Here we test specification of multiple files through the same junction
+#
+depends:
+- filename:
+ - target-a.bst
+ - target-b.bst
+ junction: subproject.bst
+ config:
+ enabled: true
diff --git a/tests/format/dependencies3/elements/subproject.bst b/tests/format/dependencies3/elements/subproject.bst
new file mode 100644
index 000000000..c88189cb0
--- /dev/null
+++ b/tests/format/dependencies3/elements/subproject.bst
@@ -0,0 +1,4 @@
+kind: junction
+sources:
+- kind: local
+ path: subproject
diff --git a/tests/format/dependencies3/subproject/project.conf b/tests/format/dependencies3/subproject/project.conf
new file mode 100644
index 000000000..39a53e2ab
--- /dev/null
+++ b/tests/format/dependencies3/subproject/project.conf
@@ -0,0 +1,2 @@
+name: subtest
+min-version: 2.0
diff --git a/tests/format/dependencies3/subproject/sub.txt b/tests/format/dependencies3/subproject/sub.txt
new file mode 100644
index 000000000..f73f3093f
--- /dev/null
+++ b/tests/format/dependencies3/subproject/sub.txt
@@ -0,0 +1 @@
+file
diff --git a/tests/format/dependencies3/subproject/target-a.bst b/tests/format/dependencies3/subproject/target-a.bst
new file mode 100644
index 000000000..e24d9bbb4
--- /dev/null
+++ b/tests/format/dependencies3/subproject/target-a.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: sub.txt
diff --git a/tests/format/dependencies3/subproject/target-b.bst b/tests/format/dependencies3/subproject/target-b.bst
new file mode 100644
index 000000000..e24d9bbb4
--- /dev/null
+++ b/tests/format/dependencies3/subproject/target-b.bst
@@ -0,0 +1,4 @@
+kind: import
+sources:
+- kind: local
+ path: sub.txt