qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v7 0/3] Tests for LUKS driver
@ 2016-03-30 13:53 Daniel P. Berrange
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests Daniel P. Berrange
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

This series contains the 3 test suite patches that had
to be dropped from the v6 series during merge with
the block tree:

 v6: https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg04935.html

Changed in v7:

 - Avoid setting TEST_IMG_FILE when IMGPROTO=file in common.rc
   for traditional (not --image-opts) variable setup

Daniel P. Berrange (3):
  block: add support for --image-opts in block I/O tests
  block: add support for encryption secrets in block I/O tests
  block: enable testing of LUKS driver with block I/O tests

 tests/qemu-iotests/004           |  2 +-
 tests/qemu-iotests/012           |  2 +-
 tests/qemu-iotests/039.out       | 20 +++++------
 tests/qemu-iotests/048           | 22 ++++++++----
 tests/qemu-iotests/048.out       |  6 ++--
 tests/qemu-iotests/052           |  4 +++
 tests/qemu-iotests/052.out       |  4 +++
 tests/qemu-iotests/100           |  7 ++++
 tests/qemu-iotests/100.out       | 14 ++++++++
 tests/qemu-iotests/common        | 15 +++++++-
 tests/qemu-iotests/common.config | 21 ++++++++++--
 tests/qemu-iotests/common.filter |  3 +-
 tests/qemu-iotests/common.rc     | 74 +++++++++++++++++++++++++++++++---------
 13 files changed, 152 insertions(+), 42 deletions(-)

-- 
2.5.5

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests
  2016-03-30 13:53 [Qemu-devel] [PATCH v7 0/3] Tests for LUKS driver Daniel P. Berrange
@ 2016-03-30 13:53 ` Daniel P. Berrange
  2016-03-30 15:44   ` Max Reitz
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets " Daniel P. Berrange
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with " Daniel P. Berrange
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

Currently all block tests use the traditional syntax for images
just specifying a filename. To support the LUKS driver without
resorting to JSON, the tests need to be able to use the new
--image-opts argument to qemu-img and qemu-io.

This introduces a new env variable IMGOPTSSYNTAX. If this is
set to 'true', then qemu-img/qemu-io should use --image-opts.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 tests/qemu-iotests/039.out       | 20 +++++++-------
 tests/qemu-iotests/common        |  7 ++++-
 tests/qemu-iotests/common.config | 15 +++++++++--
 tests/qemu-iotests/common.rc     | 57 +++++++++++++++++++++++++++++-----------
 4 files changed, 71 insertions(+), 28 deletions(-)

diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
index 32c8846..c6e0ac2 100644
--- a/tests/qemu-iotests/039.out
+++ b/tests/qemu-iotests/039.out
@@ -12,9 +12,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
-    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
-    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 fi )
 incompatible_features     0x1
 ERROR cluster 5 refcount=0 reference=1
@@ -51,9 +51,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
-    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
-    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 fi )
 incompatible_features     0x1
 ERROR cluster 5 refcount=0 reference=1
@@ -69,9 +69,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
-    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
-    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 fi )
 incompatible_features     0x0
 No errors were found on the image.
@@ -92,9 +92,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
-    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
-    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 fi )
 incompatible_features     0x1
 ERROR cluster 5 refcount=0 reference=1
@@ -106,9 +106,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
-    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 else
-    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
+    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
 fi )
 incompatible_features     0x0
 No errors were found on the image.
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index 49e1931..fe3b1a0 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -53,6 +53,7 @@ export QEMU_IO_OPTIONS=""
 export CACHEMODE_IS_DEFAULT=true
 export QEMU_OPTIONS="-nodefaults"
 export VALGRIND_QEMU=
+export IMGOPTSSYNTAX=false
 
 for r
 do
@@ -399,7 +400,11 @@ 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 -f $IMGFMT --cache $CACHEMODE"
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+    QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS --cache $CACHEMODE"
+else
+    QEMU_IO_OPTIONS="$QEMU_IO_OPTIONS -f $IMGFMT --cache $CACHEMODE"
+fi
 
 # Set default options for qemu-img create -o if they were not specified
 _set_default_imgopts
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 60bfabf..6d4c829 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -123,12 +123,16 @@ _qemu_img_wrapper()
 _qemu_io_wrapper()
 {
     local VALGRIND_LOGFILE=/tmp/$$.valgrind
+    local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
+    if [ "$IMGOPTSSYNTAX" = "true" ]; then
+        QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
+    fi
     local RETVAL
     (
         if [ "${VALGRIND_QEMU}" == "y" ]; then
-            exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@"
+            exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
         else
-            exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@"
+            exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@"
         fi
     )
     RETVAL=$?
@@ -154,6 +158,13 @@ export QEMU_IMG=_qemu_img_wrapper
 export QEMU_IO=_qemu_io_wrapper
 export QEMU_NBD=_qemu_nbd_wrapper
 
+QEMU_IMG_EXTRA_ARGS=
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+    QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
+fi
+export QEMU_IMG_EXTRA_ARGS
+
+
 default_machine=$($QEMU -machine help | sed -n '/(default)/ s/ .*//p')
 default_alias_machine=$($QEMU -machine help | \
    sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d9913f8..d8a832d 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -53,21 +53,42 @@ fi
 # make sure we have a standard umask
 umask 022
 
-if [ "$IMGPROTO" = "file" ]; then
-    TEST_IMG=$TEST_DIR/t.$IMGFMT
-elif [ "$IMGPROTO" = "nbd" ]; then
-    TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
-    TEST_IMG="nbd:127.0.0.1:10810"
-elif [ "$IMGPROTO" = "ssh" ]; then
-    TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
-    TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE"
-elif [ "$IMGPROTO" = "nfs" ]; then
-    TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
-    TEST_IMG=$TEST_DIR/t.$IMGFMT
-elif [ "$IMGPROTO" = "archipelago" ]; then
-    TEST_IMG="archipelago:at.$IMGFMT"
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+    DRIVER="driver=$IMGFMT"
+    if [ "$IMGPROTO" = "file" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG="$DRIVER,file.filename=$TEST_DIR/t.$IMGFMT"
+    elif [ "$IMGPROTO" = "nbd" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG="$DRIVER,file.driver=nbd,file.host=127.0.0.1,file.port=10810"
+    elif [ "$IMGPROTO" = "ssh" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG="$DRIVER,file.driver=ssh,file.host=127.0.0.1,file.path=$TEST_IMG_FILE"
+    elif [ "$IMGPROTO" = "nfs" ]; then
+        TEST_DIR="$DRIVER,file.driver=nfs,file.filename=nfs://127.0.0.1/$TEST_DIR"
+        TEST_IMG=$TEST_DIR_OPTS/t.$IMGFMT
+    elif [ "$IMGPROTO" = "archipelago" ]; then
+        TEST_IMG="$DRIVER,file.driver=archipelago,file.volume=:at.$IMGFMT"
+    else
+        TEST_IMG="$DRIVER,file.driver=$IMGPROTO,file.filename=$TEST_DIR/t.$IMGFMT"
+    fi
 else
-    TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
+    if [ "$IMGPROTO" = "file" ]; then
+        TEST_IMG=$TEST_DIR/t.$IMGFMT
+    elif [ "$IMGPROTO" = "nbd" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG="nbd:127.0.0.1:10810"
+    elif [ "$IMGPROTO" = "ssh" ]; then
+        TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
+        TEST_IMG="ssh://127.0.0.1$TEST_IMG_FILE"
+    elif [ "$IMGPROTO" = "nfs" ]; then
+        TEST_DIR="nfs://127.0.0.1/$TEST_DIR"
+        TEST_IMG=$TEST_DIR/t.$IMGFMT
+    elif [ "$IMGPROTO" = "archipelago" ]; then
+        TEST_IMG="archipelago:at.$IMGFMT"
+    else
+        TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
+    fi
 fi
 
 _optstr_add()
@@ -199,7 +220,13 @@ _cleanup_test_img()
 
 _check_test_img()
 {
-    $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1 | _filter_testdir | \
+    (
+        if [ "$IMGOPTSSYNTAX" = "true" ]; then
+            $QEMU_IMG check --image-opts "$@" "$TEST_IMG" 2>&1
+        else
+            $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1
+        fi
+    ) | _filter_testdir | \
         sed -e '/allocated.*fragmented.*compressed clusters/d' \
             -e 's/qemu-img: This image format does not support checks/No errors were found on the image./' \
             -e '/Image end offset: [0-9]\+/d'
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets in block I/O tests
  2016-03-30 13:53 [Qemu-devel] [PATCH v7 0/3] Tests for LUKS driver Daniel P. Berrange
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests Daniel P. Berrange
@ 2016-03-30 13:53 ` Daniel P. Berrange
  2016-03-30 15:51   ` Max Reitz
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with " Daniel P. Berrange
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

The LUKS block driver tests will require the ability to specify
encryption secrets with block devices. This requires using the
--object argument to qemu-img/qemu-io to create a 'secret'
object.

When the IMGKEYSECRET env variable is set, it provides the
password to be associated with a secret called 'keysec0'

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 tests/qemu-iotests/common        |  1 +
 tests/qemu-iotests/common.config |  6 ++++++
 tests/qemu-iotests/common.filter |  3 ++-
 tests/qemu-iotests/common.rc     | 16 +++++++++++++---
 4 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index fe3b1a0..e87287c 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -53,6 +53,7 @@ export QEMU_IO_OPTIONS=""
 export CACHEMODE_IS_DEFAULT=true
 export QEMU_OPTIONS="-nodefaults"
 export VALGRIND_QEMU=
+export IMGKEYSECRET=
 export IMGOPTSSYNTAX=false
 
 for r
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 6d4c829..5ec40d3 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -126,6 +126,9 @@ _qemu_io_wrapper()
     local QEMU_IO_ARGS="$QEMU_IO_OPTIONS"
     if [ "$IMGOPTSSYNTAX" = "true" ]; then
         QEMU_IO_ARGS="--image-opts $QEMU_IO_ARGS"
+        if [ -n "$IMGKEYSECRET" ]; then
+            QEMU_IO_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IO_ARGS"
+        fi
     fi
     local RETVAL
     (
@@ -161,6 +164,9 @@ export QEMU_NBD=_qemu_nbd_wrapper
 QEMU_IMG_EXTRA_ARGS=
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     QEMU_IMG_EXTRA_ARGS="--image-opts $QEMU_IMG_EXTRA_ARGS"
+    if [ -n "$IMGKEYSECRET" ]; then
+        QEMU_IMG_EXTRA_ARGS="--object secret,id=keysec0,data=$IMGKEYSECRET $QEMU_IMG_EXTRA_ARGS"
+    fi
 fi
 export QEMU_IMG_EXTRA_ARGS
 
diff --git a/tests/qemu-iotests/common.filter b/tests/qemu-iotests/common.filter
index 84b7434..cbd3607 100644
--- a/tests/qemu-iotests/common.filter
+++ b/tests/qemu-iotests/common.filter
@@ -198,7 +198,8 @@ _filter_img_create()
         -e "s# block_state_zero=\\(on\\|off\\)##g" \
         -e "s# log_size=[0-9]\\+##g" \
         -e "s/archipelago:a/TEST_DIR\//g" \
-        -e "s# refcount_bits=[0-9]\\+##g"
+        -e "s# refcount_bits=[0-9]\\+##g" \
+        -e "s# key-secret=[a-zA-Z0-9]\\+##g"
 }
 
 _filter_img_info()
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index d8a832d..355dbb2 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -129,6 +129,7 @@ _make_test_img()
     local img_name=""
     local use_backing=0
     local backing_file=""
+    local object_options=""
 
     if [ -n "$TEST_IMG_FILE" ]; then
         img_name=$TEST_IMG_FILE
@@ -139,6 +140,10 @@ _make_test_img()
     if [ -n "$IMGOPTS" ]; then
         optstr=$(_optstr_add "$optstr" "$IMGOPTS")
     fi
+    if [ -n "$IMGKEYSECRET" ]; then
+        object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
+        optstr=$(_optstr_add "$optstr" "key-secret=keysec0")
+    fi
 
     if [ "$1" = "-b" ]; then
         use_backing=1
@@ -156,9 +161,9 @@ _make_test_img()
     # XXX(hch): have global image options?
     (
      if [ $use_backing = 1 ]; then
-        $QEMU_IMG create -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
+        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options -b "$backing_file" "$img_name" $image_size 2>&1
      else
-        $QEMU_IMG create -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
+        $QEMU_IMG create $object_options -f $IMGFMT $extra_img_options "$img_name" $image_size 2>&1
      fi
     ) | _filter_img_create
 
@@ -222,7 +227,12 @@ _check_test_img()
 {
     (
         if [ "$IMGOPTSSYNTAX" = "true" ]; then
-            $QEMU_IMG check --image-opts "$@" "$TEST_IMG" 2>&1
+            object_options=
+            if [ -n "$IMGKEYSECRET" ]; then
+                object_options="--object secret,id=keysec0,data=$IMGKEYSECRET"
+            fi
+
+            $QEMU_IMG check $object_options --image-opts "$@" "$TEST_IMG" 2>&1
         else
             $QEMU_IMG check "$@" -f $IMGFMT "$TEST_IMG" 2>&1
         fi
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with block I/O tests
  2016-03-30 13:53 [Qemu-devel] [PATCH v7 0/3] Tests for LUKS driver Daniel P. Berrange
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests Daniel P. Berrange
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets " Daniel P. Berrange
@ 2016-03-30 13:53 ` Daniel P. Berrange
  2016-03-30 16:03   ` Max Reitz
  2 siblings, 1 reply; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 13:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Kevin Wolf, qemu-block, Max Reitz

This adds support for testing the LUKS driver with the block
I/O test framework.

   cd tests/qemu-io-tests
   ./check -luks

A handful of test cases are modified to work with luks

 - 004 - whitelist luks format
 - 012 - use TEST_IMG_FILE instead of TEST_IMG for file ops
 - 048 - use TEST_IMG_FILE instead of TEST_IMG for file ops.
         don't assume extended image contents is all zeros,
         explicitly initialize with zeros
         Make file size smaller to avoid having to decrypt
         1 GB of data.
 - 052 - don't assume initial image contents is all zeros,
         explicitly initialize with zeros
 - 100 - don't assume initial image contents is all zeros,
         explicitly initialize with zeros

With this patch applied, the results are as follows:

  Passed: 001 002 003 004 005 008 009 010 011 012 021 032 043
          047 048 049 052 087 100 134 143
  Failed: 033 120 140 145
 Skipped: 007 013 014 015 017 018 019 020 022 023 024 025 026
          027 028 029 030 031 034 035 036 037 038 039 040 041
          042 043 044 045 046 047 049 050 051 053 054 055 056
          057 058 059 060 061 062 063 064 065 066 067 068 069
          070 071 072 073 074 075 076 077 078 079 080 081 082
          083 084 085 086 087 088 089 090 091 092 093 094 095
          096 097 098 099 101 102 103 104 105 107 108 109 110
          111 112 113 114 115 116 117 118 119 121 122 123 124
          128 129 130 131 132 133 134 135 136 137 138 139 141
          142 144 146 148

The reasons for the failed tests are:

 - 033 - needs adapting to use image opts syntax with blkdebug
         and test image in order to correctly set align property
 - 120 - needs adapting to use correct -drive syntax for luks
 - 140 - needs adapting to use correct -drive syntax for luks
 - 145 - needs adapting to use correct -drive syntax for luks

The vast majority of skipped tests are exercising code that is
qcow2 specific, though a couple could probably be usefully
enabled for luks too.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 tests/qemu-iotests/004       |  2 +-
 tests/qemu-iotests/012       |  2 +-
 tests/qemu-iotests/048       | 22 +++++++++++++++-------
 tests/qemu-iotests/048.out   |  6 ++++--
 tests/qemu-iotests/052       |  4 ++++
 tests/qemu-iotests/052.out   |  4 ++++
 tests/qemu-iotests/100       |  7 +++++++
 tests/qemu-iotests/100.out   | 14 ++++++++++++++
 tests/qemu-iotests/common    |  7 +++++++
 tests/qemu-iotests/common.rc |  3 +++
 10 files changed, 60 insertions(+), 11 deletions(-)

diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004
index 2ad77ed..bd09437 100755
--- a/tests/qemu-iotests/004
+++ b/tests/qemu-iotests/004
@@ -38,7 +38,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
 . ./common.rc
 . ./common.filter
 
-_supported_fmt raw qcow qcow2 qed vdi vmdk vhdx
+_supported_fmt raw qcow qcow2 qed vdi vmdk vhdx luks
 _supported_proto generic
 _supported_os Linux
 
diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012
index 7c5b689..85ed20a 100755
--- a/tests/qemu-iotests/012
+++ b/tests/qemu-iotests/012
@@ -50,7 +50,7 @@ _make_test_img $size
 
 echo
 echo "== mark image read-only"
-chmod a-w "$TEST_IMG"
+chmod a-w "$TEST_IMG_FILE"
 
 echo
 echo "== read from read-only image"
diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
index e1eeac2..0e58364 100755
--- a/tests/qemu-iotests/048
+++ b/tests/qemu-iotests/048
@@ -31,13 +31,13 @@ _cleanup()
 {
     echo "Cleanup"
     _cleanup_test_img
-    rm "${TEST_IMG2}"
+    rm "${TEST_IMG_FILE2}"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
 _compare()
 {
-    $QEMU_IMG compare "$@" "$TEST_IMG" "${TEST_IMG2}"
+    $QEMU_IMG compare $QEMU_IMG_EXTRA_ARGS "$@" "$TEST_IMG" "${TEST_IMG2}"
     echo $?
 }
 
@@ -46,25 +46,33 @@ _compare()
 . ./common.filter
 . ./common.pattern
 
-_supported_fmt raw qcow qcow2 qed
+_supported_fmt raw qcow qcow2 qed luks
 _supported_proto file
 _supported_os Linux
 
 # Setup test basic parameters
 TEST_IMG2=$TEST_IMG.2
+TEST_IMG_FILE2=$TEST_IMG_FILE.2
 CLUSTER_SIZE=4096
-size=1024M
+size=128M
 
 _make_test_img $size
 io_pattern write 524288 $CLUSTER_SIZE $CLUSTER_SIZE 4 45
 
 # Compare identical images
-cp "$TEST_IMG" "${TEST_IMG2}"
+cp "$TEST_IMG_FILE" "${TEST_IMG_FILE2}"
 _compare
 _compare -q
 
 # Compare images with different size
-$QEMU_IMG resize -f $IMGFMT "$TEST_IMG" +512M
+if [ "$IMGOPTSSYNTAX" = "true" ]; then
+    $QEMU_IMG resize $QEMU_IMG_EXTRA_ARGS "$TEST_IMG" +32M
+else
+    $QEMU_IMG resize -f $IMGFMT "$TEST_IMG" +32M
+fi
+# Ensure extended space is zero-initialized
+$QEMU_IO "$TEST_IMG" -c "write -P 0 $size 32M" | _filter_qemu_io
+
 _compare
 _compare -s
 
@@ -77,7 +85,7 @@ _compare
 # Test unaligned case of mismatch offsets in allocated clusters
 _make_test_img $size
 io_pattern write 0 512 0 1 100
-cp "$TEST_IMG" "$TEST_IMG2"
+cp "$TEST_IMG_FILE" "$TEST_IMG_FILE2"
 io_pattern write 512 512 0 1 101
 _compare
 
diff --git a/tests/qemu-iotests/048.out b/tests/qemu-iotests/048.out
index 57100dc..0bcf663 100644
--- a/tests/qemu-iotests/048.out
+++ b/tests/qemu-iotests/048.out
@@ -1,5 +1,5 @@
 QA output created by 048
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 === IO: pattern 45
 wrote 4096/4096 bytes at offset 524288
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
@@ -13,6 +13,8 @@ Images are identical.
 0
 0
 Image resized.
+wrote 33554432/33554432 bytes at offset 134217728
+32 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Warning: Image size mismatch!
 Images are identical.
 0
@@ -28,7 +30,7 @@ wrote 4096/4096 bytes at offset 0
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Content mismatch at offset 0!
 1
-Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=1073741824
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 === IO: pattern 100
 wrote 512/512 bytes at offset 0
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index 61959e2..d408656 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -49,6 +49,10 @@ size=128M
 _make_test_img $size
 
 echo
+echo "== initializing whole image =="
+$QEMU_IO -c "write -P 0 0 $size" "$TEST_IMG" | _filter_qemu_io
+
+echo
 echo "== reading whole image =="
 $QEMU_IO -s -c "read 0 $size" "$TEST_IMG" | _filter_qemu_io
 
diff --git a/tests/qemu-iotests/052.out b/tests/qemu-iotests/052.out
index 9dab51c..a377d30 100644
--- a/tests/qemu-iotests/052.out
+++ b/tests/qemu-iotests/052.out
@@ -1,6 +1,10 @@
 QA output created by 052
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
 
+== initializing whole image ==
+wrote 134217728/134217728 bytes at offset 0
+128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
 == reading whole image ==
 read 134217728/134217728 bytes at offset 0
 128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
diff --git a/tests/qemu-iotests/100 b/tests/qemu-iotests/100
index 7c1b235..f548cf8 100755
--- a/tests/qemu-iotests/100
+++ b/tests/qemu-iotests/100
@@ -48,6 +48,7 @@ size=128M
 echo
 echo "== Single request =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 8k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 0 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -60,6 +61,7 @@ _cleanup_test_img
 echo
 echo "== Sequential requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 12k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 0 4k ; 4k 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -73,6 +75,7 @@ _cleanup_test_img
 echo
 echo "== Superset overlapping requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 8k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 0 4k ; 1k 2k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -88,6 +91,7 @@ _cleanup_test_img
 echo
 echo "== Subset overlapping requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 8k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 1k 2k ; 0k 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -103,6 +107,7 @@ _cleanup_test_img
 echo
 echo "== Head overlapping requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 8k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 0k 2k ; 0k 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -117,6 +122,7 @@ _cleanup_test_img
 echo
 echo "== Tail overlapping requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 8k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 2k 2k ; 0k 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
@@ -131,6 +137,7 @@ _cleanup_test_img
 echo
 echo "== Disjoint requests =="
 _make_test_img $size
+$QEMU_IO -c "write -P 0 0 72k" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "multiwrite 0 4k ; 64k 4k" "$TEST_IMG" | _filter_qemu_io
 
 echo
diff --git a/tests/qemu-iotests/100.out b/tests/qemu-iotests/100.out
index 0564903..a44cae4 100644
--- a/tests/qemu-iotests/100.out
+++ b/tests/qemu-iotests/100.out
@@ -2,6 +2,8 @@ QA output created by 100
 
 == Single request ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 8192/8192 bytes at offset 0
+8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 4096/4096 bytes at offset 0
 4 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -13,6 +15,8 @@ read 4096/4096 bytes at offset 4096
 
 == Sequential requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 12288/12288 bytes at offset 0
+12 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 8192/8192 bytes at offset 0
 8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -26,6 +30,8 @@ read 4096/4096 bytes at offset 8192
 
 == Superset overlapping requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 8192/8192 bytes at offset 0
+8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 6144/6144 bytes at offset 0
 6 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -39,6 +45,8 @@ read 4096/4096 bytes at offset 4096
 
 == Subset overlapping requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 8192/8192 bytes at offset 0
+8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 6144/6144 bytes at offset 1024
 6 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -52,6 +60,8 @@ read 4096/4096 bytes at offset 4096
 
 == Head overlapping requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 8192/8192 bytes at offset 0
+8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 6144/6144 bytes at offset 0
 6 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -63,6 +73,8 @@ read 4096/4096 bytes at offset 4096
 
 == Tail overlapping requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 8192/8192 bytes at offset 0
+8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 6144/6144 bytes at offset 2048
 6 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
@@ -74,6 +86,8 @@ read 4096/4096 bytes at offset 4096
 
 == Disjoint requests ==
 Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
+wrote 73728/73728 bytes at offset 0
+72 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 8192/8192 bytes at offset 0
 8 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common
index e87287c..d60ea2c 100644
--- a/tests/qemu-iotests/common
+++ b/tests/qemu-iotests/common
@@ -209,6 +209,13 @@ testlist options
             xpand=false
             ;;
 
+        -luks)
+            IMGOPTSSYNTAX=true
+            IMGFMT=luks
+            IMGKEYSECRET=123456
+            xpand=false
+            ;;
+
         -qed)
             IMGFMT=qed
             xpand=false
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 355dbb2..8f7d68e 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -55,6 +55,9 @@ umask 022
 
 if [ "$IMGOPTSSYNTAX" = "true" ]; then
     DRIVER="driver=$IMGFMT"
+    if [ "$IMGFMT" = "luks" ]; then
+        DRIVER="$DRIVER,key-secret=keysec0"
+    fi
     if [ "$IMGPROTO" = "file" ]; then
         TEST_IMG_FILE=$TEST_DIR/t.$IMGFMT
         TEST_IMG="$DRIVER,file.filename=$TEST_DIR/t.$IMGFMT"
-- 
2.5.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests Daniel P. Berrange
@ 2016-03-30 15:44   ` Max Reitz
  2016-03-30 15:52     ` Daniel P. Berrange
  0 siblings, 1 reply; 9+ messages in thread
From: Max Reitz @ 2016-03-30 15:44 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Kevin Wolf, qemu-block


[-- Attachment #1.1: Type: text/plain, Size: 4482 bytes --]

On 30.03.2016 15:53, Daniel P. Berrange wrote:
> Currently all block tests use the traditional syntax for images
> just specifying a filename. To support the LUKS driver without
> resorting to JSON, the tests need to be able to use the new
> --image-opts argument to qemu-img and qemu-io.
> 
> This introduces a new env variable IMGOPTSSYNTAX. If this is
> set to 'true', then qemu-img/qemu-io should use --image-opts.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/qemu-iotests/039.out       | 20 +++++++-------
>  tests/qemu-iotests/common        |  7 ++++-
>  tests/qemu-iotests/common.config | 15 +++++++++--
>  tests/qemu-iotests/common.rc     | 57 +++++++++++++++++++++++++++++-----------
>  4 files changed, 71 insertions(+), 28 deletions(-)
> 
> diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
> index 32c8846..c6e0ac2 100644
> --- a/tests/qemu-iotests/039.out
> +++ b/tests/qemu-iotests/039.out
> @@ -12,9 +12,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  else
> -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  fi )
>  incompatible_features     0x1
>  ERROR cluster 5 refcount=0 reference=1
> @@ -51,9 +51,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  else
> -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  fi )
>  incompatible_features     0x1
>  ERROR cluster 5 refcount=0 reference=1
> @@ -69,9 +69,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  else
> -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  fi )
>  incompatible_features     0x0
>  No errors were found on the image.
> @@ -92,9 +92,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  else
> -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  fi )
>  incompatible_features     0x1
>  ERROR cluster 5 refcount=0 reference=1
> @@ -106,9 +106,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
>  wrote 512/512 bytes at offset 0
>  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
>  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  else
> -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
>  fi )
>  incompatible_features     0x0
>  No errors were found on the image.

I think 061 and 137 need the same treatment.

Looks good apart from that.

Max


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets in block I/O tests
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets " Daniel P. Berrange
@ 2016-03-30 15:51   ` Max Reitz
  2016-03-30 15:53     ` Daniel P. Berrange
  0 siblings, 1 reply; 9+ messages in thread
From: Max Reitz @ 2016-03-30 15:51 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Kevin Wolf, qemu-block


[-- Attachment #1.1: Type: text/plain, Size: 916 bytes --]

On 30.03.2016 15:53, Daniel P. Berrange wrote:
> The LUKS block driver tests will require the ability to specify
> encryption secrets with block devices. This requires using the
> --object argument to qemu-img/qemu-io to create a 'secret'
> object.
> 
> When the IMGKEYSECRET env variable is set, it provides the
> password to be associated with a secret called 'keysec0'
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/qemu-iotests/common        |  1 +
>  tests/qemu-iotests/common.config |  6 ++++++
>  tests/qemu-iotests/common.filter |  3 ++-
>  tests/qemu-iotests/common.rc     | 16 +++++++++++++---
>  4 files changed, 22 insertions(+), 4 deletions(-)

Is there a reason why you didn't implement the same logic in
_qemu_img_wrapper as in _qemu_io_wrapper?

This works, but it appears a bit overcomplicated to me.

Reviewed-by: Max Reitz <mreitz@redhat.com>


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests
  2016-03-30 15:44   ` Max Reitz
@ 2016-03-30 15:52     ` Daniel P. Berrange
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 15:52 UTC (permalink / raw)
  To: Max Reitz; +Cc: Kevin Wolf, qemu-devel, qemu-block

On Wed, Mar 30, 2016 at 05:44:41PM +0200, Max Reitz wrote:
> On 30.03.2016 15:53, Daniel P. Berrange wrote:
> > Currently all block tests use the traditional syntax for images
> > just specifying a filename. To support the LUKS driver without
> > resorting to JSON, the tests need to be able to use the new
> > --image-opts argument to qemu-img and qemu-io.
> > 
> > This introduces a new env variable IMGOPTSSYNTAX. If this is
> > set to 'true', then qemu-img/qemu-io should use --image-opts.
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  tests/qemu-iotests/039.out       | 20 +++++++-------
> >  tests/qemu-iotests/common        |  7 ++++-
> >  tests/qemu-iotests/common.config | 15 +++++++++--
> >  tests/qemu-iotests/common.rc     | 57 +++++++++++++++++++++++++++++-----------
> >  4 files changed, 71 insertions(+), 28 deletions(-)
> > 
> > diff --git a/tests/qemu-iotests/039.out b/tests/qemu-iotests/039.out
> > index 32c8846..c6e0ac2 100644
> > --- a/tests/qemu-iotests/039.out
> > +++ b/tests/qemu-iotests/039.out
> > @@ -12,9 +12,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
> >  wrote 512/512 bytes at offset 0
> >  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> >  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> > -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  else
> > -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  fi )
> >  incompatible_features     0x1
> >  ERROR cluster 5 refcount=0 reference=1
> > @@ -51,9 +51,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
> >  wrote 512/512 bytes at offset 0
> >  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> >  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> > -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  else
> > -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  fi )
> >  incompatible_features     0x1
> >  ERROR cluster 5 refcount=0 reference=1
> > @@ -69,9 +69,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
> >  wrote 512/512 bytes at offset 0
> >  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> >  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> > -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  else
> > -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  fi )
> >  incompatible_features     0x0
> >  No errors were found on the image.
> > @@ -92,9 +92,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
> >  wrote 512/512 bytes at offset 0
> >  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> >  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> > -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  else
> > -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  fi )
> >  incompatible_features     0x1
> >  ERROR cluster 5 refcount=0 reference=1
> > @@ -106,9 +106,9 @@ Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728
> >  wrote 512/512 bytes at offset 0
> >  512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
> >  ./common.config: Killed                  ( if [ "${VALGRIND_QEMU}" == "y" ]; then
> > -    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec valgrind --log-file="${VALGRIND_LOGFILE}" --error-exitcode=99 "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  else
> > -    exec "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@";
> > +    exec "$QEMU_IO_PROG" $QEMU_IO_ARGS "$@";
> >  fi )
> >  incompatible_features     0x0
> >  No errors were found on the image.
> 
> I think 061 and 137 need the same treatment.
> 
> Looks good apart from that.

FWIW, I didn't attempt to update those because they're qcow2 only. I
only tried to update tests which were (potentially) runnable with
the luks block driver.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets in block I/O tests
  2016-03-30 15:51   ` Max Reitz
@ 2016-03-30 15:53     ` Daniel P. Berrange
  0 siblings, 0 replies; 9+ messages in thread
From: Daniel P. Berrange @ 2016-03-30 15:53 UTC (permalink / raw)
  To: Max Reitz; +Cc: Kevin Wolf, qemu-devel, qemu-block

On Wed, Mar 30, 2016 at 05:51:16PM +0200, Max Reitz wrote:
> On 30.03.2016 15:53, Daniel P. Berrange wrote:
> > The LUKS block driver tests will require the ability to specify
> > encryption secrets with block devices. This requires using the
> > --object argument to qemu-img/qemu-io to create a 'secret'
> > object.
> > 
> > When the IMGKEYSECRET env variable is set, it provides the
> > password to be associated with a secret called 'keysec0'
> > 
> > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > ---
> >  tests/qemu-iotests/common        |  1 +
> >  tests/qemu-iotests/common.config |  6 ++++++
> >  tests/qemu-iotests/common.filter |  3 ++-
> >  tests/qemu-iotests/common.rc     | 16 +++++++++++++---
> >  4 files changed, 22 insertions(+), 4 deletions(-)
> 
> Is there a reason why you didn't implement the same logic in
> _qemu_img_wrapper as in _qemu_io_wrapper?

Mostly because the --image-opts syntax isn't used with
the 'create' command for qemu-img. I guess I could have
trie to detect which command was being run and set the
args accordingly.

> This works, but it appears a bit overcomplicated to me.
> 
> Reviewed-by: Max Reitz <mreitz@redhat.com>

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with block I/O tests
  2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with " Daniel P. Berrange
@ 2016-03-30 16:03   ` Max Reitz
  0 siblings, 0 replies; 9+ messages in thread
From: Max Reitz @ 2016-03-30 16:03 UTC (permalink / raw)
  To: Daniel P. Berrange, qemu-devel; +Cc: Kevin Wolf, qemu-block


[-- Attachment #1.1: Type: text/plain, Size: 4376 bytes --]

On 30.03.2016 15:53, Daniel P. Berrange wrote:
> This adds support for testing the LUKS driver with the block
> I/O test framework.
> 
>    cd tests/qemu-io-tests
>    ./check -luks
> 
> A handful of test cases are modified to work with luks
> 
>  - 004 - whitelist luks format
>  - 012 - use TEST_IMG_FILE instead of TEST_IMG for file ops
>  - 048 - use TEST_IMG_FILE instead of TEST_IMG for file ops.

Well, that doesn't always work now that you kept TEST_IMG_FILE unset for
file-protocol tests.

(Both fail because some command in them cannot find the file ''.)

>          don't assume extended image contents is all zeros,
>          explicitly initialize with zeros
>          Make file size smaller to avoid having to decrypt
>          1 GB of data.
>  - 052 - don't assume initial image contents is all zeros,
>          explicitly initialize with zeros
>  - 100 - don't assume initial image contents is all zeros,
>          explicitly initialize with zeros
> 
> With this patch applied, the results are as follows:
> 
>   Passed: 001 002 003 004 005 008 009 010 011 012 021 032 043
>           047 048 049 052 087 100 134 143
>   Failed: 033 120 140 145
>  Skipped: 007 013 014 015 017 018 019 020 022 023 024 025 026
>           027 028 029 030 031 034 035 036 037 038 039 040 041
>           042 043 044 045 046 047 049 050 051 053 054 055 056
>           057 058 059 060 061 062 063 064 065 066 067 068 069
>           070 071 072 073 074 075 076 077 078 079 080 081 082
>           083 084 085 086 087 088 089 090 091 092 093 094 095
>           096 097 098 099 101 102 103 104 105 107 108 109 110
>           111 112 113 114 115 116 117 118 119 121 122 123 124
>           128 129 130 131 132 133 134 135 136 137 138 139 141
>           142 144 146 148
> 
> The reasons for the failed tests are:
> 
>  - 033 - needs adapting to use image opts syntax with blkdebug
>          and test image in order to correctly set align property
>  - 120 - needs adapting to use correct -drive syntax for luks
>  - 140 - needs adapting to use correct -drive syntax for luks
>  - 145 - needs adapting to use correct -drive syntax for luks
> 
> The vast majority of skipped tests are exercising code that is
> qcow2 specific, though a couple could probably be usefully
> enabled for luks too.
> 
> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> ---
>  tests/qemu-iotests/004       |  2 +-
>  tests/qemu-iotests/012       |  2 +-
>  tests/qemu-iotests/048       | 22 +++++++++++++++-------
>  tests/qemu-iotests/048.out   |  6 ++++--
>  tests/qemu-iotests/052       |  4 ++++
>  tests/qemu-iotests/052.out   |  4 ++++
>  tests/qemu-iotests/100       |  7 +++++++
>  tests/qemu-iotests/100.out   | 14 ++++++++++++++
>  tests/qemu-iotests/common    |  7 +++++++
>  tests/qemu-iotests/common.rc |  3 +++
>  10 files changed, 60 insertions(+), 11 deletions(-)
> 

[...]

> diff --git a/tests/qemu-iotests/048 b/tests/qemu-iotests/048
> index e1eeac2..0e58364 100755
> --- a/tests/qemu-iotests/048
> +++ b/tests/qemu-iotests/048

[...]

> @@ -46,25 +46,33 @@ _compare()
>  . ./common.filter
>  . ./common.pattern
>  
> -_supported_fmt raw qcow qcow2 qed
> +_supported_fmt raw qcow qcow2 qed luks
>  _supported_proto file
>  _supported_os Linux
>  
>  # Setup test basic parameters
>  TEST_IMG2=$TEST_IMG.2
> +TEST_IMG_FILE2=$TEST_IMG_FILE.2
>  CLUSTER_SIZE=4096
> -size=1024M
> +size=128M
>  
>  _make_test_img $size
>  io_pattern write 524288 $CLUSTER_SIZE $CLUSTER_SIZE 4 45
>  
>  # Compare identical images
> -cp "$TEST_IMG" "${TEST_IMG2}"
> +cp "$TEST_IMG_FILE" "${TEST_IMG_FILE2}"
>  _compare
>  _compare -q
>  
>  # Compare images with different size
> -$QEMU_IMG resize -f $IMGFMT "$TEST_IMG" +512M
> +if [ "$IMGOPTSSYNTAX" = "true" ]; then
> +    $QEMU_IMG resize $QEMU_IMG_EXTRA_ARGS "$TEST_IMG" +32M
> +else
> +    $QEMU_IMG resize -f $IMGFMT "$TEST_IMG" +32M

If you don't decide to pass QEMU_IMG_EXTRA_ARGS in the
_qemu_img_wrapper, maybe you could set it to "-f $IMGFMT" if
$IMGOPTSSYNTAX is false.

(Keeping this as it is won't stop me from giving an R-b, though.)

Max

> +fi
> +# Ensure extended space is zero-initialized
> +$QEMU_IO "$TEST_IMG" -c "write -P 0 $size 32M" | _filter_qemu_io
> +
>  _compare
>  _compare -s
>  



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-03-30 16:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-30 13:53 [Qemu-devel] [PATCH v7 0/3] Tests for LUKS driver Daniel P. Berrange
2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 1/3] block: add support for --image-opts in block I/O tests Daniel P. Berrange
2016-03-30 15:44   ` Max Reitz
2016-03-30 15:52     ` Daniel P. Berrange
2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 2/3] block: add support for encryption secrets " Daniel P. Berrange
2016-03-30 15:51   ` Max Reitz
2016-03-30 15:53     ` Daniel P. Berrange
2016-03-30 13:53 ` [Qemu-devel] [PATCH v7 3/3] block: enable testing of LUKS driver with " Daniel P. Berrange
2016-03-30 16:03   ` Max Reitz

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).