OCaml 4.11.0 pre-release

Add upstream patch to fix one of the tests that fails on slow machines.
This commit is contained in:
Richard W.M. Jones 2020-04-17 22:29:33 +01:00
parent 7278e9942f
commit 78c8600f66
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,52 @@
From 0475bfe04a527051c0a37af59a733c4c8554e427 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Fri, 17 Apr 2020 22:23:56 +0100
Subject: [PATCH] ocaml: Fix bug in asynch copy test.
This program had a subtle bug: If we've read everything from the
source, but there are still source commands in flight, AND it happens
that there are no destination commands in flight, then the loop
finishes prematurely. This is particularly evident when you run the
test on a slow machine (armv7 in Koji is illustrative). The fix is to
check that there are no commands in flight either from the source or
to the destination.
(I actually discovered this when writing the golang bindings which
copied from the OCaml version, but forgot to make the correction to
the original.)
---
ocaml/examples/asynch_copy.ml | 3 ++-
ocaml/tests/test_590_aio_copy.ml | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/ocaml/examples/asynch_copy.ml b/ocaml/examples/asynch_copy.ml
index d5dcc60..7132f57 100644
--- a/ocaml/examples/asynch_copy.ml
+++ b/ocaml/examples/asynch_copy.ml
@@ -41,7 +41,8 @@ let asynch_copy src dst =
(* The main loop which runs until we have finished reading and
* there are no more commands in flight.
*)
- while !soff < size || NBD.aio_in_flight dst > 0 do
+ while !soff < size || NBD.aio_in_flight src > 0 || NBD.aio_in_flight dst > 0
+ do
(* If we're able to submit more reads from the source then do so now. *)
if !soff < size && NBD.aio_in_flight src < max_reads_in_flight then (
let bs = min bs (size -^ !soff) in
diff --git a/ocaml/tests/test_590_aio_copy.ml b/ocaml/tests/test_590_aio_copy.ml
index ac490ef..e3cd59d 100644
--- a/ocaml/tests/test_590_aio_copy.ml
+++ b/ocaml/tests/test_590_aio_copy.ml
@@ -64,7 +64,8 @@ let asynch_copy src dst =
(* The main loop which runs until we have finished reading and
* there are no more commands in flight.
*)
- while !soff < size || NBD.aio_in_flight dst > 0 do
+ while !soff < size || NBD.aio_in_flight src > 0 || NBD.aio_in_flight dst > 0
+ do
(* If we're able to submit more reads from the source then do so now. *)
if !soff < size && NBD.aio_in_flight src < max_reads_in_flight then (
let bs = min bs (size -^ !soff) in
--
2.25.0

View File

@ -9,7 +9,7 @@
Name: libnbd
Version: 1.3.6
Release: 3%{?dist}
Release: 4%{?dist}
Summary: NBD client library in userspace
License: LGPLv2+
@ -22,6 +22,9 @@ Source1: http://libguestfs.org/download/libnbd/%{source_directory}/%{name
# https://pgp.key-server.io/pks/lookup?search=rjones%40redhat.com&fingerprint=on&op=vindex
Source2: libguestfs.keyring
# Upstream patch to fix one of the tests that fails on slow machines.
Patch1: 0001-ocaml-Fix-bug-in-asynch-copy-test.patch
%if 0%{patches_touch_autotools}
BuildRequires: autoconf, automake, libtool
%endif
@ -277,6 +280,7 @@ make %{?_smp_mflags} check || {
%changelog
* Fri Apr 17 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3.6-3
- OCaml 4.11.0 pre-release
- Add upstream patch to fix one of the tests that fails on slow machines.
* Thu Apr 02 2020 Richard W.M. Jones <rjones@redhat.com> - 1.3.6-2
- Update all OCaml dependencies for RPM 4.16.