Skip to content
Snippets Groups Projects
Commit 72eb8ac0 authored by Simon McVittie's avatar Simon McVittie
Browse files

sanity-check: make this more usable as a manual test


Previously, this test didn't provide an obvious indication that it
had all succeeded, and assumed that it was run as root with $(pwd) in
/usr/lib/apertis-tests or a git clone of apertis-tests.

To use this as a manual test:

    Prerequisites:
        - apertis-tests installed (sudo apt install apertis-tests)
    Steps:
        sudo /usr/lib/apertis-tests/common/sanity-check
    Successful result:
        Output ends with "# Sanity check successful"
    Failing result:
        Output ends with "Failed, see above for details" or ends with
        neither of the expected messages
    Diagnosing failures:
        Look for "TEST_RESULT:fail:" in the output (it may appear more
        than once), and look for warnings/errors shortly before each
        occurrence of that message

Reviewed-by: default avatarLuis Araujo <luis.araujo@collabora.co.uk>
Reviewed-by: default avatarPhilip Withnall <philip.withnall@collabora.co.uk>
Signed-off-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D4284
parent 19ab43ef
No related branches found
No related tags found
No related merge requests found
......@@ -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:
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment