diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/qemu-iotests/059 | 5 | ||||
-rw-r--r-- | tests/qemu-iotests/059.out | 3 | ||||
-rwxr-xr-x | tests/qemu-iotests/134 | 69 | ||||
-rw-r--r-- | tests/qemu-iotests/134.out | 46 | ||||
-rwxr-xr-x | tests/qemu-iotests/check | 12 | ||||
-rw-r--r-- | tests/qemu-iotests/common | 6 | ||||
-rw-r--r-- | tests/qemu-iotests/group | 1 | ||||
-rw-r--r-- | tests/qemu-iotests/iotests.py | 14 | ||||
-rw-r--r-- | tests/qemu-iotests/sample_images/afl9.vmdk.bz2 | bin | 0 -> 178 bytes |
9 files changed, 150 insertions, 6 deletions
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059 index 50ca5ce681..0ded0c3da4 100755 --- a/tests/qemu-iotests/059 +++ b/tests/qemu-iotests/059 @@ -132,6 +132,11 @@ _img_info $QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io $QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io +echo +echo "=== Testing afl image with a very large capacity ===" +_use_sample_img afl9.vmdk.bz2 +_img_info + # success, all done echo "*** done" rm -f $seq.full diff --git a/tests/qemu-iotests/059.out b/tests/qemu-iotests/059.out index cbb0de4254..67e3cf57e4 100644 --- a/tests/qemu-iotests/059.out +++ b/tests/qemu-iotests/059.out @@ -2336,4 +2336,7 @@ e1000003e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ e1000003f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ read 1024/1024 bytes at offset 966367641600 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +=== Testing afl image with a very large capacity === +qemu-img: Can't get size of device 'image': File too large *** done diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134 new file mode 100755 index 0000000000..1c3820b17e --- /dev/null +++ b/tests/qemu-iotests/134 @@ -0,0 +1,69 @@ +#!/bin/bash +# +# Test encrypted read/write using plain bdrv_read/bdrv_write +# +# Copyright (C) 2015 Red Hat, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +# creator +owner=berrange@redhat.com + +seq=`basename $0` +echo "QA output created by $seq" + +here=`pwd` +tmp=/tmp/$$ +status=1 # failure is the default! + +_cleanup() +{ + _cleanup_test_img +} +trap "_cleanup; exit \$status" 0 1 2 3 15 + +# get standard environment, filters and checks +. ./common.rc +. ./common.filter + +_supported_fmt qcow2 +_supported_proto generic +_supported_os Linux + + +size=128M +IMGOPTS="encryption=on" _make_test_img $size + +echo +echo "== reading whole image ==" +echo "astrochicken" | $QEMU_IO -c "read 0 $size" "$TEST_IMG" | _filter_qemu_io | _filter_testdir + +echo +echo "== rewriting whole image ==" +echo "astrochicken" | $QEMU_IO -c "write -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io | _filter_testdir + +echo +echo "== verify pattern ==" +echo "astrochicken" | $QEMU_IO -c "read -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io | _filter_testdir + +echo +echo "== verify pattern failure with wrong password ==" +echo "platypus" | $QEMU_IO -c "read -P 0xa 0 $size" "$TEST_IMG" | _filter_qemu_io | _filter_testdir + + +# success, all done +echo "*** done" +rm -f $seq.full +status=0 diff --git a/tests/qemu-iotests/134.out b/tests/qemu-iotests/134.out new file mode 100644 index 0000000000..a16acb81cd --- /dev/null +++ b/tests/qemu-iotests/134.out @@ -0,0 +1,46 @@ +QA output created by 134 +qemu-img: Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +qemu-img: Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=134217728 encryption=on + +== reading whole image == +Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +Disk image 'TEST_DIR/t.qcow2' is encrypted. +password: +read 134217728/134217728 bytes at offset 0 +128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== rewriting whole image == +Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +Disk image 'TEST_DIR/t.qcow2' is encrypted. +password: +wrote 134217728/134217728 bytes at offset 0 +128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== verify pattern == +Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +Disk image 'TEST_DIR/t.qcow2' is encrypted. +password: +read 134217728/134217728 bytes at offset 0 +128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) + +== verify pattern failure with wrong password == +Encrypted images are deprecated +Support for them will be removed in a future release. +You can use 'qemu-img convert' to convert your image to an unencrypted one. +Disk image 'TEST_DIR/t.qcow2' is encrypted. +password: +Pattern verification failed at offset 0, 134217728 bytes +read 134217728/134217728 bytes at offset 0 +128 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec) +*** done diff --git a/tests/qemu-iotests/check b/tests/qemu-iotests/check index baeae80f96..1fa63193ba 100755 --- a/tests/qemu-iotests/check +++ b/tests/qemu-iotests/check @@ -296,9 +296,15 @@ do run_command="./$seq" fi export OUTPUT_DIR=$PWD - (cd "$source_iotests"; - MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ - $run_command >$tmp.out 2>&1) + if $debug; then + (cd "$source_iotests"; + MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ + $run_command -d 2>&1 | tee $tmp.out) + else + (cd "$source_iotests"; + MALLOC_PERTURB_=${MALLOC_PERTURB_:-$(($RANDOM % 255 + 1))} \ + $run_command >$tmp.out 2>&1) + fi sts=$? $timestamp && _timestamp stop=`_wallclock` diff --git a/tests/qemu-iotests/common b/tests/qemu-iotests/common index 1e556bbb7d..1030aaf25b 100644 --- a/tests/qemu-iotests/common +++ b/tests/qemu-iotests/common @@ -32,6 +32,7 @@ check=${check-true} diff="diff -u" verbose=false +debug=false group=false xgroup=false imgopts=false @@ -132,6 +133,7 @@ s/ .*//p common options -v verbose + -d debug check options -raw test raw (default) @@ -322,6 +324,10 @@ testlist options verbose=true xpand=false ;; + -d) + debug=true + xpand=false + ;; -x) # -x group ... exclude from group file xgroup=true xpand=false diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group index 34b16cb81a..0b817ca32d 100644 --- a/tests/qemu-iotests/group +++ b/tests/qemu-iotests/group @@ -129,3 +129,4 @@ 129 rw auto quick 130 rw auto quick 131 rw auto quick +134 rw auto quick diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index e93e62387b..04a294d747 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -338,6 +338,8 @@ def notrun(reason): def main(supported_fmts=[], supported_oses=['linux']): '''Run tests''' + debug = '-d' in sys.argv + verbosity = 1 if supported_fmts and (imgfmt not in supported_fmts): notrun('not suitable for this image format: %s' % imgfmt) @@ -347,14 +349,20 @@ def main(supported_fmts=[], supported_oses=['linux']): # We need to filter out the time taken from the output so that qemu-iotest # can reliably diff the results against master output. import StringIO - output = StringIO.StringIO() + if debug: + output = sys.stdout + verbosity = 2 + sys.argv.remove('-d') + else: + output = StringIO.StringIO() class MyTestRunner(unittest.TextTestRunner): - def __init__(self, stream=output, descriptions=True, verbosity=1): + def __init__(self, stream=output, descriptions=True, verbosity=verbosity): unittest.TextTestRunner.__init__(self, stream, descriptions, verbosity) # unittest.main() will use sys.exit() so expect a SystemExit exception try: unittest.main(testRunner=MyTestRunner) finally: - sys.stderr.write(re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran \1 tests', output.getvalue())) + if not debug: + sys.stderr.write(re.sub(r'Ran (\d+) tests? in [\d.]+s', r'Ran \1 tests', output.getvalue())) diff --git a/tests/qemu-iotests/sample_images/afl9.vmdk.bz2 b/tests/qemu-iotests/sample_images/afl9.vmdk.bz2 Binary files differnew file mode 100644 index 0000000000..03615d36a1 --- /dev/null +++ b/tests/qemu-iotests/sample_images/afl9.vmdk.bz2 |