No functional change.
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..."
. "${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
. "${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() {
# 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
# 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:?}"
# 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
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.