Skip to content

Commit 0352ec9

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

29 files changed

+495
-212
lines changed

.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: 56 additions & 2 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():
@@ -43,8 +49,6 @@ install: |
4349
| sed 's!^!/!' \
4450
| rsync \
4551
--archive \
46-
--verbose \
47-
--progress \
4852
--exclude "/revng/" \
4953
--exclude "/include/" \
5054
--exclude "/share/man/" \
@@ -132,6 +136,56 @@ install: |
132136
cd "${TMP_ROOT}${ORCHESTRA_ROOT}"
133137
find . -not -type d -not -path './revng/*' -delete
134138
find . -type d -empty -delete
139+
140+
if test "$RUN_TESTS" -eq 1; then
141+
# CI can't run Docker-in-Docker (or Podman-in-Docker)
142+
# We can only test by spawning a local Xvfb server
143+
if [[ ! -z "${GITLAB_CI:-}" ]]; then
144+
export USE_XVFB=1
145+
cd "${TMP_ROOT}${ORCHESTRA_ROOT}/revng"
146+
"$ORCHESTRA_DOTDIR/support/revng-distributable/test.sh"
147+
148+
elif [[ "$COLD_REVNG_TEST_METHOD" == host-* ]]; then
149+
if [[ "$COLD_REVNG_TEST_METHOD" == "host-xvfb" ]]; then
150+
export USE_XVFB=1
151+
fi
152+
cd "${TMP_ROOT}${ORCHESTRA_ROOT}/revng"
153+
154+
export COLD_REVNG_KILL_METHOD=wmctrl
155+
"$ORCHESTRA_DOTDIR/support/revng-distributable/test.sh"
156+
157+
else
158+
if [[ "$COLD_REVNG_TEST_METHOD" == "podman-forward-x11" ]]; then
159+
# Remember: the host must allow access to the X11 socket! (xhost +)
160+
PODMAN_OPTIONS="-v /tmp/.X11-unix:/tmp/.X11-unix"
161+
else
162+
PODMAN_OPTIONS="-e USE_XVFB=1"
163+
fi
164+
165+
for DOCKERFILE in $ORCHESTRA_DOTDIR/support/revng-distributable/dockers/*.docker; do
166+
DISTRO="$(basename "${DOCKERFILE%%.docker}")"
167+
IMAGE_NAME="revng-test-image:$DISTRO"
168+
169+
echo "Testing revng-distributable in $DISTRO"
170+
podman build --pull -t "$IMAGE_NAME" -f "$DOCKERFILE"
171+
# TODO: fix the test environment so that we can properly close revng-ui without using kill
172+
if ! podman run -t --rm $PODMAN_OPTIONS \
173+
--security-opt=seccomp=unconfined \
174+
-e "COLD_REVNG_KILL_METHOD=kill" \
175+
-w "/orchestra/.orchestra/$(realpath --relative-to "$ORCHESTRA_DOTDIR" "$TMP_ROOT")/$ORCHESTRA_ROOT/revng" \
176+
-v "$(readlink -f "$ORCHESTRA_DOTDIR/..")":/orchestra \
177+
"$IMAGE_NAME" \
178+
bash -c /orchestra/.orchestra/support/revng-distributable/test.sh;
179+
then
180+
echo "[!] $IMAGE_NAME test failed"
181+
exit 1
182+
else
183+
echo "[+] $IMAGE_NAME test passed"
184+
fi
185+
done
186+
echo "[+] revng-distributable tests passed"
187+
fi
188+
fi
135189
build_dependencies:
136190
- ui/cold-revng
137191
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: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Status of revng-distributable tests
2+
3+
## How to run the tests
4+
5+
To run revng-distributable tests, use `orc install --test revng-distributable`.
6+
By default, tests are run on all supported distros using podman and xvfb.
7+
The test mode can be changed by adding the following to `user_options.yml`:
8+
9+
```yml
10+
#@overlay/replace
11+
cold_revng_test_method: podman-xvfb
12+
```
13+
14+
See the supported test modes in `revng_distributable.yml`.
15+
16+
## Known-working test modes
17+
18+
The tests work on the following distros (podman+xvfb):
19+
20+
- Archlinux
21+
- Centos {7,8}
22+
- Debian {7,8,9,10}
23+
- Fedora {29,30,31,32}
24+
- Opensuse 15.2
25+
- Ubuntu {16,18,20}.04
26+
- Voidlinux
27+
28+
The tests also work running revng-ui directly on the host, using the running X11 server (`host-x11` test mode)
29+
30+
## Broken distros
31+
32+
- gentoo: need to revise the scripts which install dependencies
33+
- opensuse 15.{0,1}: zypper segfaults
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM archlinux
22

33
COPY install-revng-dependencies /
4-
RUN /install-revng-dependencies
4+
RUN /install-revng-dependencies --include-test-dependencies
55

66
ENV DISPLAY=:0
77
ENV QT_DEBUG_PLUGINS=1
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FROM gentoo/stage3-amd64 AS base-gentoo
2+
3+
COPY install-revng-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
8+
RUN echo "sys-auth/elogind" >> "/etc/portage/package.mask"
9+
RUN /install-revng-dependencies --include-test-dependencies
10+
11+
ENV DISPLAY=:0
12+
ENV QT_DEBUG_PLUGINS=1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM opensuse/leap:15.0
22

33
COPY install-revng-dependencies /
4-
RUN /install-revng-dependencies
4+
RUN /install-revng-dependencies --include-test-dependencies
55

66
ENV DISPLAY=:0
77
ENV QT_DEBUG_PLUGINS=1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM opensuse/leap:15.1
22

33
COPY install-revng-dependencies /
4-
RUN /install-revng-dependencies
4+
RUN /install-revng-dependencies --include-test-dependencies
55

66
ENV DISPLAY=:0
77
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

.orchestra/support/revng-distributable/dockers/centos-7.docker

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM centos:7
22

33
COPY install-revng-dependencies /
44
RUN echo '00000000000000000000000000000000' > /etc/machine-id && \
5-
/install-revng-dependencies
5+
/install-revng-dependencies --include-test-dependencies
66

77
ENV DISPLAY=:0
88
ENV QT_DEBUG_PLUGINS=1

0 commit comments

Comments
 (0)