Richard W.M. Jones
2022-Apr-01 10:46 UTC
[Libguestfs] [PATCH nbdkit] tests: Skip vsock tests unless the vsock_loopback module is loaded
It's unfortunate that vsock in Linux can be broken if some but not all
vsock modules needed are loaded. As we are testing loopback
(VMADDR_CID_LOCAL), require that vsock_loopback is loaded.
Linux is able to autoload the correct module(s) if vsock.ko is _not_
loaded. We could in theory enhance the test to check this, but that
leaves us with uncertainty about whether the test could work (eg. Is
vsock available as a module in this kernel? Is this even Linux?)
Reported-by: Ming Xie
Thanks: Stefano Garzarella
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2069558
---
tests/functions.sh.in | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/functions.sh.in b/tests/functions.sh.in
index 6d41f683..7877c84d 100644
--- a/tests/functions.sh.in
+++ b/tests/functions.sh.in
@@ -240,11 +240,13 @@ requires_non_root ()
}
# Tests that use the vsock interface will fail if vsock is not
-# supported. On Linux you have to load the kernel modules: vsockmon
-# and vsock_loopback.
+# supported. On Linux you have to load the kernel module
+# vsock_loopback. See also
+# https://bugzilla.redhat.com/show_bug.cgi?id=2069558
requires_vsock_support ()
{
- if ! grep -q ^AF_VSOCK /proc/net/protocols; then
+ if ! grep -q ^AF_VSOCK /proc/net/protocols ||
+ ! lsmod | grep ^vsock_loopback; then
echo "$0: test skipped because AF_VSOCK is not supported."
exit 77
fi
--
2.35.1
Laszlo Ersek
2022-Apr-01 11:52 UTC
[Libguestfs] [PATCH nbdkit] tests: Skip vsock tests unless the vsock_loopback module is loaded
On 04/01/22 12:46, Richard W.M. Jones wrote:> It's unfortunate that vsock in Linux can be broken if some but not all > vsock modules needed are loaded. As we are testing loopback > (VMADDR_CID_LOCAL), require that vsock_loopback is loaded. > > Linux is able to autoload the correct module(s) if vsock.ko is _not_ > loaded. We could in theory enhance the test to check this, but that > leaves us with uncertainty about whether the test could work (eg. Is > vsock available as a module in this kernel? Is this even Linux?) > > Reported-by: Ming Xie > Thanks: Stefano Garzarella > Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2069558 > --- > tests/functions.sh.in | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/tests/functions.sh.in b/tests/functions.sh.in > index 6d41f683..7877c84d 100644 > --- a/tests/functions.sh.in > +++ b/tests/functions.sh.in > @@ -240,11 +240,13 @@ requires_non_root () > } > > # Tests that use the vsock interface will fail if vsock is not > -# supported. On Linux you have to load the kernel modules: vsockmon > -# and vsock_loopback. > +# supported. On Linux you have to load the kernel module > +# vsock_loopback. See also > +# https://bugzilla.redhat.com/show_bug.cgi?id=2069558 > requires_vsock_support () > { > - if ! grep -q ^AF_VSOCK /proc/net/protocols; then > + if ! grep -q ^AF_VSOCK /proc/net/protocols || > + ! lsmod | grep ^vsock_loopback; then > echo "$0: test skipped because AF_VSOCK is not supported." > exit 77 > fi >I think we should use "grep -q ^vsock_loopback" (-q option), but other than that: Acked-by: Laszlo Ersek <lersek at redhat.com>