|
1 | 1 | #@ load("@ytt:overlay", "overlay") |
2 | 2 | #@ load("/lib/create_component.lib.yml", "single_build_component") |
3 | 3 |
|
| 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 | + |
4 | 10 | #@yaml/text-templated-strings |
5 | 11 | --- |
6 | 12 | #@ def revng_distributable(): |
@@ -43,8 +49,6 @@ install: | |
43 | 49 | | sed 's!^!/!' \ |
44 | 50 | | rsync \ |
45 | 51 | --archive \ |
46 | | - --verbose \ |
47 | | - --progress \ |
48 | 52 | --exclude "/revng/" \ |
49 | 53 | --exclude "/include/" \ |
50 | 54 | --exclude "/share/man/" \ |
@@ -132,6 +136,56 @@ install: | |
132 | 136 | cd "${TMP_ROOT}${ORCHESTRA_ROOT}" |
133 | 137 | find . -not -type d -not -path './revng/*' -delete |
134 | 138 | 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 |
135 | 189 | build_dependencies: |
136 | 190 | - ui/cold-revng |
137 | 191 | skip_post_install: true |
|
0 commit comments