* [PATCH 2/7] ci: container: add kvx-elf- toolchain
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
@ 2024-08-13 7:01 ` Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 3/7] ci: container: update to newest Labgrid release Ahmad Fatoum
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:01 UTC (permalink / raw)
To: barebox; +Cc: Yann Sionneau, Ahmad Fatoum
ARCH=kvx build has been broken in the past, because it was the only
barebox platform that wasn't build tested.
There are prebuilt toolchains of acceptable footprint (64M compressed),
so let's integrate them into the image, so we can add it to build test.
There's no prebuilt Qemu unfortunately, so actually testing the result
will have to wait.
Acked-by: Yann Sionneau <ysionneau@kalrayinc.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- Added Yann's A-b
---
test/Containerfile | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/test/Containerfile b/test/Containerfile
index 06d155bf4d28..2f8c969d824f 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -60,6 +60,13 @@ RUN korg_crosstool_dl() { wget -nv -O - https://mirrors.edge.kernel.org/pub/tool
korg_crosstool_dl x86_64 ${GCC_VERSION} powerpc-linux && \
korg_crosstool_dl x86_64 ${GCC_VERSION} riscv64-linux
+RUN wget -O kvx.tgz https://github.com/kalray/build-scripts/releases/download/v5.0.0/gcc-kalray-kvx-ubuntu-22.04-v5.0.0.tar.gz
+
+RUN echo "d27b3d6e6246f5debffee0bb01e77eb133bd32c658782a68a779cf9fb4c436bc kvx.tgz" | \
+ sha256sum --check --status
+
+RUN tar -C /opt -xzf kvx.tgz && rm kvx.tgz
+
RUN wget "https://github.com/qemu/qemu/blob/v5.2.0/pc-bios/opensbi-riscv32-generic-fw_dynamic.bin?raw=true" -O /usr/share/qemu/opensbi-riscv32-generic-fw_dynamic.bin
# Create our user/group
@@ -79,5 +86,6 @@ ENV CROSS_COMPILE_mips=/opt/gcc-${GCC_VERSION}-nolibc/mips-linux/bin/mips-linux-
ENV CROSS_COMPILE_openrisc=/opt/gcc-${GCC_VERSION}-nolibc/or1k-linux/bin/or1k-linux-
ENV CROSS_COMPILE_powerpc=/opt/gcc-${GCC_VERSION}-nolibc/powerpc-linux/bin/powerpc-linux-
ENV CROSS_COMPILE_riscv=/opt/gcc-${GCC_VERSION}-nolibc/riscv64-linux/bin/riscv64-linux-
+ENV CROSS_COMPILE_kvx=/opt/gcc-kalray-kvx-v5.0.0/bin/kvx-elf-
USER barebox:barebox
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/7] ci: container: update to newest Labgrid release
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 2/7] ci: container: add kvx-elf- toolchain Ahmad Fatoum
@ 2024-08-13 7:01 ` Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 4/7] test: sandbox: support testing with Labgrid Ahmad Fatoum
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:01 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
This new Labgrid release enables us to run Labgrid tests against the
sandbox architecture and integrates Labgrid pull requests that fix
stuff we have been monkey patching so far.
Let's update in preparation for making use of this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- update to new v24.0 release instead of commit on master
---
test/Containerfile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Containerfile b/test/Containerfile
index 2f8c969d824f..23f33dc8d7ff 100644
--- a/test/Containerfile
+++ b/test/Containerfile
@@ -75,7 +75,7 @@ RUN echo barebox ALL=NOPASSWD: ALL > /etc/sudoers.d/barebox
# install labgrid
RUN cd /tmp && \
- git clone --depth 1 -b v23.0 https://github.com/labgrid-project/labgrid && \
+ git clone --depth 1 -b v24.0 https://github.com/labgrid-project/labgrid && \
cd labgrid && \
pip3 install --break-system-packages . && \
ln -s $(which pytest) /usr/local/bin/labgrid-pytest;
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/7] test: sandbox: support testing with Labgrid
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 2/7] ci: container: add kvx-elf- toolchain Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 3/7] ci: container: update to newest Labgrid release Ahmad Fatoum
@ 2024-08-13 7:01 ` Ahmad Fatoum
2024-08-13 7:01 ` [PATCH 5/7] ci: pytest: test sandbox configuration with labgrid Ahmad Fatoum
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:01 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
From: Bastian Krause <bst@pengutronix.de>
It turns out there is already support in Labgrid to execute an
interactive console application and run tests against it.
Switch our test/sandbox/sandbox_defconfig.yaml to use this, so we can
eventually test sandbox in CI as well.
For proper operation, we require that labgrid doesn't buffer output
of the barebox sandbox process, which was recently fixed in [1].
[1]: https://github.com/labgrid-project/labgrid/pull/1440
Signed-off-by: Bastian Krause <bst@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
test/emulate.pl | 6 +++---
test/sandbox/sandbox_defconfig.yaml | 17 ++++++++++-------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/test/emulate.pl b/test/emulate.pl
index 086fae0f7708..df21d5c727bf 100755
--- a/test/emulate.pl
+++ b/test/emulate.pl
@@ -340,12 +340,12 @@ sub emulate {
vsystem($temu{temu_bin}, "tinyemu.cfg", @OPTS) == 0
or die "Error running emulator: $?\n";
- } elsif (defined $target{drivers}{NativeExecutableDriver}) {
- my %exec = %{$target{drivers}{NativeExecutableDriver}};
+ } elsif (defined $target{drivers}{ExternalConsoleDriver}) {
+ my %exec = %{$target{drivers}{ExternalConsoleDriver}};
pushd($args{builddir}) if $tuxmake;
- vsystem($exec{command}, @OPTS) == 0 or die "Error running emulator: $?\n";
+ vsystem($exec{cmd}, @OPTS) == 0 or die "Error running emulator: $?\n";
}
popd() if $tuxmake;
diff --git a/test/sandbox/sandbox_defconfig.yaml b/test/sandbox/sandbox_defconfig.yaml
index 784f49146605..eb9ab7f17a55 100644
--- a/test/sandbox/sandbox_defconfig.yaml
+++ b/test/sandbox/sandbox_defconfig.yaml
@@ -1,12 +1,15 @@
targets:
main:
drivers:
- NativeExecutableDriver: # not yet supported by labgrid, only for interactive use
- command: ./barebox
- image: barebox
+ ExternalConsoleDriver:
+ cmd: !template "$LG_BUILDDIR/barebox"
+ ExternalPowerDriver:
+ cmd_on: 'true'
+ cmd_off: 'true'
+ BareboxDriver:
+ prompt: "barebox@[^:]+:[^ ]+ "
+ BareboxTestStrategy: {}
runner:
tuxmake_arch: um
-images:
- barebox: !template "$LG_BUILDDIR/barebox"
-tools:
- qemu: /usr/local/bin/temu
+imports:
+ - ../strategy.py
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/7] ci: pytest: test sandbox configuration with labgrid
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
` (2 preceding siblings ...)
2024-08-13 7:01 ` [PATCH 4/7] test: sandbox: support testing with Labgrid Ahmad Fatoum
@ 2024-08-13 7:01 ` Ahmad Fatoum
2024-08-13 7:02 ` [PATCH 6/7] ci: build: add kvx build test Ahmad Fatoum
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:01 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Now that we updated to a Labgrid version that can test sandbox barebox
and changed our environment YAML to use it, let's test this in CI.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
.github/workflows/test-labgrid-pytest.yml | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/test-labgrid-pytest.yml b/.github/workflows/test-labgrid-pytest.yml
index 2e038e371f1e..70bc570f005b 100644
--- a/.github/workflows/test-labgrid-pytest.yml
+++ b/.github/workflows/test-labgrid-pytest.yml
@@ -47,6 +47,10 @@ jobs:
lgenv: 'test/riscv/qemu-virt64@rv64i_defconfig.yaml'
defconfig: rv64i_defconfig
+ - ARCH: sandbox
+ lgenv: 'test/sandbox/sandbox_defconfig.yaml'
+ defconfig: sandbox_defconfig
+
steps:
- name: Checkout code
uses: actions/checkout@v4
@@ -68,7 +72,7 @@ jobs:
export KBUILD_OUTPUT=build-${{matrix.arch}}
for i in ${{matrix.lgenv}}; do
- grep -wqe QEMUDriver: "$i" || continue
+ grep -wq '\(QEMUDriver\|ExternalConsoleDriver\): "$i" || continue
cfg=$(basename $i .yaml)
echo "Testing $cfg"
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 6/7] ci: build: add kvx build test
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
` (3 preceding siblings ...)
2024-08-13 7:01 ` [PATCH 5/7] ci: pytest: test sandbox configuration with labgrid Ahmad Fatoum
@ 2024-08-13 7:02 ` Ahmad Fatoum
2024-08-13 7:02 ` [PATCH 7/7] test: py: strategy: drop no longer needed labgrid workarounds Ahmad Fatoum
2024-08-14 7:49 ` [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:02 UTC (permalink / raw)
To: barebox; +Cc: Ahmad Fatoum
Now that we ship a toolchain for Kalray's MPPA Coolidge CPU, let's
enable build test on that architecture as well.
With this, all architectures now have defconfigs that are build tested.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- no change
---
.github/workflows/build-defconfigs.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/build-defconfigs.yml b/.github/workflows/build-defconfigs.yml
index 46f59fd118c1..f8cb7c2a5929 100644
--- a/.github/workflows/build-defconfigs.yml
+++ b/.github/workflows/build-defconfigs.yml
@@ -3,7 +3,7 @@ name: build images
on: [push, pull_request]
env:
- ARCH: arm mips powerpc riscv sandbox x86 openrisc
+ ARCH: arm mips powerpc riscv sandbox x86 openrisc kvx
jobs:
defconfigs:
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 7/7] test: py: strategy: drop no longer needed labgrid workarounds
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
` (4 preceding siblings ...)
2024-08-13 7:02 ` [PATCH 6/7] ci: build: add kvx build test Ahmad Fatoum
@ 2024-08-13 7:02 ` Ahmad Fatoum
2024-08-14 7:49 ` [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Ahmad Fatoum @ 2024-08-13 7:02 UTC (permalink / raw)
To: barebox; +Cc: Rouven Czerwinski, Ahmad Fatoum
We were monkey patching in support for following two Labgrid pull
requests:
- #1166 ("config: return passed in tool by default")
- #1212 ("qemudriver: export get_qemu_base_args method")
Both are now part of the newest v24.0 release, so let's drop our
workaround and require that at least Labgrid v24.0 is used.
[1]: https://github.com/labgrid-project/labgrid/commit/69fd553c69
[2]: https://github.com/labgrid-project/labgrid/commit/318e7788ce
Cc: Rouven Czerwinski <r.czerwinski@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
v1 -> v2:
- new patch
---
test/strategy.py | 53 ++++++++----------------------------------------
1 file changed, 8 insertions(+), 45 deletions(-)
diff --git a/test/strategy.py b/test/strategy.py
index 8aa58151f6b8..4063b8ff818b 100644
--- a/test/strategy.py
+++ b/test/strategy.py
@@ -6,9 +6,16 @@ import subprocess
import os
import shutil
import sys
+import re
from labgrid import target_factory, step, driver
from labgrid.strategy import Strategy, StrategyError
+from labgrid.util import labgrid_version
+
+match = re.match(r'^(\d+?)\.', labgrid_version())
+if match is None or int(match.group(1)) < 24:
+ pytest.exit(f"Labgrid has version v{labgrid_version()}, "
+ f"but barebox test suite requires at least v24.")
class Status(enum.Enum):
unknown = 0
@@ -34,7 +41,6 @@ class BareboxTestStrategy(Strategy):
super().__attrs_post_init__()
if isinstance(self.console, driver.QEMUDriver):
self.qemu = self.console
- self.patchtools()
@step(args=['status'])
def transition(self, status, *, step):
@@ -67,7 +73,7 @@ class BareboxTestStrategy(Strategy):
self.transition(Status.off) # pylint: disable=missing-kwoa
if state == "qemu_dry_run" or state == "qemu_interactive":
- cmd = self.get_qemu_base_args()
+ cmd = self.qemu.get_qemu_base_args()
cmd.append("-serial")
cmd.append("mon:stdio")
@@ -84,44 +90,6 @@ class BareboxTestStrategy(Strategy):
else:
pytest.exit('Can only force to: qemu_dry_run, qemu_interactive')
- def get_qemu_base_args(self):
- if self.qemu is None:
- pytest.exit('interactive mode only supported with QEMUDriver')
-
- try:
- # https://github.com/labgrid-project/labgrid/pull/1212
- cmd = self.qemu.get_qemu_base_args()
- except AttributeError:
- self.qemu.on_activate()
- orig = self.qemu._cmd
- cmd = []
-
- list_iter = enumerate(orig)
- for i, opt in list_iter:
- if opt == "-S":
- continue
- opt2 = double_opt(opt, orig, i)
- if (opt2.startswith("-chardev socket,id=serialsocket") or
- opt2 == "-serial chardev:serialsocket" or
- opt2 == "-qmp stdio"):
- # skip over two elements at once
- next(list_iter, None)
- continue
-
- cmd.append(opt)
-
- return cmd
-
- def patchtools(self):
- # https://github.com/labgrid-project/labgrid/commit/69fd553c6969526b609d0be6bb81f0c35f08d1d0
- if self.qemu is None:
- return
-
- if 'tools' not in self.target.env.config.data:
- self.target.env.config.data['tools'] = {}
- self.target.env.config.data["tools"][self.qemu.qemu_bin] = \
- shutil.which(self.qemu.qemu_bin)
-
def append_qemu_args(self, *args):
if self.qemu is None:
pytest.exit('Qemu option supplied for non-Qemu target')
@@ -131,8 +99,3 @@ class BareboxTestStrategy(Strategy):
def quote_cmd(cmd):
quoted = map(lambda s : s if s.find(" ") == -1 else "'" + s + "'", cmd)
return " ".join(quoted)
-
-def double_opt(opt, orig, i):
- if opt == orig[-1]:
- return opt
- return " ".join([opt, orig[i + 1]])
--
2.39.2
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0
2024-08-13 7:01 [PATCH 1/7] ci: container: update to Debian Bookworm with GCC v14.2.0 Ahmad Fatoum
` (5 preceding siblings ...)
2024-08-13 7:02 ` [PATCH 7/7] test: py: strategy: drop no longer needed labgrid workarounds Ahmad Fatoum
@ 2024-08-14 7:49 ` Sascha Hauer
6 siblings, 0 replies; 8+ messages in thread
From: Sascha Hauer @ 2024-08-14 7:49 UTC (permalink / raw)
To: barebox, Ahmad Fatoum
On Tue, 13 Aug 2024 09:01:55 +0200, Ahmad Fatoum wrote:
> We have been using the same distro/toolchain for more than a year now,
> so let's update them to their newest versions.
>
> pip3 now warns that we are not in a venv. Acknowledge this and ignore
> it as we want labgrid to be available to pytest in the container without
> having to source a virtualenv first.
>
> [...]
Applied, thanks!
[1/7] ci: container: update to Debian Bookworm with GCC v14.2.0
https://git.pengutronix.de/cgit/barebox/commit/?id=7a24da87b1a9 (link may not be stable)
[2/7] ci: container: add kvx-elf- toolchain
https://git.pengutronix.de/cgit/barebox/commit/?id=9bb6c933685c (link may not be stable)
[3/7] ci: container: update to newest Labgrid release
https://git.pengutronix.de/cgit/barebox/commit/?id=747dee2bf2a5 (link may not be stable)
[4/7] test: sandbox: support testing with Labgrid
https://git.pengutronix.de/cgit/barebox/commit/?id=fee23792aa75 (link may not be stable)
[5/7] ci: pytest: test sandbox configuration with labgrid
https://git.pengutronix.de/cgit/barebox/commit/?id=fd84dfd0f99a (link may not be stable)
[6/7] ci: build: add kvx build test
https://git.pengutronix.de/cgit/barebox/commit/?id=7346b5ff3f30 (link may not be stable)
[7/7] test: py: strategy: drop no longer needed labgrid workarounds
https://git.pengutronix.de/cgit/barebox/commit/?id=6f37e5c2a4aa (link may not be stable)
Best regards,
--
Sascha Hauer <s.hauer@pengutronix.de>
^ permalink raw reply [flat|nested] 8+ messages in thread