From patchwork Fri Dec 6 16:36:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 298090 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4911B2C00A0 for ; Sat, 7 Dec 2013 03:52:02 +1100 (EST) Received: from localhost ([::1]:60112 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoydD-0000V0-Qk for incoming@patchwork.ozlabs.org; Fri, 06 Dec 2013 11:51:59 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoyPl-000878-GS for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:38:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VoyPf-0003V0-Hq for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:38:05 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6197) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VoyPf-0003Uw-8a for qemu-devel@nongnu.org; Fri, 06 Dec 2013 11:37:59 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rB6GbuDF014384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Dec 2013 11:37:57 -0500 Received: from localhost (ovpn-112-22.ams2.redhat.com [10.36.112.22]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id rB6Gbt65015190; Fri, 6 Dec 2013 11:37:56 -0500 From: Stefan Hajnoczi To: Date: Fri, 6 Dec 2013 17:36:26 +0100 Message-Id: <1386347807-27359-28-git-send-email-stefanha@redhat.com> In-Reply-To: <1386347807-27359-1-git-send-email-stefanha@redhat.com> References: <1386347807-27359-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Fam Zheng , Stefan Hajnoczi , Anthony Liguori Subject: [Qemu-devel] [PULL 27/48] qemu-iotests: Add _default_cache_mode and _supported_cache_modes X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Fam Zheng This replaces _unsupported_qemu_io_options and check for support of current cache mode, and allow to provide a default if user didn't specify. Signed-off-by: Fam Zheng Reviewed-by: Wenchao Xia Signed-off-by: Stefan Hajnoczi --- tests/qemu-iotests/026 | 3 ++- tests/qemu-iotests/039 | 3 ++- tests/qemu-iotests/052 | 4 ++-- tests/qemu-iotests/common.rc | 25 +++++++++++++++---------- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026 index ebe29d0..c9c5f83 100755 --- a/tests/qemu-iotests/026 +++ b/tests/qemu-iotests/026 @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto generic _supported_os Linux - +_default_cache_mode "writethrough" +_supported_cache_modes "writethrough" "none" echo "Errors while writing 128 kB" echo diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039 index 8bade92..6abf472 100755 --- a/tests/qemu-iotests/039 +++ b/tests/qemu-iotests/039 @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto generic _supported_os Linux -_unsupported_qemu_io_options --nocache +_default_cache_mode "writethrough" +_supported_cache_modes "writethrough" size=128M diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052 index f5f9683..4d4e411 100755 --- a/tests/qemu-iotests/052 +++ b/tests/qemu-iotests/052 @@ -41,8 +41,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt generic _supported_proto generic _supported_os Linux -_unsupported_qemu_io_options --nocache - +_default_cache_mode "writethrough" +_supported_cache_modes "writethrough" size=128M _make_test_img $size diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc index 7f62457..47cef6d 100644 --- a/tests/qemu-iotests/common.rc +++ b/tests/qemu-iotests/common.rc @@ -387,18 +387,23 @@ _supported_os() _notrun "not suitable for this OS: $HOSTOS" } -_unsupported_qemu_io_options() +_supported_cache_modes() { - for bad_opt - do - for opt in $QEMU_IO_OPTIONS - do - if [ "$bad_opt" = "$opt" ] - then - _notrun "not suitable for qemu-io option: $bad_opt" - fi - done + for mode; do + if [ "$mode" = "$CACHEMODE" ]; then + return + fi done + _notrun "not suitable for cache mode: $CACHEMODE" +} + +_default_cache_mode() +{ + if $CACHEMODE_IS_DEFAULT; then + CACHEMODE="$1" + QEMU_IO="$QEMU_IO --cache $1" + return + fi } # this test requires that a specified command (executable) exists