summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2019-01-10 14:03:57 +0100
committerJürg Billeter <j@bitron.ch>2019-01-10 14:06:02 +0100
commit0c2a66b3b76a5d06a1ca61210ed24bf4a54e0f4a (patch)
tree32f5eeefea167e399b9e4b6297dee7812b756515
parent06deb4c4eb2bba43a67b4ffc0f34ce2b9f16adfa (diff)
downloadbuildstream-0c2a66b3b76a5d06a1ca61210ed24bf4a54e0f4a.tar.gz
tests/format/optionarch.py: Add tests for architecture aliases
-rw-r--r--tests/format/option-arch-alias/element.bst8
-rw-r--r--tests/format/option-arch-alias/project.conf9
-rw-r--r--tests/format/option-arch-unknown/element.bst10
-rw-r--r--tests/format/option-arch-unknown/project.conf10
-rw-r--r--tests/format/optionarch.py44
5 files changed, 81 insertions, 0 deletions
diff --git a/tests/format/option-arch-alias/element.bst b/tests/format/option-arch-alias/element.bst
new file mode 100644
index 000000000..92ebfb134
--- /dev/null
+++ b/tests/format/option-arch-alias/element.bst
@@ -0,0 +1,8 @@
+kind: autotools
+variables:
+ result: "Nothing"
+ (?):
+ - machine_arch == "arm":
+ result: "Army"
+ - machine_arch == "x86_64":
+ result: "X86-64y"
diff --git a/tests/format/option-arch-alias/project.conf b/tests/format/option-arch-alias/project.conf
new file mode 100644
index 000000000..47f0945c9
--- /dev/null
+++ b/tests/format/option-arch-alias/project.conf
@@ -0,0 +1,9 @@
+name: test
+
+options:
+ machine_arch:
+ type: arch
+ description: The machine architecture
+ values:
+ - arm
+ - x86_64
diff --git a/tests/format/option-arch-unknown/element.bst b/tests/format/option-arch-unknown/element.bst
new file mode 100644
index 000000000..c4376715b
--- /dev/null
+++ b/tests/format/option-arch-unknown/element.bst
@@ -0,0 +1,10 @@
+kind: autotools
+variables:
+ result: "Nothing"
+ (?):
+ - machine_arch == "aarch32":
+ result: "Army"
+ - machine_arch == "aarch64":
+ result: "Aarchy"
+ - machine_arch == "x86-128":
+ result: "X86-128y"
diff --git a/tests/format/option-arch-unknown/project.conf b/tests/format/option-arch-unknown/project.conf
new file mode 100644
index 000000000..0827ec387
--- /dev/null
+++ b/tests/format/option-arch-unknown/project.conf
@@ -0,0 +1,10 @@
+name: test
+
+options:
+ machine_arch:
+ type: arch
+ description: The machine architecture
+ values:
+ - aarch32
+ - aarch64
+ - x86-128
diff --git a/tests/format/optionarch.py b/tests/format/optionarch.py
index 901b6e2da..09f9c07c9 100644
--- a/tests/format/optionarch.py
+++ b/tests/format/optionarch.py
@@ -75,3 +75,47 @@ def test_unsupported_arch(cli, datafiles):
])
result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_alias(cli, datafiles):
+
+ with override_uname_arch("arm"):
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'option-arch-alias')
+ result = cli.run(project=project, silent=True, args=[
+ 'show',
+ '--deps', 'none',
+ '--format', '%{vars}',
+ 'element.bst'
+ ])
+
+ result.assert_success()
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_unknown_host_arch(cli, datafiles):
+
+ with override_uname_arch("x86_128"):
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'option-arch')
+ result = cli.run(project=project, silent=True, args=[
+ 'show',
+ '--deps', 'none',
+ '--format', '%{vars}',
+ 'element.bst'
+ ])
+
+ result.assert_main_error(ErrorDomain.PLATFORM, None)
+
+
+@pytest.mark.datafiles(DATA_DIR)
+def test_unknown_project_arch(cli, datafiles):
+
+ project = os.path.join(datafiles.dirname, datafiles.basename, 'option-arch-unknown')
+ result = cli.run(project=project, silent=True, args=[
+ 'show',
+ '--deps', 'none',
+ '--format', '%{vars}',
+ 'element.bst'
+ ])
+
+ result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA)