1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-22 13:33:56 +03:00

test/TEST-01: allow running w/o -Dinstall-tests=true

This is useful for sanitizer builds under CI, see
https://github.com/systemd/systemd-centos-ci/pull/202#issuecomment-566476592.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-12-17 12:52:35 +01:00
parent 8c3534b5db
commit 9d84eb2053
2 changed files with 9 additions and 1 deletions

View File

@ -3,6 +3,7 @@ set -e
TEST_DESCRIPTION="Basic systemd setup"
IMAGE_NAME="basic"
RUN_IN_UNPRIVILEGED_CONTAINER=${RUN_IN_UNPRIVILEGED_CONTAINER:-yes}
TEST_REQUIRE_INSTALL_TESTS=0
. $TEST_BASE_DIR/test-functions
@ -13,6 +14,10 @@ test_create_image() {
(
LOG_LEVEL=5
setup_basic_environment
# install tests manually so the test is functional even when -Dinstall-tests=false
mkdir -p $initdir/usr/lib/systemd/tests/testdata/units/
cp -v $(dirname $0)/../units/{testsuite-01,end}.service $initdir/usr/lib/systemd/tests/testdata/units/
)
setup_nspawn_root
}

View File

@ -17,6 +17,7 @@ UNIFIED_CGROUP_HIERARCHY="${UNIFIED_CGROUP_HIERARCHY:-default}"
EFI_MOUNT="${EFI_MOUNT:-$(bootctl -x 2>/dev/null || echo /boot)}"
QEMU_MEM="${QEMU_MEM:-512M}"
IMAGE_NAME=${IMAGE_NAME:-default}
TEST_REQUIRE_INSTALL_TESTS="${TEST_REQUIRE_INSTALL_TESTS:-1}"
# Decide if we can (and want to) run QEMU with KVM acceleration.
# Check if nested KVM is explicitly enabled (TEST_NESTED_KVM). If not,
@ -1933,7 +1934,9 @@ test_create_image() {
}
test_setup() {
if type -P meson >/dev/null && [[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
if [ ${TEST_REQUIRE_INSTALL_TESTS} -ne 0 ] && \
type -P meson >/dev/null && \
[[ "$(meson configure $BUILD_DIR | grep install-tests | awk '{ print $2 }')" != "true" ]]; then
dfatal "Needs to be built with -Dinstall-tests=true"
exit 1
fi