Skip to content
Snippets Groups Projects
Commit 57242f89 authored by Simon McVittie's avatar Simon McVittie Committed by Sjoerd Simons
Browse files

sanity-check: split out into a separate shell script


This makes it easier to run outside LAVA.

No functional changes intended, even where the checks I'm copying
are wrong (which will be fixed in subsequent commits).

Signed-off-by: default avatarSimon McVittie <simon.mcvittie@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D3647
parent 18faab06
No related branches found
No related tags found
No related merge requests found
#!/bin/sh
# sanity-check
#
# Verify that the Apertis system basically works.
#
# Please add more basic checks here as you run into situations where they fail
# Copyright © 2015-2016 Collabora Ltd.
#
# SPDX-License-Identifier: MPL-2.0
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -e
failed=0
fail () {
failed=1
tag="$1"
shift
echo "TEST_RESULT:fail:$tag:$*" >&2
}
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 || :
id || fail lava-id
common/run-test-in-systemd --name=system-id id || :
common/run-test-in-systemd --name=user-id 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
test -S /run/user/$(id -u user)/bus || fail user-bus-is-up
test -e /etc/debian_version || fail has-debian_version
cat /etc/os-release || fail os-release
# These two should really test for Apertis, but that would currently
# fail - see https://phabricator.apertis.org/T133 - so they also
# allow Ubuntu
grep -E '^NAME=("?)(Apertis|Ubuntu)\1$' /etc/os-release || fail os-release-name
grep -E '^ID=("?)(apertis|ubuntu)\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
fi
if test "x$failed" != "x0"; then
echo "Failed, see above for details" >&2
exit "$failed"
fi
exit 0
# vim:set sw=4 sts=4 et:
......@@ -8,36 +8,9 @@ metadata:
environment:
- lava-test-shell
# please add more basic checks here as you run into situations where they fail
run:
steps:
- "lava-test-case getent-passwd-root --shell getent passwd root"
- "lava-test-case getent-passwd-user --shell getent passwd user"
- "lava-test-case lava-env --shell 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"
- "lava-test-case lava-id --shell id"
- "common/run-test-in-systemd --name=system-id id"
- "common/run-test-in-systemd --name=user-id id"
- "lava-test-case system-bus-is-up --shell test -S /run/dbus/system_bus_socket"
- "lava-test-case user-session-is-up --shell test -d /run/user/1000/systemd"
- "lava-test-case user-bus-is-up --shell test -S /run/user/1000/bus"
- "lava-test-case has-debian_version --shell test -e /etc/debian_version"
- "lava-test-case os-release --shell cat /etc/os-release"
# do this in r-t-i-s because l-t-c has trouble with backslashes
# These two should really test for Apertis, but that would currently
# fail - see https://phabricator.apertis.org/T133 - so they also
# allow Ubuntu
- "common/run-test-in-systemd --name=os-release-name grep -E '^NAME=(\"?)(Apertis|Ubuntu)\\1$' /etc/os-release"
- "common/run-test-in-systemd --name=os-release-id grep -E '^ID=(\"?)(apertis|ubuntu)\\1$' /etc/os-release"
# run this as the user so we don't require cross-uid X11 sharing
# skip it if we are (meant to be) using Wayland
- "test -S /run/user/1000/wayland-0 || common/run-test-in-systemd --user=user --name=x11-works -- xterm -e /bin/true"
- "lava-test-case sanity-check --shell common/sanity-check"
parse:
pattern: 'TEST_RESULT:(?P<result>\w+):(?P<test_case_id>[^:]+):'
......
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