qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: qemu-block@nongnu.org
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PULL 14/48] iotests: Add test for a nonexistent NBD export
Date: Fri, 29 Jan 2016 18:37:20 +0100	[thread overview]
Message-ID: <1454089074-4819-15-git-send-email-kwolf@redhat.com> (raw)
In-Reply-To: <1454089074-4819-1-git-send-email-kwolf@redhat.com>

From: Max Reitz <mreitz@redhat.com>

Trying to connect to a nonexistent NBD export should not crash the
server.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/143     | 73 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/143.out |  7 +++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 81 insertions(+)
 create mode 100755 tests/qemu-iotests/143
 create mode 100644 tests/qemu-iotests/143.out

diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143
new file mode 100755
index 0000000..6207368
--- /dev/null
+++ b/tests/qemu-iotests/143
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# Test case for connecting to a non-existing NBD export name
+#
+# Copyright (C) 2016 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
+owner=mreitz@redhat.com
+
+seq="$(basename $0)"
+echo "QA output created by $seq"
+
+here="$PWD"
+tmp=/tmp/$$
+status=1	# failure is the default!
+
+_cleanup()
+{
+    rm -f "$TEST_DIR/nbd"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.qemu
+
+_supported_fmt generic
+_supported_proto generic
+_supported_os Linux
+
+keep_stderr=y \
+_launch_qemu 2> >(_filter_nbd)
+
+_send_qemu_cmd $QEMU_HANDLE \
+    "{ 'execute': 'qmp_capabilities' }" \
+    'return'
+
+_send_qemu_cmd $QEMU_HANDLE \
+    "{ 'execute': 'nbd-server-start',
+       'arguments': { 'addr': { 'type': 'unix',
+                                'data': { 'path': '$TEST_DIR/nbd' }}}}" \
+    'return'
+
+# This should just result in a client error, not in the server crashing
+$QEMU_IO_PROG -f raw -c quit \
+    "nbd+unix:///no_such_export?socket=$TEST_DIR/nbd" 2>&1 \
+    | _filter_qemu_io | _filter_nbd
+
+_send_qemu_cmd $QEMU_HANDLE \
+    "{ 'execute': 'quit' }" \
+    'return'
+
+wait=1 _cleanup_qemu
+
+# success, all done
+echo '*** done'
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/143.out b/tests/qemu-iotests/143.out
new file mode 100644
index 0000000..dad2024
--- /dev/null
+++ b/tests/qemu-iotests/143.out
@@ -0,0 +1,7 @@
+QA output created by 143
+{"return": {}}
+{"return": {}}
+can't open device nbd+unix:///no_such_export?socket=TEST_DIR/nbd: Failed to read export length
+{"return": {}}
+{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN"}
+*** done
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index d6e9219..ac6a959 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -142,3 +142,4 @@
 138 rw auto quick
 139 rw auto quick
 142 auto
+143 auto quick
-- 
1.8.3.1

  parent reply	other threads:[~2016-01-29 17:38 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-29 17:37 [Qemu-devel] [PULL 00/48] Block patches Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 01/48] block: Add blk_dev_has_tray() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 02/48] blockdev: Fix 'change' for slot devices Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 03/48] Revert "hw/block/fdc: Implement tray status" Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 04/48] block/qapi: Emit tray_open only if there is a tray Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 05/48] vmdk: Fix converting to streamOptimized Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 06/48] iotests: Limit supported formats for 118 Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 07/48] nbd: client_close on error in nbd_co_client_start Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 08/48] iotests: Rename filter_nbd to _filter_nbd in 083 Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 09/48] iotests: Change coding style of " Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 10/48] iotests: Move _filter_nbd into common.filter Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 11/48] iotests: Make _filter_nbd drop log lines Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 12/48] iotests: Make _filter_nbd support more URL types Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 13/48] iotests: Make redirecting qemu's stderr optional Kevin Wolf
2016-01-29 17:37 ` Kevin Wolf [this message]
2016-01-29 17:37 ` [Qemu-devel] [PULL 15/48] block: Remove unused struct definition BlockFinishData Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 16/48] block: Release named dirty bitmaps in bdrv_close() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 17/48] iotests: Add test for eject under NBD server Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 18/48] block: Add BB-BDS remove/insert notifiers Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 19/48] virtio-blk: Functions for op blocker management Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 20/48] virtio-scsi: Catch BDS-BB removal/insertion Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 21/48] nbd: Switch from close to eject notifier Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 22/48] block: Remove BDS close notifier Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 23/48] block: Use blk_remove_bs() in blk_delete() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 24/48] blockdev: Use blk_remove_bs() in do_drive_del() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 25/48] block: Make bdrv_close() static Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 26/48] block: Add list of all BlockDriverStates Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 27/48] blockdev: Keep track of monitor-owned BDS Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 28/48] block: Add blk_remove_all_bs() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 29/48] block: Rewrite bdrv_close_all() Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 30/48] iotests: Add test for multiple BB on BDS tree Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 31/48] iotests: Add test for block jobs and BDS ejection Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 32/48] block: acquire in bdrv_query_image_info Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 33/48] block: Add "file" output parameter to block status query functions Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 34/48] qcow: Assign bs->file->bs to file in qcow_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 35/48] qcow2: Assign bs->file->bs to file in qcow2_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 36/48] raw: Assign bs to file in raw_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 37/48] iscsi: Assign bs to file in iscsi_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 38/48] parallels: Assign bs->file->bs to file in parallels_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 39/48] qed: Assign bs->file->bs to file in bdrv_qed_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 40/48] sheepdog: Assign bs to file in sd_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 41/48] vdi: Assign bs->file->bs to file in vdi_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 42/48] vpc: Assign bs->file->bs to file in vpc_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 43/48] vmdk: Fix calculation of block status's offset Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 44/48] vmdk: Return extent's file in bdrv_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 45/48] block: Use returned *file in bdrv_co_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 46/48] qemu-img: In "map", use the returned "file" from bdrv_get_block_status Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 47/48] qemu-img: Make MapEntry a QAPI struct Kevin Wolf
2016-01-29 17:37 ` [Qemu-devel] [PULL 48/48] iotests: Add "qemu-img map" test for VMDK extents Kevin Wolf
2016-01-29 17:59 ` [Qemu-devel] [PULL 00/48] Block patches 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=1454089074-4819-15-git-send-email-kwolf@redhat.com \
    --to=kwolf@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).