summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAbderrahim Kitouni <akitouni@gnome.org>2020-03-18 11:54:47 +0100
committerAbderrahim Kitouni <akitouni@gnome.org>2020-04-05 09:13:55 +0100
commit9d837bb19b98e878c4e4ba4bcb3365969138d5a7 (patch)
tree3328a5b35b081812499c68d837d896937c84bf2f /tests
parent0c21df1ea72e9509d7ed035752f125ebb0228e56 (diff)
downloadbuildstream-9d837bb19b98e878c4e4ba4bcb3365969138d5a7.tar.gz
_project.py: resolve options before running the final assertionsabderrahim/options
otherwise, having an optional list append in theh configuration wouldn't work This also avoids special casing for element and source overrides
Diffstat (limited to 'tests')
-rw-r--r--tests/format/option-list-directive.py19
-rw-r--r--tests/format/option-list-directive/project.conf18
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/format/option-list-directive.py b/tests/format/option-list-directive.py
new file mode 100644
index 000000000..2df5b6f77
--- /dev/null
+++ b/tests/format/option-list-directive.py
@@ -0,0 +1,19 @@
+# Pylint doesn't play well with fixtures and dependency injection from pytest
+# pylint: disable=redefined-outer-name
+
+import os
+import pytest
+from buildstream.testing.runcli import cli # pylint: disable=unused-import
+
+# Project directory
+DATA_DIR = os.path.dirname(os.path.realpath(__file__))
+
+
+@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("mount_devices", [("true"), ("false")])
+def test_override(cli, datafiles, mount_devices):
+ project = os.path.join(datafiles.dirname, datafiles.basename, "option-list-directive")
+
+ bst_args = ["--option", "shell_mount_devices", mount_devices, "build"]
+ result = cli.run(project=project, silent=True, args=bst_args)
+ result.assert_success()
diff --git a/tests/format/option-list-directive/project.conf b/tests/format/option-list-directive/project.conf
new file mode 100644
index 000000000..5b2b64fe8
--- /dev/null
+++ b/tests/format/option-list-directive/project.conf
@@ -0,0 +1,18 @@
+name: test
+
+options:
+ shell_mount_devices:
+ type: bool
+ description: whether to mount devices in the shell
+ default: false
+
+shell:
+ host-files:
+ - '/etc/passwd'
+ - '/etc/group'
+
+ (?):
+ - shell_mount_devices:
+ host-files:
+ (>):
+ - '/dev/dri'