From patchwork Fri Apr 13 19:26:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nir Soffer X-Patchwork-Id: 10340727 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1059B60153 for ; Fri, 13 Apr 2018 19:30:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF9EE289D5 for ; Fri, 13 Apr 2018 19:30:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EC441289C6; Fri, 13 Apr 2018 19:30:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5B144287CF for ; Fri, 13 Apr 2018 19:30:05 +0000 (UTC) Received: from localhost ([::1]:48079 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f74Oa-0008QO-Je for patchwork-qemu-devel@patchwork.kernel.org; Fri, 13 Apr 2018 15:30:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37495) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1f74L1-0005CC-DG for qemu-devel@nongnu.org; Fri, 13 Apr 2018 15:26:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1f74L0-0001zG-32 for qemu-devel@nongnu.org; Fri, 13 Apr 2018 15:26:23 -0400 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:38633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1f74Kz-0001wx-TX; Fri, 13 Apr 2018 15:26:22 -0400 Received: by mail-wr0-x242.google.com with SMTP id l13so9683191wrb.5; Fri, 13 Apr 2018 12:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=xgwkxnxDIu7ecxkqwMajkHLgq6NE+m0M5skKXVei3K4=; b=jmbKD7A4Plc9saDqNGiLBJ/ifMy8lnV3k45woDjxKrehQAQ8UUzL3Uf5p28GhB7nbP HuBorr/JscmnLvdgQ9PZpiMfqW47zAutbLfcBEfTZUP/5Zb7MkKvrVPU93R3yU4hJWt4 9PyTK6HO9fb1hIqrAt5Pdwit86J6Gx7LD1bZluGZ36yb3XUbpzvMgN3zK79JMUIaOL7Y h3uoquC4RdcJWEmuJggAZJiPnXiSfVSRorOiov9h/7oZVphij3Dcs1OI2LzccSsU7Kfk BORKnY/QMAQgBWQc6615QOef5J+YAgSwblCFIIqlkv4jI5FEzMfA+kYHpelYUKyVG3EK U/yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=xgwkxnxDIu7ecxkqwMajkHLgq6NE+m0M5skKXVei3K4=; b=BM6rD/TiuEAZiNhiAxBdYPTXrWKHSYcX6TKpiW2KJrtjuIOA5Vm91V8CsWkbrVrjU4 BROmru9Z20eCECR3hYvUM2cbm6oniVOKUdEWjjIMRe1dJWMO+ZDM3kAA7bhNln579y1L R4sbxER4Vkbp1pTH6TiB9CHluxGkxZIJ9ApvFnbmf3VSfmqTyV+QWkouNjVUIAtL92zM WEsU7OwDUUHV097h8lF6bLtIKlbdzMHJqpEIGFEuoL2PhNTASGJI0nIktTBsEm9Fbb29 haQCfuWJB07vSvOPPynCPO0pAfWEOTy+YTdBvqMnxit0rA4V7FVYtgHStAFmKRjt9rCa zMcQ== X-Gm-Message-State: ALQs6tCMnvhxPJGNkFA02PGWUz2rpfN9RWo02n+lkVLEuWnPGcD0gblm 1NJbx9kTr5EDaWNyD27tD0METk6KoZE= X-Google-Smtp-Source: AIpwx492HBKoRGlujPEmUc35eMdoOxXD0Wa9MQeXapvOnGfUYuusR8QkF5rFZZznyJ1aQnT9i2kpGQ== X-Received: by 10.28.207.201 with SMTP id f192mr4403045wmg.148.1523647580405; Fri, 13 Apr 2018 12:26:20 -0700 (PDT) Received: from lean.local (93-173-127-3.bb.netvision.net.il. [93.173.127.3]) by smtp.gmail.com with ESMTPSA id r200sm842127wmb.39.2018.04.13.12.26.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 13 Apr 2018 12:26:19 -0700 (PDT) From: Nir Soffer To: qemu-devel@nongnu.org Date: Fri, 13 Apr 2018 22:26:05 +0300 Message-Id: <20180413192605.2145-4-nirsof@gmail.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180413192605.2145-1-nirsof@gmail.com> References: <20180413192605.2145-1-nirsof@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PATCH 3/3] qemu-iotests: Test new qemu-nbd --nolist option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, Nir Soffer , qemu-block@nongnu.org, rjones@redhat.com, mreitz@redhat.com, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Add new test module for tesing the --nolist option. Signed-off-by: Nir Soffer --- tests/qemu-iotests/214 | 46 ++++++++++++++++++++++++++++++++++++++++++++++ tests/qemu-iotests/214.out | 2 ++ tests/qemu-iotests/group | 1 + 3 files changed, 49 insertions(+) create mode 100755 tests/qemu-iotests/214 create mode 100644 tests/qemu-iotests/214.out diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214 new file mode 100755 index 0000000000..779e382070 --- /dev/null +++ b/tests/qemu-iotests/214 @@ -0,0 +1,46 @@ +#!/usr/bin/env python +# +# Test qemu-nbd compatibility with other tools. +# +# Copyright (C) 2018 Nir Soffer +# +# 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 . +# + +import iotests + +iotests.verify_image_format(supported_fmts=['raw']) + +iotests.log('Check that listing exports is allowed by default') +disk, nbd_sock = iotests.file_path('disk1', 'nbd-sock1') +iotests.qemu_img_create('-f', iotests.imgfmt, disk, '1m') +iotests.qemu_nbd('-k', nbd_sock, '-f', iotests.imgfmt, '-x', 'export', disk) +out = iotests.run('nbd-client', '-l', '--unix', nbd_sock) + +assert 'export' in out.splitlines(), 'Export not in %r' % out + +iotests.log('Check that listing exports is forbidden with --nolist') +disk, nbd_sock = iotests.file_path('disk2', 'nbd-sock2') +iotests.qemu_img_create('-f', iotests.imgfmt, disk, '1m') +iotests.qemu_nbd('-k', nbd_sock, '-f', iotests.imgfmt, '-x', 'secret', + '--nolist', disk) + +# nbd-client fails when listing is not allowed, but lets not depend on 3rd +# party tool behavior here. +try: + out = iotests.run('nbd-client', '-l', '--unix', nbd_sock) + assert 'secret' not in out, 'Export in %r' % out +except iotests.CommandFailed as e: + # This text comes from qemu-nbd. + assert 'Listing exports is forbidden' in e.err, 'Unexpected error: %s' % e diff --git a/tests/qemu-iotests/214.out b/tests/qemu-iotests/214.out new file mode 100644 index 0000000000..dae61b5a57 --- /dev/null +++ b/tests/qemu-iotests/214.out @@ -0,0 +1,2 @@ +Check that listing exports is allowed by default +Check that listing exports is forbidden with --nolist diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 52a80f3f9e..a820dcb91f 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -212,3 +212,4 @@ 211 rw auto quick 212 rw auto quick 213 rw auto quick +214 rw auto quick