From patchwork Thu Apr 28 12:57:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fam Zheng X-Patchwork-Id: 8970161 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 592A79F441 for ; Thu, 28 Apr 2016 13:16:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B8C6202EB for ; Thu, 28 Apr 2016 13:16:32 +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 9C26C202C8 for ; Thu, 28 Apr 2016 13:16:30 +0000 (UTC) Received: from localhost ([::1]:48978 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avlnx-0006iJ-Tl for patchwork-qemu-devel@patchwork.kernel.org; Thu, 28 Apr 2016 09:16:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avlXt-0005Gt-O0 for qemu-devel@nongnu.org; Thu, 28 Apr 2016 08:59:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1avlXp-0000mJ-Hv for qemu-devel@nongnu.org; Thu, 28 Apr 2016 08:59:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57077) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1avlXk-0000lJ-3H; Thu, 28 Apr 2016 08:59:44 -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 A52BF128297; Thu, 28 Apr 2016 12:59:43 +0000 (UTC) Received: from lemon.redhat.com (vpn1-5-154.pek2.redhat.com [10.72.5.154]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3SCvWNS001193; Thu, 28 Apr 2016 08:59:38 -0400 From: Fam Zheng To: qemu-devel@nongnu.org Date: Thu, 28 Apr 2016 20:57:44 +0800 Message-Id: <1461848266-32119-26-git-send-email-famz@redhat.com> In-Reply-To: <1461848266-32119-1-git-send-email-famz@redhat.com> References: <1461848266-32119-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.38]); Thu, 28 Apr 2016 12:59:43 +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 v3 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, Jeff Cody , Markus Armbruster , Max Reitz , stefanha@redhat.com, den@openvz.org, pbonzini@redhat.com, John Snow 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\","