Skip to content
Snippets Groups Projects
Commit 9f75c274 authored by Raoul Hidalgo Charman's avatar Raoul Hidalgo Charman
Browse files

optionarch.py: update to use same arch names as SandboxConfig

Also update tests to be consistent with this
parent 1ad35fcd
No related branches found
No related tags found
Loading
Pipeline #39776050 passed
Showing
with 43 additions and 43 deletions
......@@ -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):
......
......@@ -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:
......
......@@ -10,6 +10,6 @@ options:
type: arch
description: The machine architecture
values:
- x86_64
- i386
- x86-64
- x86-32
......@@ -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")
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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):
......
......@@ -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
......@@ -2,7 +2,7 @@ kind: autotools
variables:
result: "Nothing"
(?):
- machine_arch == "arm":
- machine_arch == "aarch32":
result: "Army"
- machine_arch == "aarch64":
result: "Aarchy"
......@@ -5,5 +5,5 @@ options:
type: arch
description: The machine architecture
values:
- arm
- aarch32
- aarch64
......@@ -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):
......
......@@ -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
......
......@@ -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":
......
......@@ -13,7 +13,7 @@ options:
type: arch
description: Current architecture
values:
- x86_64
- x86-64
- aarch64
split-rules:
test:
......
......@@ -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()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment