Add upstream patch to fix IPv6 support in tests.

This commit is contained in:
Richard W.M. Jones 2019-12-10 10:34:55 +00:00
parent fb945f0d3d
commit 7fc80c32df
2 changed files with 79 additions and 2 deletions

View File

@ -0,0 +1,73 @@
From 8e22f1e40510252aa329eb102a0e24b0f755c29e Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Tue, 10 Dec 2019 10:21:14 +0000
Subject: [PATCH] tests: Fix test for IPv6 support.
Remove bogus existing tests, and add a new test that IPv6
loopback is working through qemu-img.
---
tests/functions.sh.in | 18 ++++++++++++++++++
tests/test-ip-filter.sh | 5 +----
tests/test-ip.sh | 1 +
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/tests/functions.sh.in b/tests/functions.sh.in
index 9a19167..e62fb51 100644
--- a/tests/functions.sh.in
+++ b/tests/functions.sh.in
@@ -71,6 +71,24 @@ requires ()
}
}
+# qemu cannot connect to ::1 if IPv6 is disabled because of
+# the way it uses getaddrinfo. See:
+# https://bugzilla.redhat.com/show_bug.cgi?id=808147
+# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/SXDLSZ3GKXL6NDAKP4MPJ25IMHKN67X3/
+requires_ipv6_loopback ()
+{
+ requires qemu-img --version
+
+ # This should fail with "Connection refused". If IPv6 is broken
+ # then it fails with "Address family for hostname not supported"
+ # instead. It's very unlikely that port 1 is open.
+ if LANG=C qemu-img info "nbd:[::1]:1" |& \
+ grep -sq "Address family for hostname not supported"; then
+ echo "$0: IPv6 loopback is not available, skipping this test"
+ 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.sh b/tests/test-ip-filter.sh
index 31aad88..a3100a4 100755
--- a/tests/test-ip-filter.sh
+++ b/tests/test-ip-filter.sh
@@ -38,10 +38,7 @@ set -e
requires ip -V
requires qemu-img --version
-
-# Check we have IPv4 and IPv6, skip the test otherwise.
-requires ip -o -4 addr show scope host
-requires ip -o -6 addr show scope host
+requires_ipv6_loopback
rm -f ip-filter.pid
cleanup_fn rm -f ip-filter.pid
diff --git a/tests/test-ip.sh b/tests/test-ip.sh
index a0f1862..61675c2 100755
--- a/tests/test-ip.sh
+++ b/tests/test-ip.sh
@@ -39,6 +39,7 @@ set -e
requires ip -V
requires qemu-img --version
requires qemu-img info --image-opts driver=file,filename=functions.sh
+requires_ipv6_loopback
rm -f ip.pid ipv4.out ipv6.out
cleanup_fn rm -f ip.pid ipv4.out ipv6.out
--
2.23.0

View File

@ -38,7 +38,7 @@ ExclusiveArch: x86_64
Name: nbdkit Name: nbdkit
Version: 1.17.3 Version: 1.17.3
Release: 1%{?dist} Release: 2%{?dist}
Summary: NBD server Summary: NBD server
License: BSD License: BSD
@ -51,6 +51,9 @@ Source1: http://libguestfs.org/download/nbdkit/%{source_directory}/%{name
Source2: libguestfs.keyring Source2: libguestfs.keyring
%endif %endif
# Upstream patch to fix IPv6 support in tests.
Patch1: 0001-tests-Fix-test-for-IPv6-support.patch
%if 0%{patches_touch_autotools} %if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool BuildRequires: autoconf, automake, libtool
%endif %endif
@ -910,8 +913,9 @@ make %{?_smp_mflags} check || {
%changelog %changelog
* Mon Dec 9 2019 Richard W.M. Jones <rjones@redhat.com> - 1.17.3-1 * Tue Dec 10 2019 Richard W.M. Jones <rjones@redhat.com> - 1.17.3-2
- New upstream development version 1.17.3. - New upstream development version 1.17.3.
- Add upstream patch to fix IPv6 support in tests.
* Sat Dec 7 2019 Richard W.M. Jones <rjones@redhat.com> - 1.17.2-2 * Sat Dec 7 2019 Richard W.M. Jones <rjones@redhat.com> - 1.17.2-2
- Reenable OCaml plugin on riscv64 again, should now work with 4.09. - Reenable OCaml plugin on riscv64 again, should now work with 4.09.