Skip to content

Commit ed64de4

Browse files
author
Filippo Cremonese
committed
Integrate revng-distributable tests with orchestra
1 parent f5ce701 commit ed64de4

33 files changed

+447
-78
lines changed

.orchestra/ci/install-dependencies.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ apt-get -qq install --no-install-recommends --yes \
4747
wget \
4848
zlib1g-dev
4949

50+
# Dependencies for testing cold-revng
51+
apt-get install -y \
52+
fluxbox \
53+
xvfb \
54+
wmctrl \
55+
5056
# Dependencies for Qt
5157
apt-get -qq install --no-install-recommends --yes \
5258
gperf \

.orchestra/config/components.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ environment:
2222
- HARD_FLAGS_LINK: #@ str(datavalue("hard_flags_link"))
2323
- HARD_FLAGS_LINK_LATE: #@ str(datavalue("hard_flags_link_late"))
2424
- HARD_FLAGS_LINK_GOLD: #@ str(datavalue("hard_flags_link_gold"))
25+
- COLD_REVNG_TEST_METHOD: #@ str(datavalue("cold_revng_test_method"))
2526
- "-LD_LIBRARY_PATH": ""
2627
- "-COMPILER_PATH": ""
2728
- "-CPATH": ""

.orchestra/config/components/revng_distributable.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#@ load("@ytt:overlay", "overlay")
22
#@ load("/lib/create_component.lib.yml", "single_build_component")
33

4+
#! Possible values for the cold_revng_test_method user option:
5+
#! - host-xvfb: run the tests on the host machine, using xvfb and fluxbox
6+
#! - host-x11: run the tests on the host machine, using the host running X11 and window manager
7+
#! - podman-xvbf: run the tests on all the distros using podman and xvfb
8+
#! - podman-forward-x11: run the tests on all the distros, forwarding the host X11 server
9+
410
#@yaml/text-templated-strings
511
---
612
#@ def revng_distributable():
@@ -132,6 +138,55 @@ install: |
132138
cd "${TMP_ROOT}${ORCHESTRA_ROOT}"
133139
find . -not -type d -not -path './revng/*' -delete
134140
find . -type d -empty -delete
141+
142+
if test "$RUN_TESTS" -eq 1; then
143+
# CI can't run Docker-in-Docker (or Podman-in-Docker)
144+
# We can only test by spawning a local Xvfb server
145+
if [[ ! -z "${GITLAB_CI:-}" ]]; then
146+
export USE_XVFB=1
147+
cd "${TMP_ROOT}${ORCHESTRA_ROOT}/revng"
148+
"$ORCHESTRA_DOTDIR/support/revng-distributable/test.sh"
149+
150+
elif [[ "$COLD_REVNG_TEST_METHOD" == host-* ]]; then
151+
if [[ "$COLD_REVNG_TEST_METHOD" == "host-xvfb" ]]; then
152+
export USE_XVFB=1
153+
fi
154+
cd "${TMP_ROOT}${ORCHESTRA_ROOT}/revng"
155+
156+
export COLD_REVNG_KILL_METHOD=wmctrl
157+
"$ORCHESTRA_DOTDIR/support/revng-distributable/test.sh"
158+
159+
else
160+
if [[ "$COLD_REVNG_TEST_METHOD" == "podman-forward-x11" ]]; then
161+
# Remember: the host must allow access to the X11 socket! (xhost +)
162+
PODMAN_OPTIONS="-v /tmp/.X11-unix:/tmp/.X11-unix"
163+
else
164+
PODMAN_OPTIONS="-e USE_XVFB=1"
165+
fi
166+
167+
for DOCKERFILE in $ORCHESTRA_DOTDIR/support/revng-distributable/dockers/*.docker; do
168+
DISTRO="$(basename "${DOCKERFILE%%.docker}")"
169+
IMAGE_NAME="revng-test-image:$DISTRO"
170+
171+
echo "Testing revng-distributable in $DISTRO"
172+
podman build --pull -t "$IMAGE_NAME" -f "$DOCKERFILE"
173+
if ! podman run -t --rm $PODMAN_OPTIONS \
174+
--security-opt=seccomp=unconfined \
175+
-e "COLD_REVNG_KILL_METHOD=kill" \
176+
-w "/orchestra/.orchestra/$(realpath --relative-to "$ORCHESTRA_DOTDIR" "$TMP_ROOT")/$ORCHESTRA_ROOT/revng" \
177+
-v "$(readlink -f "$ORCHESTRA_DOTDIR/..")":/orchestra \
178+
"$IMAGE_NAME" \
179+
bash -c /orchestra/.orchestra/support/revng-distributable/test.sh;
180+
then
181+
echo "[!] $IMAGE_NAME test failed"
182+
exit 1
183+
else
184+
echo "[+] $IMAGE_NAME test passed"
185+
fi
186+
done
187+
echo "[+] revng-distributable tests passed"
188+
fi
189+
fi
135190
build_dependencies:
136191
- ui/cold-revng
137192
skip_post_install: true

.orchestra/config/global_options.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,6 @@ branches:
3636
- develop
3737
- master
3838
nonredistributable_base_url: "https://dummydomain.com/nonredistributable/"
39+
40+
#! see cold-revng component for the list of admissible test methods
41+
cold_revng_test_method: podman-xvfb
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Status of revng-distributable tests
2+
3+
## Broken distros
4+
5+
- gentoo: need to revise the scripts which install dependencies
6+
- opensuse 15.{0,1}: zypper segfaults
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
FROM archlinux
22

3-
COPY install-revng-dependencies /
4-
RUN /install-revng-dependencies
3+
COPY install-revng-dependencies install-test-dependencies /
4+
RUN /install-revng-dependencies && \
5+
/install-test-dependencies
56

67
ENV DISPLAY=:0
78
ENV QT_DEBUG_PLUGINS=1
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM gentoo/stage3-amd64 AS base-gentoo
2+
3+
COPY install-revng-dependencies install-test-dependencies /
4+
RUN echo 'FEATURES="$FEATURES -sandbox -usersandbox -ipc-sandbox -network-sandbox -pid-sandbox"' >> /etc/portage/make.conf
5+
RUN emerge-webrsync
6+
7+
FROM base-gentoo AS gentoo-with-revng-dependencies
8+
RUN /install-revng-dependencies
9+
10+
FROM gentoo-with-revng-dependencies
11+
RUN echo "sys-auth/elogind" >> "/etc/portage/package.mask"
12+
RUN /install-test-dependencies
13+
14+
ENV DISPLAY=:0
15+
ENV QT_DEBUG_PLUGINS=1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM opensuse/leap:15.0
2+
3+
COPY install-revng-dependencies install-test-dependencies /
4+
RUN /install-revng-dependencies && \
5+
/install-test-dependencies
6+
7+
ENV DISPLAY=:0
8+
ENV QT_DEBUG_PLUGINS=1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM opensuse/leap:15.1
2+
3+
COPY install-revng-dependencies install-test-dependencies /
4+
RUN /install-revng-dependencies && \
5+
/install-test-dependencies
6+
7+
ENV DISPLAY=:0
8+
ENV QT_DEBUG_PLUGINS=1

.orchestra/support/revng-distributable/dockers/build-all

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
set -x
44
set -e
55

6-
FILES=$(find -name "*.docker")
6+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
FILES=$(find "$DIR" -name "*.docker")
78

89
for FILE in $FILES; do
9-
./build $(basename "${FILE%.*}")
10+
FILE_PATH=$(realpath "$FILE")
11+
"$DIR/build" "$(basename "${FILE%.*}")"
1012
done

0 commit comments

Comments
 (0)