All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P . Berrangé" <berrange@redhat.com>,
	"Kevin Wolf" <kwolf@redhat.com>, "Max Reitz" <mreitz@redhat.com>,
	"open list:Block layer core" <qemu-block@nongnu.org>
Subject: [Qemu-devel] [PULL 01/21] iotests: Make 233 output more reliable
Date: Mon, 21 Jan 2019 16:48:47 -0600	[thread overview]
Message-ID: <20190121224907.26634-2-eblake@redhat.com> (raw)
In-Reply-To: <20190121224907.26634-1-eblake@redhat.com>

We have a race between the nbd server and the client both trying
to report errors at once which can make the test sometimes fail
if the output lines swap order under load.  Break the race by
collecting server messages into a file and then replaying that
at the end of the test.

We may yet want to fix the server to not output ANYTHING for a
client action except when -v was used (to avoid malicious clients
from being able to DoS a server by filling up its logs), but that
is saved for a future patch.

Signed-off-by: Eric Blake <eblake@redhat.com>
CC: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20190117193658.16413-2-eblake@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 tests/qemu-iotests/233     | 11 ++++++++---
 tests/qemu-iotests/233.out |  4 +++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
index 1814efe3333..ab15c777370 100755
--- a/tests/qemu-iotests/233
+++ b/tests/qemu-iotests/233
@@ -2,7 +2,7 @@
 #
 # Test NBD TLS certificate / authorization integration
 #
-# Copyright (C) 2018 Red Hat, Inc.
+# Copyright (C) 2018-2019 Red Hat, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -30,6 +30,7 @@ _cleanup()
 {
     nbd_server_stop
     _cleanup_test_img
+    rm -f "$TEST_DIR/server.log"
     tls_x509_cleanup
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
@@ -66,7 +67,7 @@ $QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io

 echo
 echo "== check TLS client to plain server fails =="
-nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG"
+nbd_server_start_tcp_socket -f $IMGFMT "$TEST_IMG" 2> "$TEST_DIR/server.log"

 $QEMU_IMG info --image-opts \
     --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
@@ -81,7 +82,7 @@ echo "== check plain client to TLS server fails =="
 nbd_server_start_tcp_socket \
     --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes \
     --tls-creds tls0 \
-    -f $IMGFMT "$TEST_IMG"
+    -f $IMGFMT "$TEST_IMG" 2>> "$TEST_DIR/server.log"

 $QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"

@@ -109,6 +110,10 @@ $QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \

 $QEMU_IO -f $IMGFMT -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io

+echo
+echo "== final server log =="
+cat "$TEST_DIR/server.log"
+
 # success, all done
 echo "*** done"
 rm -f $seq.full
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
index 5f416721b03..2199d8a8b32 100644
--- a/tests/qemu-iotests/233.out
+++ b/tests/qemu-iotests/233.out
@@ -27,7 +27,6 @@ virtual size: 64M (67108864 bytes)
 disk size: unavailable

 == check TLS with different CA fails ==
-qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
 qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': The certificate hasn't got a known issuer

 == perform I/O over TLS ==
@@ -37,4 +36,7 @@ wrote 1048576/1048576 bytes at offset 1048576
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 read 1048576/1048576 bytes at offset 1048576
 1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== final server log ==
+qemu-nbd: option negotiation failed: Verify failed: No certificate was found.
 *** done
-- 
2.20.1

  reply	other threads:[~2019-01-21 22:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-21 22:48 [Qemu-devel] [PULL 00/21] NBD patches through 2019-01-21 Eric Blake
2019-01-21 22:48 ` Eric Blake [this message]
2019-01-21 22:48 ` [Qemu-devel] [PULL 02/21] maint: Allow for EXAMPLES in texi2pod Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 03/21] qemu-nbd: Enhance man page Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 04/21] qemu-nbd: Sanity check partition bounds Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 05/21] nbd/server: Hoist length check to qmp_nbd_server_add Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 06/21] nbd/server: Favor [u]int64_t over off_t Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 07/21] qemu-nbd: Avoid strtol open-coding Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 08/21] nbd/client: Refactor nbd_receive_list() Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 09/21] nbd/client: Move export name into NBDExportInfo Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 10/21] nbd/client: Change signature of nbd_negotiate_simple_meta_context() Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 11/21] nbd/client: Split out nbd_send_meta_query() Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 12/21] nbd/client: Split out nbd_receive_one_meta_context() Eric Blake
2019-01-21 22:48 ` [Qemu-devel] [PULL 13/21] nbd/client: Refactor return of nbd_receive_negotiate() Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 14/21] nbd/client: Split handshake into two functions Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 15/21] nbd/client: Pull out oldstyle size determination Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 16/21] nbd/client: Refactor nbd_opt_go() to support NBD_OPT_INFO Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 17/21] nbd/client: Add nbd_receive_export_list() Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 18/21] nbd/client: Add meta contexts to nbd_receive_export_list() Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 19/21] qemu-nbd: Add --list option Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 20/21] nbd/client: Work around 3.0 bug for listing meta contexts Eric Blake
2019-01-21 22:49 ` [Qemu-devel] [PULL 21/21] iotests: Enhance 223, 233 to cover 'qemu-nbd --list' Eric Blake
2019-01-22 19:23 ` [Qemu-devel] [PULL 00/21] NBD patches through 2019-01-21 Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190121224907.26634-2-eblake@redhat.com \
    --to=eblake@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.