test: introduce test_require_bin() and use it

No functional change.
This commit is contained in:
Frantisek Sumsal
2023-06-05 16:50:13 +02:00
parent 97d7af86b5
commit 70bdf6e661
7 changed files with 17 additions and 15 deletions
+11
View File
@@ -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.