[PATCH] Skip vsock-related checks if AF_VSOCK is not supported.
--- tests/functions.sh.in | 10 ++++++++++ tests/test-ip-filter-anyvsock.sh | 1 + tests/test-nbd-vsock.sh | 1 + tests/test-vsock.sh | 1 + 4 files changed, 13 insertions(+) diff --git a/tests/functions.sh.in b/tests/functions.sh.in index 403fa56e..d6c4255c 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 3160e982..016b1da9 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 e3736898..f1f839a0 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 fc39cb7b..0bcfc4ba 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 -- 2.33.0
Thanks Hilko, I've pushed it. Out of interest, where are you running that doesn't have AF_VSOCK support? Does Debian not compile it into the kernel? Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
* Richard W.M. Jones:
Thanks Hilko, I've pushed it.
Out of interest, where are you running that doesn't have AF_VSOCK support? Does Debian not compile it into the kernel?
It's there on my machines, but apparently Debian's buildd's don't have it enabled, see <https://buildd.debian.org/status/fetch.php?pkg=nbdkit&arch=amd64&ver=1.26.6-1&stamp=1635186222&raw=0> for example. Cheers, -Hilko
On Thu, Oct 28, 2021 at 10:20:56PM +0200, Hilko Bengen wrote:
* Richard W.M. Jones:
Thanks Hilko, I've pushed it.
Out of interest, where are you running that doesn't have AF_VSOCK support? Does Debian not compile it into the kernel?
It's there on my machines, but apparently Debian's buildd's don't have it enabled, see <https://buildd.debian.org/status/fetch.php?pkg=nbdkit&arch=amd64&ver=1.26.6-1&stamp=1635186222&raw=0> for example.
bind_vsock: socket: Address family not supported by protocol
Yup, looks that way. It's a shame because vsock is actually an interesting protocol (even though VMware invented it :-) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
participants (2)
-
Hilko Bengen -
Richard W.M. Jones