1:255.16-alt1
[systemd_ALT.git] / test / TEST-02-UNITTESTS / test.sh
blob2cf9c310969348ed5f82c61584ab1f2f1e992f18
1 #!/usr/bin/env bash
2 # SPDX-License-Identifier: LGPL-2.1-or-later
3 set -e
5 # shellcheck source=test/test-functions
6 . "${TEST_BASE_DIR:?}/test-functions"
8 TEST_DESCRIPTION="Run unit tests under containers"
9 RUN_IN_UNPRIVILEGED_CONTAINER=yes
10 # Some tests make collecting coverage impossible (like test-mount-util, which
11 # remounts the whole / as read-only), so let's ignore the gcov errors in such
12 # case
13 IGNORE_MISSING_COVERAGE=yes
15 # Embed some newlines in the kernel command line to stress our test suite
16 # Also, pass $TEST_PREFER_NSPAWN to the VM/container if set
18 # shellcheck disable=SC2015
19 KERNEL_APPEND="
20 $(get_bool "${TEST_PREFER_NSPAWN:-0}" && echo "systemd.setenv=TEST_PREFER_NSPAWN=1" || :)
22 frobnicate!
24 systemd.setenv=TEST_CMDLINE_NEWLINE=foo
25 systemd.setenv=TEST_CMDLINE_NEWLINE=bar
27 $KERNEL_APPEND
29 # Override $TEST_PREFER_NSPAWN if it was set to always run both the QEMU and
30 # the nspawn part of the test
31 TEST_PREFER_NSPAWN=no
33 test_append_files() {
34 if get_bool "$LOOKS_LIKE_SUSE"; then
35 dinfo "Install the unit test binaries needed by the TEST-02-UNITTESTS at runtime"
36 inst_recursive "${SOURCE_DIR}/unit-tests"
40 do_test "$@"