Go syscall package does not handle EINTR like higher level packages, so
we need to handle it when using syscall.Select().
The test always fails when running:
$ GOLANG=go
pkg=libguestfs.org/libnbd ./run-tests.sh
...
=== RUN Test590AioCopy
libnbd_590_aio_copy_test.go:160: select: interrupted system call
Strangely, it never fails when running "make check".
Signed-off-by: Nir Soffer <nsoffer(a)redhat.com>
---
.../src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git
a/golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
b/golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
index d566e6b..ed7aed4 100644
---
a/golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
+++
b/golang/src/libguestfs.org/libnbd/libnbd_590_aio_copy_test.go
@@ -155,7 +155,12 @@ func asynch_copy(t *testing.T, src *Libnbd, dst *Libnbd) {
if dir_is_write(dst) {
fdset_set(&wfds, dfd)
}
- _, err = syscall.Select(nfd, &rfds, &wfds, nil, nil)
+ for {
+ _, err = syscall.Select(nfd, &rfds, &wfds, nil, nil)
+ if err != syscall.EINTR {
+ break
+ }
+ }
if err != nil {
t.Fatalf("select: %s", err)
}
--
2.31.1