From 07683a3ba475e4ab2886e26e2753a8b4bc689241 Mon Sep 17 00:00:00 2001 From: Philip Withnall <philip.withnall@collabora.co.uk> Date: Thu, 30 Jun 2016 12:12:54 +0100 Subject: [PATCH] common: Add a test to check whether any processes crashed on boot This should hopefully catch failures like T2040, where the launcher crashed on boot. It checks for ANOM_ABEND lines in the audit log. Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.apertis.org/D3540 --- common/boot-no-crashes.sh | 28 ++++++++++++++++++++++++++++ common/boot-no-crashes.yaml | 18 ++++++++++++++++++ templates/group-common-tpl.json | 5 +++++ 3 files changed, 51 insertions(+) create mode 100755 common/boot-no-crashes.sh create mode 100644 common/boot-no-crashes.yaml diff --git a/common/boot-no-crashes.sh b/common/boot-no-crashes.sh new file mode 100755 index 0000000..9e6e091 --- /dev/null +++ b/common/boot-no-crashes.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +# boot-no-crashes.sh +# +# Verify that no processes crashed so far during this boot. The journal is +# automatically attached to LAVA test failures, so we don’t need to manually +# include that. + +# Copyright © 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 + +echo "# Anomalous process terminations:" +sudo journalctl -b | grep ANOM_ABEND | sed 's/^/# /g' + +if sudo journalctl -b | grep -q ANOM_ABEND; then + echo "TEST_RESULT:fail:boot-no-crashes:ANOM_ABEND found in journalctl logs" >&2 + exit 1 +else + echo "TEST_RESULT:pass:boot-no-crashes:" + exit 0 +fi diff --git a/common/boot-no-crashes.yaml b/common/boot-no-crashes.yaml new file mode 100644 index 0000000..3321e23 --- /dev/null +++ b/common/boot-no-crashes.yaml @@ -0,0 +1,18 @@ +metadata: + name: boot-no-crashes + format: "Lava-Test-Shell Test Definition 1.0" + description: "Check that nothing crashed when booting" + maintainer: "philip.withnall@collabora.co.uk" + scope: + - functional + environment: + - lava-test-shell + +run: + steps: + - "common/run-test-in-systemd --name=run-test common/boot-no-crashes.sh" + +parse: + pattern: 'TEST_RESULT:(?P<result>\w+):(?P<test_case_id>[^:]+):' + +# vim:set sw=2 sts=2 et: diff --git a/templates/group-common-tpl.json b/templates/group-common-tpl.json index 60d1da0..68b7161 100644 --- a/templates/group-common-tpl.json +++ b/templates/group-common-tpl.json @@ -51,6 +51,11 @@ "revision": "master", "testdef": "common/sanity-check.yaml" }, + { + "git-repo": "https://git.apertis.org/git/apertis-tests.git", + "revision": "master", + "testdef": "common/boot-no-crashes.yaml" + }, { "git-repo": "https://git.apertis.org/git/apertis-tests.git", "revision": "master", -- GitLab