qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, WenchaoXia <xiawenc@linux.vnet.ibm.com>,
	stefanha@redhat.com
Subject: [Qemu-devel] [PATCH v5 1/6] qemu-iotests: Add "-c <cache-mode>" option
Date: Tue,  3 Dec 2013 16:25:22 +0800	[thread overview]
Message-ID: <1386059127-30962-2-git-send-email-famz@redhat.com> (raw)
In-Reply-To: <1386059127-30962-1-git-send-email-famz@redhat.com>

The option sets cache mode used in the tests. "-nocache" is changed to
an alias to "-c none", and internally passes "-t none" to qemu-io.

Python scripts will make use of option this in the next commit.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 tests/qemu-iotests/check  |  2 +-
 tests/qemu-iotests/common | 21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check
index f5f328f..dc0105c 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -242,7 +242,7 @@ do
             fi
 
             reference=$seq.out
-            if (echo $QEMU_IO_OPTIONS | grep -s -- '--nocache' > /dev/null); then
+            if [ "$CACHEMODE" = "none" ]; then
                 [ -f $seq.out.nocache ] && reference=$seq.out.nocache
             fi
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 8cde7f1..4743c9e 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -42,13 +42,16 @@ expunge=true
 have_test_arg=false
 randomize=false
 valgrind=false
+cachemode=false
 rm -f $tmp.list $tmp.tmp $tmp.sed
 
 export IMGFMT=raw
 export IMGFMT_GENERIC=true
 export IMGPROTO=file
 export IMGOPTS=""
+export CACHEMODE="writethrough"
 export QEMU_IO_OPTIONS=""
+export CACHEMODE_IS_DEFAULT=true
 
 for r
 do
@@ -113,7 +116,12 @@ s/ .*//p
         IMGOPTS="$r"
         imgopts=false
         continue
-
+    elif $cachemode
+    then
+        CACHEMODE="$r"
+        CACHEMODE_IS_DEFAULT=false
+        cachemode=false
+        continue
     fi
 
     xpand=true
@@ -147,6 +155,7 @@ check options
     -o options          -o options to pass to qemu-img create/convert
     -T                        output timestamps
     -r                         randomize test order
+    -c mode             cache mode
 
 testlist options
     -g group[,group...]        include tests from these groups
@@ -219,7 +228,8 @@ testlist options
             xpand=false
             ;;
         -nocache)
-            QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --nocache"
+            CACHEMODE="none"
+            CACHEMODE_IS_DEFAULT=false
             xpand=false
             ;;
 
@@ -258,6 +268,10 @@ testlist options
             imgopts=true
             xpand=false
             ;;
+        -c)
+            cachemode=true
+            xpand=false
+            ;;
         -r)        # randomize test order
             randomize=true
             xpand=false
@@ -334,6 +348,9 @@ BEGIN        { for (t='$start'; t<='$end'; t++) printf "%03d\n",t }' \
 
 done
 
+# Set qemu-io cache mode with $CACHEMODE we have
+QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
+
 # Set default options for qemu-img create -o if they were not specified
 _set_default_imgopts
 
-- 
1.8.4.2

  reply	other threads:[~2013-12-03  8:26 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-03  8:25 [Qemu-devel] [PATCH v5 0/6] Add cache mode option to qemu-iotests, and change default mode to "writeback" Fam Zheng
2013-12-03  8:25 ` Fam Zheng [this message]
2013-12-03  8:59   ` [Qemu-devel] [PATCH v5 1/6] qemu-iotests: Add "-c <cache-mode>" option Wenchao Xia
2013-12-03  8:25 ` [Qemu-devel] [PATCH v5 2/6] qemu-iotests: Honour cache mode in iotests.py Fam Zheng
2013-12-03 14:27   ` Benoît Canet
2013-12-03 15:19     ` Kevin Wolf
2013-12-03  8:25 ` [Qemu-devel] [PATCH v5 3/6] qemu-iotests: Add _default_cache_mode and _supported_cache_modes Fam Zheng
2013-12-03  8:25 ` [Qemu-devel] [PATCH v5 4/6] qemu-iotests: Change default cache mode to "writeback" Fam Zheng
2013-12-03  8:25 ` [Qemu-devel] [PATCH v5 5/6] qemu-iotests: Clean up spaces in usage output Fam Zheng
2013-12-03 14:31   ` Benoît Canet
2013-12-04  1:01     ` Fam Zheng
2013-12-03  8:25 ` [Qemu-devel] [PATCH v5 6/6] qemu-iotests: Split qcow2 only cases in 048 Fam Zheng

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=1386059127-30962-2-git-send-email-famz@redhat.com \
    --to=famz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiawenc@linux.vnet.ibm.com \
    /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).