1#!/usr/bin/env bash 2# SPDX-License-Identifier: LGPL-2.1-or-later 3set -e 4 5TEST_REQUIRE_INSTALL_TESTS=0 6TEST_DESCRIPTION="testing honor first shutdown" 7TEST_NO_QEMU=1 8 9# shellcheck source=test/test-functions 10. "${TEST_BASE_DIR:?}/test-functions" 11 12# Using timeout because if the test fails it can loop. 13# The reason is because the poweroff executed by end.service 14# could turn into a reboot if the test fails. 15NSPAWN_TIMEOUT=60 16 17# Remove this file if it exists. This is used along with 18# the make target "finish". Since concrete confirmation is 19# only found from the console during the poweroff. 20rm -f /tmp/honorfirstshutdown.log >/dev/null 21 22check_result_nspawn_hook() { 23 grep -q "Shutdown is already active. Skipping emergency action request" /tmp/honorfirstshutdown.log 24} 25 26# Note: don't use a pipe in the following expression, as it breaks the trap 27# handlers we have defined in test/test-functions. 28do_test "$@" > >(tee /tmp/honorfirstshutdown.log) 29