diff --git a/common/sanity-check b/common/sanity-check index 18d153dcb8bb4892da8deab2310899af9aa578bd..9c3164598aa8e2a882760334dbfb26f7b66d0a9b 100755 --- a/common/sanity-check +++ b/common/sanity-check @@ -15,6 +15,14 @@ set -e +if [ "$(id -u)" != 0 ]; then + echo "This test must be run as root" >&2 + exit 1 +fi + +pkglibdir="$(cd "$(dirname $0)/.." && pwd)" +common="${pkglibdir}/common" + failed=0 fail () { @@ -35,12 +43,12 @@ getent passwd root || fail getent-passwd-root getent passwd user || fail getent-passwd-user env || fail lava-env -common/run-test-in-systemd --name=system-env common/sanity-check-env system || : -common/run-test-in-systemd --name=user-env --user=user common/sanity-check-env user || : +"$common/run-test-in-systemd" --name=system-env "$common/sanity-check-env" system || : +"$common/run-test-in-systemd" --name=user-env --user=user "$common/sanity-check-env" user || : id || fail lava-id -common/run-test-in-systemd --name=system-id id || : -common/run-test-in-systemd --name=user-id --user=user id || : +"$common/run-test-in-systemd" --name=system-id id || : +"$common/run-test-in-systemd" --name=user-id --user=user id || : test -S /run/dbus/system_bus_socket || fail system-bus-is-up test -d /run/user/$(id -u user)/systemd || fail user-session-is-up @@ -52,14 +60,17 @@ grep -E '^NAME=("?)Apertis\1$' /etc/os-release || fail os-release-name grep -E '^ID=("?)apertis\1$' /etc/os-release || fail os-release-id if ! test -S /run/user/$(id -u user)/wayland-0; then - common/run-test-in-systemd --user=user --name=x11-works -- xterm -e /bin/true + "$common/run-test-in-systemd" --user=user --name=x11-works -- xterm -e /bin/true fi +set +x # remaining commands run are uninteresting + if test "x$failed" != "x0"; then echo "Failed, see above for details" >&2 exit "$failed" fi +echo "# Sanity check successful" exit 0 # vim:set sw=4 sts=4 et: