From: Hilko Bengen Date: Mon, 25 Oct 2021 19:35:20 +0000 (+0200) Subject: Skip vsock-related checks if AF_VSOCK is not supported. X-Git-Tag: archive/raspbian/1.38.2-2+rpi1~2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bbacae7f7fa62bcfd06e03fb89f1083fac37fd03;p=nbdkit.git Skip vsock-related checks if AF_VSOCK is not supported. Gbp-Pq: Name 0010-Skip-vsock-related-checks-if-AF_VSOCK-is-not-support.patch --- diff --git a/tests/functions.sh.in b/tests/functions.sh.in index 403fa56..d6c4255 100644 --- a/tests/functions.sh.in +++ b/tests/functions.sh.in @@ -239,6 +239,16 @@ requires_non_root () fi } +# Tests that use the vsock interface will fail if vsock is not +# supported. +requires_vsock_support () +{ + if ! grep -q ^AF_VSOCK /proc/net/protocols; then + echo "$0: test skipped because AF_VSOCK is not supported." + exit 77 + fi +} + # start_nbdkit -P pidfile args... # # Run nbdkit with args and wait for it to start up. If it fails to diff --git a/tests/test-ip-filter-anyvsock.sh b/tests/test-ip-filter-anyvsock.sh index 3160e98..016b1da 100755 --- a/tests/test-ip-filter-anyvsock.sh +++ b/tests/test-ip-filter-anyvsock.sh @@ -47,6 +47,7 @@ requires nbdsh --version requires nbdsh -c 'print(h.connect_vsock)' requires_nbdsh_uri requires_linux_kernel_version 5.6 +requires_vsock_support # Not supported on Windows. if is_windows; then diff --git a/tests/test-nbd-vsock.sh b/tests/test-nbd-vsock.sh index e373689..f1f839a 100755 --- a/tests/test-nbd-vsock.sh +++ b/tests/test-nbd-vsock.sh @@ -47,6 +47,7 @@ set -x requires_nbdsh_uri requires nbdsh -c 'print(h.connect_vsock)' requires_linux_kernel_version 5.6 +requires_vsock_support # Because vsock ports are 32 bits, we can basically pick one at random # and be sure that it's not used. However we must pick one >= 1024 diff --git a/tests/test-vsock.sh b/tests/test-vsock.sh index fc39cb7..0bcfc4b 100755 --- a/tests/test-vsock.sh +++ b/tests/test-vsock.sh @@ -47,6 +47,7 @@ requires nbdsh --version requires nbdsh -c 'print(h.connect_vsock)' requires_nbdsh_uri requires_linux_kernel_version 5.6 +requires_vsock_support # Because vsock ports are 32 bits, we can basically pick one at random # and be sure that it's not used. However we must pick one >= 1024