2020-03-04 09:35:06 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-10-17 16:13:06 +00:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
2018-09-19 05:30:29 +00:00
|
|
|
set -e
|
2021-04-19 11:01:59 +00:00
|
|
|
|
2023-06-07 11:51:02 +00:00
|
|
|
# shellcheck source=test/test-functions
|
|
|
|
. "${TEST_BASE_DIR:?}/test-functions"
|
|
|
|
|
2018-09-19 05:30:29 +00:00
|
|
|
TEST_DESCRIPTION="Run unit tests under containers"
|
|
|
|
RUN_IN_UNPRIVILEGED_CONTAINER=yes
|
2022-04-07 10:45:13 +00:00
|
|
|
# Some tests make collecting coverage impossible (like test-mount-util, which
|
|
|
|
# remounts the whole / as read-only), so let's ignore the gcov errors in such
|
|
|
|
# case
|
|
|
|
IGNORE_MISSING_COVERAGE=yes
|
2018-09-19 05:30:29 +00:00
|
|
|
|
2023-06-07 11:51:02 +00:00
|
|
|
# Embed some newlines in the kernel command line to stress our test suite
|
|
|
|
# Also, pass $TEST_PREFER_NSPAWN to the VM/container if set
|
|
|
|
#
|
|
|
|
# shellcheck disable=SC2015
|
2019-12-13 13:20:35 +00:00
|
|
|
KERNEL_APPEND="
|
2023-06-07 11:51:02 +00:00
|
|
|
$(get_bool "${TEST_PREFER_NSPAWN:-0}" && echo "systemd.setenv=TEST_PREFER_NSPAWN=1" || :)
|
2019-12-13 13:20:35 +00:00
|
|
|
|
|
|
|
frobnicate!
|
|
|
|
|
2023-06-12 19:05:30 +00:00
|
|
|
systemd.setenv=TEST_CMDLINE_NEWLINE=foo
|
|
|
|
systemd.setenv=TEST_CMDLINE_NEWLINE=bar
|
|
|
|
|
2019-12-13 13:20:35 +00:00
|
|
|
$KERNEL_APPEND
|
|
|
|
"
|
2023-06-07 11:51:02 +00:00
|
|
|
# Override $TEST_PREFER_NSPAWN if it was set to always run both the QEMU and
|
|
|
|
# the nspawn part of the test
|
|
|
|
TEST_PREFER_NSPAWN=no
|
2018-09-19 05:30:29 +00:00
|
|
|
|
2023-03-20 17:23:33 +00:00
|
|
|
test_append_files() {
|
|
|
|
if get_bool "$LOOKS_LIKE_SUSE"; then
|
|
|
|
dinfo "Install the unit test binaries needed by the TEST-02-UNITTESTS at runtime"
|
|
|
|
inst_recursive "${SOURCE_DIR}/unit-tests"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2021-04-26 17:20:18 +00:00
|
|
|
do_test "$@"
|