summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2018-11-22 17:27:20 +0000
committerRaoul Hidalgo Charman <raoul.hidalgocharman@codethink.co.uk>2018-12-05 10:44:02 +0000
commit9f75c274a56855c4c6dd625c2d4216d82febde75 (patch)
tree6237c037779217e4b664a4ba7381170d672dce42
parent1ad35fcd1bbb4a89e177da44303cf95e5a3b659d (diff)
downloadbuildstream-9f75c274a56855c4c6dd625c2d4216d82febde75.tar.gz
optionarch.py: update to use same arch names as SandboxConfig
Also update tests to be consistent with this
-rw-r--r--buildstream/_options/optionarch.py5
-rw-r--r--doc/examples/flatpak-autotools/elements/base/sdk.bst4
-rw-r--r--doc/examples/flatpak-autotools/project.conf4
-rw-r--r--tests/cachekey/cachekey.py2
-rw-r--r--tests/examples/autotools.py8
-rw-r--r--tests/examples/developing.py12
-rw-r--r--tests/examples/flatpak-autotools.py8
-rw-r--r--tests/examples/integration-commands.py8
-rw-r--r--tests/examples/junctions.py8
-rw-r--r--tests/examples/running-commands.py8
-rw-r--r--tests/format/list-directive-type-error/project.conf2
-rw-r--r--tests/format/option-arch/element.bst2
-rw-r--r--tests/format/option-arch/project.conf2
-rw-r--r--tests/format/optionarch.py4
-rwxr-xr-xtests/integration/base/generate-base.sh2
-rw-r--r--tests/integration/project/elements/base/base-alpine.bst2
-rw-r--r--tests/integration/project/project.conf2
-rw-r--r--tests/testutils/site.py3
18 files changed, 43 insertions, 43 deletions
diff --git a/buildstream/_options/optionarch.py b/buildstream/_options/optionarch.py
index 13a691643..1d8509cf2 100644
--- a/buildstream/_options/optionarch.py
+++ b/buildstream/_options/optionarch.py
@@ -17,7 +17,7 @@
# Authors:
# Tristan Van Berkom <tristan.vanberkom@codethink.co.uk>
-import os
+from .._platform import Platform
from .optionenum import OptionEnum
@@ -41,8 +41,7 @@ class OptionArch(OptionEnum):
super(OptionArch, self).load(node, allow_default_definition=False)
def load_default_value(self, node):
- _, _, _, _, machine_arch = os.uname()
- return machine_arch
+ return Platform.get_host_arch()
def resolve(self):
diff --git a/doc/examples/flatpak-autotools/elements/base/sdk.bst b/doc/examples/flatpak-autotools/elements/base/sdk.bst
index a1b6c5856..97089b83b 100644
--- a/doc/examples/flatpak-autotools/elements/base/sdk.bst
+++ b/doc/examples/flatpak-autotools/elements/base/sdk.bst
@@ -5,10 +5,10 @@ sources:
url: gnomesdk:repo/
gpg-key: keys/gnome-sdk.gpg
(?):
- - arch == "x86_64":
+ - arch == "x86-64":
track: runtime/org.freedesktop.BaseSdk/x86_64/1.4
ref: 0d9d255d56b08aeaaffb1c820eef85266eb730cb5667e50681185ccf5cd7c882
- - arch == "i386":
+ - arch == "x86-32":
track: runtime/org.freedesktop.BaseSdk/i386/1.4
ref: 16036b747c1ec8e7fe291f5b1f667cb942f0267d08fcad962e9b7627d6cf1981
config:
diff --git a/doc/examples/flatpak-autotools/project.conf b/doc/examples/flatpak-autotools/project.conf
index 0296b22f6..401dc561a 100644
--- a/doc/examples/flatpak-autotools/project.conf
+++ b/doc/examples/flatpak-autotools/project.conf
@@ -10,6 +10,6 @@ options:
type: arch
description: The machine architecture
values:
- - x86_64
- - i386
+ - x86-64
+ - x86-32
diff --git a/tests/cachekey/cachekey.py b/tests/cachekey/cachekey.py
index 113f5bab0..c278b9ca9 100644
--- a/tests/cachekey/cachekey.py
+++ b/tests/cachekey/cachekey.py
@@ -144,7 +144,7 @@ DATA_DIR = os.path.join(
# The cache key test uses a project which exercises all plugins,
# so we cant run it at all if we dont have them installed.
#
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
reason='Cache keys depend on architecture')
@pytest.mark.skipif(not IS_LINUX, reason='Only available on linux')
@pytest.mark.skipif(HAVE_BZR is False, reason="bzr is not available")
diff --git a/tests/examples/autotools.py b/tests/examples/autotools.py
index e7ca8c5e9..8e4bf5a75 100644
--- a/tests/examples/autotools.py
+++ b/tests/examples/autotools.py
@@ -13,8 +13,8 @@ DATA_DIR = os.path.join(
# Tests a build of the autotools amhello project on a alpine-linux base runtime
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_autotools_build(cli, tmpdir, datafiles):
@@ -38,8 +38,8 @@ def test_autotools_build(cli, tmpdir, datafiles):
# Test running an executable built with autotools.
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_autotools_run(cli, tmpdir, datafiles):
diff --git a/tests/examples/developing.py b/tests/examples/developing.py
index 4bb7076c5..0a51802a9 100644
--- a/tests/examples/developing.py
+++ b/tests/examples/developing.py
@@ -14,8 +14,8 @@ DATA_DIR = os.path.join(
# Test that the project builds successfully
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_autotools_build(cli, tmpdir, datafiles):
@@ -37,8 +37,8 @@ def test_autotools_build(cli, tmpdir, datafiles):
# Test the unmodified hello command works as expected.
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_run_unmodified_hello(cli, tmpdir, datafiles):
@@ -70,8 +70,8 @@ def test_open_workspace(cli, tmpdir, datafiles):
# Test making a change using the workspace
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_make_change_in_workspace(cli, tmpdir, datafiles):
diff --git a/tests/examples/flatpak-autotools.py b/tests/examples/flatpak-autotools.py
index dbaf522a2..73910c5eb 100644
--- a/tests/examples/flatpak-autotools.py
+++ b/tests/examples/flatpak-autotools.py
@@ -32,8 +32,8 @@ def workaround_setuptools_bug(project):
# Test that a build upon flatpak runtime 'works' - we use the autotools sample
# amhello project for this.
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree')
@pytest.mark.datafiles(DATA_DIR)
def test_autotools_build(cli, tmpdir, datafiles):
@@ -57,8 +57,8 @@ def test_autotools_build(cli, tmpdir, datafiles):
# Test running an executable built with autotools
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_OSTREE, reason='Only available on linux with ostree')
@pytest.mark.datafiles(DATA_DIR)
def test_autotools_run(cli, tmpdir, datafiles):
diff --git a/tests/examples/integration-commands.py b/tests/examples/integration-commands.py
index f4b0405e0..71e383008 100644
--- a/tests/examples/integration-commands.py
+++ b/tests/examples/integration-commands.py
@@ -12,8 +12,8 @@ DATA_DIR = os.path.join(
)
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_integration_commands_build(cli, tmpdir, datafiles):
@@ -25,8 +25,8 @@ def test_integration_commands_build(cli, tmpdir, datafiles):
# Test running the executable
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_integration_commands_run(cli, tmpdir, datafiles):
diff --git a/tests/examples/junctions.py b/tests/examples/junctions.py
index 97c622bbd..753fa2dc0 100644
--- a/tests/examples/junctions.py
+++ b/tests/examples/junctions.py
@@ -13,8 +13,8 @@ DATA_DIR = os.path.join(
# Test that the project builds successfully
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_build(cli, tmpdir, datafiles):
@@ -25,8 +25,8 @@ def test_build(cli, tmpdir, datafiles):
# Test the callHello script works as expected.
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_shell_call_hello(cli, tmpdir, datafiles):
diff --git a/tests/examples/running-commands.py b/tests/examples/running-commands.py
index 3e679f9c2..61e23fd9c 100644
--- a/tests/examples/running-commands.py
+++ b/tests/examples/running-commands.py
@@ -12,8 +12,8 @@ DATA_DIR = os.path.join(
)
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_running_commands_build(cli, tmpdir, datafiles):
@@ -25,8 +25,8 @@ def test_running_commands_build(cli, tmpdir, datafiles):
# Test running the executable
-@pytest.mark.skipif(MACHINE_ARCH != 'x86_64',
- reason='Examples are writtent for x86_64')
+@pytest.mark.skipif(MACHINE_ARCH != 'x86-64',
+ reason='Examples are writtent for x86-64')
@pytest.mark.skipif(not IS_LINUX or not HAVE_BWRAP, reason='Only available on linux with bubblewrap')
@pytest.mark.datafiles(DATA_DIR)
def test_running_commands_run(cli, tmpdir, datafiles):
diff --git a/tests/format/list-directive-type-error/project.conf b/tests/format/list-directive-type-error/project.conf
index 1dd0f1b0a..79f73402b 100644
--- a/tests/format/list-directive-type-error/project.conf
+++ b/tests/format/list-directive-type-error/project.conf
@@ -4,4 +4,4 @@ options:
arch:
type: arch
description: Example architecture option
- values: [ x86_32, x86_64, aarch64 ]
+ values: [ x86-32, x86-64, aarch64 ] \ No newline at end of file
diff --git a/tests/format/option-arch/element.bst b/tests/format/option-arch/element.bst
index 4da01d889..2528d9170 100644
--- a/tests/format/option-arch/element.bst
+++ b/tests/format/option-arch/element.bst
@@ -2,7 +2,7 @@ kind: autotools
variables:
result: "Nothing"
(?):
- - machine_arch == "arm":
+ - machine_arch == "aarch32":
result: "Army"
- machine_arch == "aarch64":
result: "Aarchy"
diff --git a/tests/format/option-arch/project.conf b/tests/format/option-arch/project.conf
index a2c3ddf9a..8b94232cf 100644
--- a/tests/format/option-arch/project.conf
+++ b/tests/format/option-arch/project.conf
@@ -5,5 +5,5 @@ options:
type: arch
description: The machine architecture
values:
- - arm
+ - aarch32
- aarch64
diff --git a/tests/format/optionarch.py b/tests/format/optionarch.py
index 4c126aa87..901b6e2da 100644
--- a/tests/format/optionarch.py
+++ b/tests/format/optionarch.py
@@ -29,7 +29,7 @@ def override_uname_arch(name):
@pytest.mark.datafiles(DATA_DIR)
@pytest.mark.parametrize("uname,value,expected", [
# Test explicitly provided arches
- ('arm', 'arm', 'Army'),
+ ('arm', 'aarch32', 'Army'),
('arm', 'aarch64', 'Aarchy'),
# Test automatically derived arches
@@ -38,7 +38,7 @@ def override_uname_arch(name):
# Test that explicitly provided arches dont error out
# when the `uname` reported arch is not supported
- ('i386', 'arm', 'Army'),
+ ('i386', 'aarch32', 'Army'),
('x86_64', 'aarch64', 'Aarchy'),
])
def test_conditional(cli, datafiles, uname, value, expected):
diff --git a/tests/integration/base/generate-base.sh b/tests/integration/base/generate-base.sh
index d1ebd58ae..338c6d98f 100755
--- a/tests/integration/base/generate-base.sh
+++ b/tests/integration/base/generate-base.sh
@@ -9,7 +9,7 @@
set -eux
-ALPINE_ARCH=${ARCH:-x86_64}
+ALPINE_ARCH=${ARCH:-x86-64}
ALPINE_BASE=http://dl-cdn.alpinelinux.org/alpine/v3.7/releases/${ALPINE_ARCH}/alpine-minirootfs-3.7.0-${ALPINE_ARCH}.tar.gz
mkdir root
diff --git a/tests/integration/project/elements/base/base-alpine.bst b/tests/integration/project/elements/base/base-alpine.bst
index dd5ee7d88..c5833095d 100644
--- a/tests/integration/project/elements/base/base-alpine.bst
+++ b/tests/integration/project/elements/base/base-alpine.bst
@@ -9,7 +9,7 @@ sources:
- kind: tar
base-dir: ''
(?):
- - arch == "x86_64":
+ - arch == "x86-64":
ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
url: "alpine:integration-tests-base.v1.x86_64.tar.xz"
- arch == "aarch64":
diff --git a/tests/integration/project/project.conf b/tests/integration/project/project.conf
index e0475539a..726f65686 100644
--- a/tests/integration/project/project.conf
+++ b/tests/integration/project/project.conf
@@ -13,7 +13,7 @@ options:
type: arch
description: Current architecture
values:
- - x86_64
+ - x86-64
- aarch64
split-rules:
test:
diff --git a/tests/testutils/site.py b/tests/testutils/site.py
index 6c286e720..c7625cccf 100644
--- a/tests/testutils/site.py
+++ b/tests/testutils/site.py
@@ -5,6 +5,7 @@ import os
import sys
from buildstream import _site, utils, ProgramNotFoundError
+from buildstream._platform import Platform
try:
utils.get_host_tool('bzr')
@@ -52,4 +53,4 @@ except ImportError:
IS_LINUX = os.getenv('BST_FORCE_BACKEND', sys.platform).startswith('linux')
-_, _, _, _, MACHINE_ARCH = os.uname()
+MACHINE_ARCH = Platform.get_host_arch()