From patchwork Tue May 10 02:50:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 9053791 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 65CCDBF29F for ; Tue, 10 May 2016 03:05:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADA5C2010B for ; Tue, 10 May 2016 03:05:02 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id D5760200C1 for ; Tue, 10 May 2016 03:05:01 +0000 (UTC) Received: from localhost ([::1]:44236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxym-0002u5-LI for patchwork-qemu-devel@patchwork.kernel.org; Mon, 09 May 2016 23:05:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxn7-0003F3-GP for qemu-devel@nongnu.org; Mon, 09 May 2016 22:52:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azxn4-00050X-5s for qemu-devel@nongnu.org; Mon, 09 May 2016 22:52:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52625) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azxmv-0004yH-37; Mon, 09 May 2016 22:52:45 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 911F0C049D4F; Tue, 10 May 2016 02:52:44 +0000 (UTC) Received: from ad.usersys.redhat.com (dhcp-15-133.nay.redhat.com [10.66.15.133]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u4A2ovVC023061; Mon, 9 May 2016 22:52:40 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Tue, 10 May 2016 10:50:57 +0800 Message-Id: <1462848659-28659-26-git-send-email-famz@redhat.com> In-Reply-To: <1462848659-28659-1-git-send-email-famz@redhat.com> References: <1462848659-28659-1-git-send-email-famz@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 10 May 2016 02:52:44 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v4 25/27] tests: Use null-co:// instead of /dev/null 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: Kevin Wolf , qemu-block@nongnu.org, rjones@redhat.com, John Snow , Jeff Cody , Markus Armbruster , Max Reitz , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP With image locking, opening /dev/null can fail when multiple tests run in parallel (make -j2, for example). Use null-co:// as the null protocol doesn't do image locking. While it's arguable we could special-case /dev/null, /dev/zero, /dev/urandom etc in raw-posix driver, it is not really necessary because user can always specify lock-image=off when it is appropriate. So let's write sensible testing code too. Signed-off-by: Fam Zheng --- tests/drive_del-test.c | 2 +- tests/nvme-test.c | 2 +- tests/usb-hcd-uhci-test.c | 2 +- tests/usb-hcd-xhci-test.c | 2 +- tests/virtio-blk-test.c | 2 +- tests/virtio-scsi-test.c | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c index fe03236..b9a6036 100644 --- a/tests/drive_del-test.c +++ b/tests/drive_del-test.c @@ -93,7 +93,7 @@ static void test_after_failed_device_add(void) static void test_drive_del_device_del(void) { /* Start with a drive used by a device that unplugs instantaneously */ - qtest_start("-drive if=none,id=drive0,file=/dev/null,format=raw" + qtest_start("-drive if=none,id=drive0,file=null-co://,format=raw" " -device virtio-scsi-pci" " -device scsi-hd,drive=drive0,id=dev0"); diff --git a/tests/nvme-test.c b/tests/nvme-test.c index ec06893..60734e8 100644 --- a/tests/nvme-test.c +++ b/tests/nvme-test.c @@ -23,7 +23,7 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); qtest_add_func("/nvme/nop", nop); - qtest_start("-drive id=drv0,if=none,file=/dev/null,format=raw " + qtest_start("-drive id=drv0,if=none,file=null-co://,format=raw " "-device nvme,drive=drv0,serial=foo"); ret = g_test_run(); diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 71ff2ea..4a2f3ad 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -86,7 +86,7 @@ int main(int argc, char **argv) qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug); qtest_start("-device piix3-usb-uhci,id=uhci,addr=1d.0" - " -drive id=drive0,if=none,file=/dev/null,format=raw" + " -drive id=drive0,if=none,file=null-co://,format=raw" " -device usb-tablet,bus=uhci.0,port=1"); ret = g_test_run(); qtest_end(); diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c index 7e2e212..5e96bec 100644 --- a/tests/usb-hcd-xhci-test.c +++ b/tests/usb-hcd-xhci-test.c @@ -90,7 +90,7 @@ int main(int argc, char **argv) qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug); qtest_start("-device nec-usb-xhci,id=xhci" - " -drive id=drive0,if=none,file=/dev/null,format=raw"); + " -drive id=drive0,if=none,file=null-co://,format=raw"); ret = g_test_run(); qtest_end(); diff --git a/tests/virtio-blk-test.c b/tests/virtio-blk-test.c index 3a66630..7c21938 100644 --- a/tests/virtio-blk-test.c +++ b/tests/virtio-blk-test.c @@ -81,7 +81,7 @@ static QPCIBus *pci_test_start(void) tmp_path = drive_create(); cmdline = g_strdup_printf("-drive if=none,id=drive0,file=%s,format=raw " - "-drive if=none,id=drive1,file=/dev/null,format=raw " + "-drive if=none,id=drive1,file=null-co://,format=raw " "-device virtio-blk-pci,id=drv0,drive=drive0," "addr=%x.%x", tmp_path, PCI_SLOT, PCI_FN); diff --git a/tests/virtio-scsi-test.c b/tests/virtio-scsi-test.c index d78747a..74f85a8 100644 --- a/tests/virtio-scsi-test.c +++ b/tests/virtio-scsi-test.c @@ -57,7 +57,7 @@ static void qvirtio_scsi_start(const char *extra_opts) char *cmdline; cmdline = g_strdup_printf( - "-drive id=drv0,if=none,file=/dev/null,format=raw " + "-drive id=drv0,if=none,file=null-co://,format=raw " "-device virtio-scsi-pci,id=vs0 " "-device scsi-hd,bus=vs0.0,drive=drv0 %s", extra_opts ? : ""); @@ -208,7 +208,7 @@ static void hotplug(void) { QDict *response; - qvirtio_scsi_start("-drive id=drv1,if=none,file=/dev/null,format=raw"); + qvirtio_scsi_start("-drive id=drv1,if=none,file=null-co://,format=raw"); response = qmp("{\"execute\": \"device_add\"," " \"arguments\": {" " \"driver\": \"scsi-hd\","