mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
test: introduce test_require_bin() and use it
No functional change.
This commit is contained in:
parent
97d7af86b5
commit
70bdf6e661
@ -18,7 +18,7 @@ if ! get_bool "${TEST_PREFER_NSPAWN:=}"; then
|
||||
TEST_NO_NSPAWN=1
|
||||
fi
|
||||
|
||||
command -v dfuzzer >/dev/null || exit 0
|
||||
test_require_bin dfuzzer
|
||||
|
||||
if ! get_bool "$IS_BUILT_WITH_ASAN"; then
|
||||
echo "systemd is built without ASan, skipping..."
|
||||
|
@ -9,7 +9,7 @@ IMAGE_NAME="private-users"
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
has_user_dbus_socket || exit 0
|
||||
command -v mksquashfs >/dev/null 2>&1 || exit 0
|
||||
test_require_bin mksquashfs
|
||||
|
||||
test_append_files() {
|
||||
inst_binary unsquashfs
|
||||
|
@ -11,10 +11,7 @@ TEST_DESCRIPTION="testing homed"
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
get_bool "${NO_BUILD:-}" && HOMECTL_BIN="homectl" || HOMECTL_BIN="${BUILD_DIR:?}/homectl"
|
||||
if ! command -v "$HOMECTL_BIN" >/dev/null; then
|
||||
echo "Built without systemd-homed, skipping the test"
|
||||
exit 0
|
||||
fi
|
||||
test_require_bin "$HOMECTL_BIN"
|
||||
|
||||
# Need loop devices for mounting images
|
||||
test_append_files() {
|
||||
|
@ -12,9 +12,7 @@ TEST_INSTALL_VERITY_MINIMAL=1
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
command -v mksquashfs >/dev/null 2>&1 || exit 0
|
||||
command -v veritysetup >/dev/null 2>&1 || exit 0
|
||||
command -v sfdisk >/dev/null 2>&1 || exit 0
|
||||
test_require_bin mksquashfs veritysetup sfdisk
|
||||
|
||||
test_append_files() {
|
||||
instmods squashfs =squashfs
|
||||
|
@ -11,8 +11,7 @@ TEST_REQUIRE_INSTALL_TESTS=0
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
command -v swtpm >/dev/null 2>&1 || exit 0
|
||||
command -v tpm2_pcrextend >/dev/null 2>&1 || exit 0
|
||||
test_require_bin swtpm tpm2_pcrextend
|
||||
|
||||
test_append_files() {
|
||||
local workspace="${1:?}"
|
||||
|
@ -9,10 +9,7 @@ NSPAWN_ARGUMENTS="--private-network"
|
||||
# shellcheck source=test/test-functions
|
||||
. "${TEST_BASE_DIR:?}/test-functions"
|
||||
|
||||
if ! command -v knotd >/dev/null; then
|
||||
echo "This test requires Knot DNS server, skipping..."
|
||||
exit 0
|
||||
fi
|
||||
test_require_bin knotd
|
||||
|
||||
# We need at least Knot 3.0 which support (among others) the ds-push directive
|
||||
if ! knotc -c "${TEST_BASE_DIR:?}/knot-data/knot.conf" conf-check; then
|
||||
|
@ -326,6 +326,17 @@ if get_bool "$IS_BUILT_WITH_ASAN"; then
|
||||
echo "Detected ASan RT '$ASAN_RT_NAME' located at '$ASAN_RT_PATH'"
|
||||
fi
|
||||
|
||||
test_require_bin() {
|
||||
local bin
|
||||
|
||||
for bin in "$@"; do
|
||||
if ! command -v "$bin" >/dev/null; then
|
||||
echo "Required binary $bin not available, skipping the test"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
find_qemu_bin() {
|
||||
QEMU_BIN="${QEMU_BIN:-""}"
|
||||
# SUSE and Red Hat call the binary qemu-kvm. Debian and Gentoo call it kvm.
|
||||
|
Loading…
Reference in New Issue
Block a user