-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Our release process documentation recommends getting passing tox results on as many popular linux distributions as time allows. Doing this by hand is cumbersome, redundant, and error prone. Add a directory with a helper script that automates the entire process using docker compose and document its use in MAINTAINERS.rst. Signed-off-by: Martí Bolívar <mbolivar@amperecomputing.com>
- Loading branch information
1 parent
25bf6c4
commit 123e644
Showing
12 changed files
with
204 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Docker based testing | ||
-------------------- | ||
|
||
This directory contains helper files used for running west's tests in Docker on | ||
various Linux runtimes. It was originally developed for release testing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM archlinux:latest | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN pacman -Syu --noconfirm \ | ||
git \ | ||
python-pip \ | ||
&& pacman -Scc --noconfirm | ||
|
||
RUN pip3 install --break-system-packages tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# It would be nicer to consolidate the common user/volumes | ||
# boilerplate, but there wasn't enough time to figure out if it was | ||
# possible at time of writing. Improvements welcome. | ||
|
||
services: | ||
west-arch: | ||
build: arch | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/arch | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/arch | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west | ||
|
||
west-debian-12: | ||
build: debian-12 | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/debian-12 | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/debian-12 | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west | ||
|
||
west-debian-testing: | ||
build: debian-testing | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/debian-testing | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/debian-testing | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west | ||
|
||
west-fedora-38: | ||
build: fedora-38 | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/fedora-38 | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/fedora-38 | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west | ||
|
||
west-ubuntu-22.04: | ||
build: ubuntu-22.04 | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/ubuntu-22.04 | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/ubuntu-22.04 | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west | ||
|
||
west-ubuntu-23.04: | ||
build: ubuntu-23.04 | ||
environment: | ||
WEST_TOX_OUT: /west/docker-testing/outdir/ubuntu-23.04 | ||
WEST_TOX_OUT_IN_HOST: ${WEST_IN_HOST}/docker-testing/outdir/ubuntu-23.04 | ||
|
||
user: ${MY_UID}:${MY_GID} | ||
volumes: | ||
- /etc/passwd:/etc/passwd:ro | ||
- /etc/group:/etc/group:ro | ||
- ..:/west |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian:bookworm | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install --break-system-packages tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM debian:testing | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install --break-system-packages tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
FROM fedora:38 | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN dnf install -y \ | ||
git \ | ||
python3-pip \ | ||
&& dnf clean dbcache | ||
|
||
RUN pip3 install tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# This is the test script that runs in the containers themselves. | ||
|
||
WEST=/west | ||
|
||
die() { | ||
[ ! -z "$@" ] && echo "error: $@" >&2 | ||
exit 1 | ||
} | ||
|
||
# Verify the container environment set up meets this script's requirements. | ||
[ ! -z "$WEST_TOX_OUT" ] || die "missing $WEST_TOX_OUT" | ||
[ ! -z "$WEST_TOX_OUT_IN_HOST" ] || die "missing $WEST_TOX_OUT_IN_HOST" | ||
[ -d "$WEST" ] || die "missing $WEST in the container" | ||
|
||
TOX_LOG="$WEST_TOX_OUT/tox.log" | ||
TOX_LOG_IN_HOST="$WEST_TOX_OUT_IN_HOST/tox.log" | ||
WEST_TESTDIR="/tmp/west" | ||
|
||
mkdir "$WEST_TOX_OUT" || die "failed to make $WEST_TOX_OUT in container ($WEST_TOX_OUT_IN_HOST in host)" | ||
|
||
git clone -q "$WEST" "$WEST_TESTDIR" || die "failed to clone west to $WEST_TESTDIR in container" | ||
cd "$WEST_TESTDIR" | ||
|
||
echo "running tox, output in $TOX_LOG_IN_HOST in host" | ||
tox run >"$TOX_LOG" 2>&1 || die "tox failed" | ||
|
||
cp -R htmlcov "$WEST_TOX_OUT" || die "failed to copy coverage to $WEST_TOX_OUT_IN_HOST/htmlcov in host" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# This is the top-level test script that runs in the host. | ||
|
||
HERE=$(dirname "$0") | ||
|
||
[ -d "$HERE/outdir" ] && rm -r "$HERE/outdir" | ||
|
||
set -e | ||
mkdir "$HERE/outdir" | ||
export MY_UID=$(id -u) | ||
export MY_GID=$(id -g) | ||
export WEST_IN_HOST=$(realpath "$HERE/..") | ||
docker-compose up --force-recreate --build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:22.04 | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install tox |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:23.04 | ||
CMD ["/west/docker-testing/in-container-test.sh"] | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y \ | ||
git \ | ||
python3-pip \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN pip3 install --break-system-packages tox |