diff options
author | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2021-08-05 15:17:27 +0200 |
---|---|---|
committer | Benjamin Tissoires <benjamin.tissoires@gmail.com> | 2022-09-02 08:39:44 +0200 |
commit | a034a9f66b7ed5276cdd6da464a50eeee7f61f0c (patch) | |
tree | 450d85bc8a33116f03166726f935dd7b5d0baffd | |
parent | 46df4f588c3ee54e0f8cbe1f5f16b85423b121e1 (diff) | |
download | libinput-a034a9f66b7ed5276cdd6da464a50eeee7f61f0c.tar.gz |
CI: start a full systemd environment before running the testsuite
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | .gitlab-ci/ci.template | 2 | ||||
-rwxr-xr-x | .gitlab-ci/start-in-systemd.sh | 69 |
3 files changed, 71 insertions, 2 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 34272018..42c48ef9 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -406,7 +406,7 @@ freebsd:13.0@container-clean: B2C_KERNEL: https://gitlab.freedesktop.org/api/v4/projects/libevdev%2Fhid-tools/packages/generic/kernel-x86_64/v5.19/bzImage B2C_VERSION: v0.9.8 B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE - B2C_COMMAND: .gitlab-ci/meson-build.sh + B2C_COMMAND: .gitlab-ci/start-in-systemd.sh script: # pull b2c - curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/v0.9.8/vm2c.py diff --git a/.gitlab-ci/ci.template b/.gitlab-ci/ci.template index 1542b663..30885a66 100644 --- a/.gitlab-ci/ci.template +++ b/.gitlab-ci/ci.template @@ -282,7 +282,7 @@ check-commit: B2C_KERNEL: {{ b2c.kernel }} B2C_VERSION: {{ b2c.version }} B2C_IMAGE: $FDO_DISTRIBUTION_IMAGE - B2C_COMMAND: .gitlab-ci/meson-build.sh + B2C_COMMAND: .gitlab-ci/start-in-systemd.sh script: # pull b2c - curl -L -o /app/boot2container https://gitlab.freedesktop.org/mupuf/boot2container/-/raw/{{b2c.version}}/vm2c.py diff --git a/.gitlab-ci/start-in-systemd.sh b/.gitlab-ci/start-in-systemd.sh new file mode 100755 index 00000000..b505b206 --- /dev/null +++ b/.gitlab-ci/start-in-systemd.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +set -x + +systemd_target=basic.target +post_command="/usr/bin/systemctl exit \$EXIT_STATUS" + +while [[ $# -gt 0 ]]; do + case $1 in + --debug-mode) + shift + systemd_target=multi-user.target + post_command="echo you can now log in as root (no password) and then turn off by running \'/usr/bin/systemctl exit \$EXIT_STATUS\'" + ;; + *) + echo "Unknow commandline argument $1" + exit 1 + ;; + esac +done + +WORKDIR=${FDO_DISTRIBUTION_WORKINGDIR:-$PWD} +B2C_WORKDIR=${FDO_B2C_WORKDIR:-/app} + +# remove root password for debugging +sed -i 's/root:!locked::/root:::/' /etc/shadow + +# create a libinput test suite service +cat <<EOF > /etc/systemd/system/libinput-testsuite.service + +[Unit] +Description=Libinput test suite +After=$systemd_target + +[Service] +Type=simple +StandardOutput=journal+console +EnvironmentFile=$B2C_WORKDIR/.b2c_env +WorkingDirectory=$WORKDIR +ExecStart=$WORKDIR/.gitlab-ci/meson-build.sh + +# exit the container on termination +ExecStopPost=$post_command + +[Install] +WantedBy=default.target +EOF + +cat /etc/systemd/system/libinput-testsuite.service + +# enable the service +systemctl enable libinput-testsuite.service + +# disable some services we don't need in the CI +systemctl mask network-online.target +systemctl mask network-pre.target +systemctl mask timers.target +systemctl mask dnf-makecache.timer +systemctl mask systemd-logind.service +systemctl mask rpmdb-migrate.service +systemctl mask systemd-network-generator.service +systemctl mask cryptsetup-pre.target +systemctl mask cryptsetup.target + +#change default target +systemctl set-default $systemd_target + +# start the system +exec /usr/sbin/init |