aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-11-19 18:11:10 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-11-19 18:11:10 +0000
commit393aac1629c8f82b7c448c8615745e89984899a8 (patch)
treee56ac6e9ea5caa42b1ee12cfb296de95b17e3d53
parentd304cf014bf9feec3dcd7ee65c75a7f52206ecdf (diff)
parent8cedcffdc195bc39aeb1373826ba0a45629741e0 (diff)
downloadqemu-393aac1629c8f82b7c448c8615745e89984899a8.zip
qemu-393aac1629c8f82b7c448c8615745e89984899a8.tar.gz
qemu-393aac1629c8f82b7c448c8615745e89984899a8.tar.bz2
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2018-11-19' into staging
nbd patches for 2018-11-19 Add iotest coverage for NBD connections using TLS, including a couple of code fixes that it pointed out - Mao Zhongyi: 0/3 Do some cleaning work in qemu-iotests - Daniel P. Berrangé: io: return 0 for EOF in TLS session read after shutdown - Daniel P. Berrangé: 0/6 Misc fixes to NBD - Eric Blake: iotests: Drop use of bash keyword 'function' # gpg: Signature made Mon 19 Nov 2018 17:43:32 GMT # gpg: using RSA key A7A16B4A2527436A # gpg: Good signature from "Eric Blake <eblake@redhat.com>" # gpg: aka "Eric Blake (Free Software Programmer) <ebb9@byu.net>" # gpg: aka "[jpeg image of size 6874]" # Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2 F3AA A7A1 6B4A 2527 436A * remotes/ericb/tags/pull-nbd-2018-11-19: iotests: Drop use of bash keyword 'function' iotests: Also test I/O over NBD TLS tests: exercise NBD server in TLS mode tests: add iotests helpers for dealing with TLS certificates tests: check if qemu-nbd is still alive before waiting tests: pull qemu-nbd iotest helpers into common.nbd file io: return 0 for EOF in TLS session read after shutdown nbd/server: Ignore write errors when replying to NBD_OPT_ABORT nbd: fix whitespace in server error message qemu-iotests: Modern shell scripting (use $() instead of ``) qemu-iotests: convert `pwd` and $(pwd) to $PWD qemu-iotests: remove unused variable 'here' Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rwxr-xr-xconfigure2
-rw-r--r--crypto/tlssession.c3
-rw-r--r--include/io/channel-tls.h1
-rw-r--r--include/io/channel.h6
-rw-r--r--io/channel-tls.c5
-rw-r--r--nbd/server.c14
-rw-r--r--scripts/coccinelle/tcg_gen_extract.cocci2
-rwxr-xr-xtests/check-block.sh6
-rwxr-xr-xtests/qemu-iotests/0011
-rwxr-xr-xtests/qemu-iotests/0021
-rwxr-xr-xtests/qemu-iotests/0031
-rwxr-xr-xtests/qemu-iotests/0041
-rwxr-xr-xtests/qemu-iotests/0051
-rwxr-xr-xtests/qemu-iotests/0071
-rwxr-xr-xtests/qemu-iotests/0081
-rwxr-xr-xtests/qemu-iotests/0091
-rwxr-xr-xtests/qemu-iotests/0101
-rwxr-xr-xtests/qemu-iotests/0111
-rwxr-xr-xtests/qemu-iotests/0121
-rwxr-xr-xtests/qemu-iotests/0131
-rwxr-xr-xtests/qemu-iotests/0141
-rwxr-xr-xtests/qemu-iotests/0151
-rwxr-xr-xtests/qemu-iotests/0171
-rwxr-xr-xtests/qemu-iotests/0181
-rwxr-xr-xtests/qemu-iotests/0191
-rwxr-xr-xtests/qemu-iotests/0201
-rwxr-xr-xtests/qemu-iotests/0211
-rwxr-xr-xtests/qemu-iotests/0221
-rwxr-xr-xtests/qemu-iotests/0231
-rwxr-xr-xtests/qemu-iotests/0241
-rwxr-xr-xtests/qemu-iotests/0251
-rwxr-xr-xtests/qemu-iotests/0261
-rwxr-xr-xtests/qemu-iotests/0271
-rwxr-xr-xtests/qemu-iotests/0281
-rwxr-xr-xtests/qemu-iotests/0291
-rwxr-xr-xtests/qemu-iotests/0311
-rwxr-xr-xtests/qemu-iotests/0321
-rwxr-xr-xtests/qemu-iotests/0331
-rwxr-xr-xtests/qemu-iotests/0341
-rwxr-xr-xtests/qemu-iotests/0353
-rwxr-xr-xtests/qemu-iotests/0361
-rwxr-xr-xtests/qemu-iotests/0373
-rwxr-xr-xtests/qemu-iotests/0387
-rwxr-xr-xtests/qemu-iotests/0391
-rwxr-xr-xtests/qemu-iotests/0421
-rwxr-xr-xtests/qemu-iotests/0431
-rwxr-xr-xtests/qemu-iotests/0467
-rwxr-xr-xtests/qemu-iotests/0473
-rwxr-xr-xtests/qemu-iotests/0495
-rwxr-xr-xtests/qemu-iotests/0501
-rwxr-xr-xtests/qemu-iotests/0515
-rwxr-xr-xtests/qemu-iotests/0521
-rwxr-xr-xtests/qemu-iotests/0531
-rwxr-xr-xtests/qemu-iotests/0541
-rwxr-xr-xtests/qemu-iotests/05848
-rwxr-xr-xtests/qemu-iotests/0591
-rwxr-xr-xtests/qemu-iotests/0601
-rwxr-xr-xtests/qemu-iotests/0611
-rwxr-xr-xtests/qemu-iotests/0621
-rwxr-xr-xtests/qemu-iotests/0631
-rwxr-xr-xtests/qemu-iotests/0641
-rwxr-xr-xtests/qemu-iotests/0661
-rwxr-xr-xtests/qemu-iotests/0675
-rwxr-xr-xtests/qemu-iotests/0681
-rwxr-xr-xtests/qemu-iotests/0691
-rwxr-xr-xtests/qemu-iotests/0701
-rwxr-xr-xtests/qemu-iotests/0715
-rwxr-xr-xtests/qemu-iotests/0721
-rwxr-xr-xtests/qemu-iotests/0731
-rwxr-xr-xtests/qemu-iotests/0751
-rwxr-xr-xtests/qemu-iotests/0761
-rwxr-xr-xtests/qemu-iotests/0775
-rwxr-xr-xtests/qemu-iotests/0781
-rwxr-xr-xtests/qemu-iotests/0791
-rwxr-xr-xtests/qemu-iotests/0801
-rwxr-xr-xtests/qemu-iotests/0815
-rwxr-xr-xtests/qemu-iotests/0823
-rwxr-xr-xtests/qemu-iotests/0831
-rwxr-xr-xtests/qemu-iotests/0841
-rwxr-xr-xtests/qemu-iotests/08511
-rwxr-xr-xtests/qemu-iotests/0863
-rwxr-xr-xtests/qemu-iotests/0877
-rwxr-xr-xtests/qemu-iotests/0881
-rwxr-xr-xtests/qemu-iotests/0891
-rwxr-xr-xtests/qemu-iotests/0901
-rwxr-xr-xtests/qemu-iotests/0911
-rwxr-xr-xtests/qemu-iotests/0921
-rwxr-xr-xtests/qemu-iotests/0941
-rwxr-xr-xtests/qemu-iotests/0951
-rwxr-xr-xtests/qemu-iotests/0971
-rwxr-xr-xtests/qemu-iotests/0981
-rwxr-xr-xtests/qemu-iotests/0997
-rwxr-xr-xtests/qemu-iotests/1011
-rwxr-xr-xtests/qemu-iotests/1021
-rwxr-xr-xtests/qemu-iotests/1031
-rwxr-xr-xtests/qemu-iotests/1041
-rwxr-xr-xtests/qemu-iotests/1051
-rwxr-xr-xtests/qemu-iotests/1061
-rwxr-xr-xtests/qemu-iotests/1071
-rwxr-xr-xtests/qemu-iotests/1081
-rwxr-xr-xtests/qemu-iotests/1093
-rwxr-xr-xtests/qemu-iotests/1101
-rwxr-xr-xtests/qemu-iotests/1111
-rwxr-xr-xtests/qemu-iotests/1123
-rwxr-xr-xtests/qemu-iotests/1131
-rwxr-xr-xtests/qemu-iotests/1141
-rwxr-xr-xtests/qemu-iotests/1151
-rwxr-xr-xtests/qemu-iotests/1161
-rwxr-xr-xtests/qemu-iotests/1171
-rwxr-xr-xtests/qemu-iotests/1191
-rwxr-xr-xtests/qemu-iotests/1201
-rwxr-xr-xtests/qemu-iotests/1211
-rwxr-xr-xtests/qemu-iotests/1221
-rwxr-xr-xtests/qemu-iotests/1231
-rwxr-xr-xtests/qemu-iotests/1251
-rwxr-xr-xtests/qemu-iotests/1261
-rwxr-xr-xtests/qemu-iotests/1271
-rwxr-xr-xtests/qemu-iotests/1281
-rwxr-xr-xtests/qemu-iotests/1301
-rwxr-xr-xtests/qemu-iotests/1311
-rwxr-xr-xtests/qemu-iotests/1331
-rwxr-xr-xtests/qemu-iotests/1341
-rwxr-xr-xtests/qemu-iotests/1351
-rwxr-xr-xtests/qemu-iotests/1371
-rwxr-xr-xtests/qemu-iotests/1381
-rwxr-xr-xtests/qemu-iotests/1401
-rwxr-xr-xtests/qemu-iotests/1411
-rwxr-xr-xtests/qemu-iotests/1429
-rwxr-xr-xtests/qemu-iotests/1431
-rwxr-xr-xtests/qemu-iotests/1441
-rwxr-xr-xtests/qemu-iotests/1451
-rwxr-xr-xtests/qemu-iotests/1461
-rwxr-xr-xtests/qemu-iotests/1501
-rwxr-xr-xtests/qemu-iotests/1535
-rwxr-xr-xtests/qemu-iotests/1541
-rwxr-xr-xtests/qemu-iotests/1561
-rwxr-xr-xtests/qemu-iotests/1575
-rwxr-xr-xtests/qemu-iotests/1581
-rwxr-xr-xtests/qemu-iotests/1591
-rwxr-xr-xtests/qemu-iotests/1601
-rwxr-xr-xtests/qemu-iotests/1621
-rwxr-xr-xtests/qemu-iotests/1701
-rwxr-xr-xtests/qemu-iotests/1711
-rwxr-xr-xtests/qemu-iotests/1727
-rwxr-xr-xtests/qemu-iotests/1731
-rwxr-xr-xtests/qemu-iotests/1741
-rwxr-xr-xtests/qemu-iotests/1751
-rwxr-xr-xtests/qemu-iotests/1763
-rwxr-xr-xtests/qemu-iotests/1773
-rwxr-xr-xtests/qemu-iotests/1781
-rwxr-xr-xtests/qemu-iotests/1791
-rwxr-xr-xtests/qemu-iotests/1811
-rwxr-xr-xtests/qemu-iotests/1821
-rwxr-xr-xtests/qemu-iotests/1831
-rwxr-xr-xtests/qemu-iotests/1845
-rwxr-xr-xtests/qemu-iotests/1851
-rwxr-xr-xtests/qemu-iotests/1865
-rwxr-xr-xtests/qemu-iotests/1871
-rwxr-xr-xtests/qemu-iotests/1881
-rwxr-xr-xtests/qemu-iotests/1891
-rwxr-xr-xtests/qemu-iotests/1901
-rwxr-xr-xtests/qemu-iotests/1911
-rwxr-xr-xtests/qemu-iotests/1921
-rwxr-xr-xtests/qemu-iotests/1955
-rwxr-xr-xtests/qemu-iotests/1971
-rwxr-xr-xtests/qemu-iotests/1981
-rwxr-xr-xtests/qemu-iotests/2001
-rwxr-xr-xtests/qemu-iotests/2043
-rwxr-xr-xtests/qemu-iotests/2141
-rwxr-xr-xtests/qemu-iotests/2151
-rwxr-xr-xtests/qemu-iotests/2211
-rwxr-xr-xtests/qemu-iotests/2235
-rwxr-xr-xtests/qemu-iotests/2251
-rwxr-xr-xtests/qemu-iotests/2261
-rwxr-xr-xtests/qemu-iotests/2275
-rwxr-xr-xtests/qemu-iotests/2291
-rwxr-xr-xtests/qemu-iotests/2311
-rwxr-xr-xtests/qemu-iotests/2327
-rwxr-xr-xtests/qemu-iotests/233112
-rw-r--r--tests/qemu-iotests/233.out40
-rwxr-xr-xtests/qemu-iotests/check62
-rw-r--r--tests/qemu-iotests/common.config6
-rw-r--r--tests/qemu-iotests/common.nbd109
-rw-r--r--tests/qemu-iotests/common.pattern16
-rw-r--r--tests/qemu-iotests/common.qemu8
-rw-r--r--tests/qemu-iotests/common.rc2
-rw-r--r--tests/qemu-iotests/common.tls137
-rw-r--r--tests/qemu-iotests/group1
188 files changed, 542 insertions, 333 deletions
diff --git a/configure b/configure
index 5b1d83e..0a3c6a7 100755
--- a/configure
+++ b/configure
@@ -878,7 +878,7 @@ Linux)
vhost_crypto="yes"
vhost_scsi="yes"
vhost_vsock="yes"
- QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$(pwd)/linux-headers $QEMU_INCLUDES"
+ QEMU_INCLUDES="-I\$(SRC_PATH)/linux-headers -I$PWD/linux-headers $QEMU_INCLUDES"
supported_os="yes"
libudev="yes"
;;
diff --git a/crypto/tlssession.c b/crypto/tlssession.c
index 2f28fa7..0dedd4a 100644
--- a/crypto/tlssession.c
+++ b/crypto/tlssession.c
@@ -473,6 +473,9 @@ qcrypto_tls_session_read(QCryptoTLSSession *session,
case GNUTLS_E_INTERRUPTED:
errno = EINTR;
break;
+ case GNUTLS_E_PREMATURE_TERMINATION:
+ errno = ECONNABORTED;
+ break;
default:
errno = EIO;
break;
diff --git a/include/io/channel-tls.h b/include/io/channel-tls.h
index 87fcaf9..fdbdf12 100644
--- a/include/io/channel-tls.h
+++ b/include/io/channel-tls.h
@@ -48,6 +48,7 @@ struct QIOChannelTLS {
QIOChannel parent;
QIOChannel *master;
QCryptoTLSSession *session;
+ QIOChannelShutdown shutdown;
};
/**
diff --git a/include/io/channel.h b/include/io/channel.h
index e8cdadb..da2f138 100644
--- a/include/io/channel.h
+++ b/include/io/channel.h
@@ -51,9 +51,9 @@ enum QIOChannelFeature {
typedef enum QIOChannelShutdown QIOChannelShutdown;
enum QIOChannelShutdown {
- QIO_CHANNEL_SHUTDOWN_BOTH,
- QIO_CHANNEL_SHUTDOWN_READ,
- QIO_CHANNEL_SHUTDOWN_WRITE,
+ QIO_CHANNEL_SHUTDOWN_READ = 1,
+ QIO_CHANNEL_SHUTDOWN_WRITE = 2,
+ QIO_CHANNEL_SHUTDOWN_BOTH = 3,
};
typedef gboolean (*QIOChannelFunc)(QIOChannel *ioc,
diff --git a/io/channel-tls.c b/io/channel-tls.c
index 9628e6f..c98ead2 100644
--- a/io/channel-tls.c
+++ b/io/channel-tls.c
@@ -275,6 +275,9 @@ static ssize_t qio_channel_tls_readv(QIOChannel *ioc,
} else {
return QIO_CHANNEL_ERR_BLOCK;
}
+ } else if (errno == ECONNABORTED &&
+ (tioc->shutdown & QIO_CHANNEL_SHUTDOWN_READ)) {
+ return 0;
}
error_setg_errno(errp, errno,
@@ -357,6 +360,8 @@ static int qio_channel_tls_shutdown(QIOChannel *ioc,
{
QIOChannelTLS *tioc = QIO_CHANNEL_TLS(ioc);
+ tioc->shutdown |= how;
+
return qio_channel_shutdown(tioc->master, how, errp);
}
diff --git a/nbd/server.c b/nbd/server.c
index 4e8f5ae..dc04513 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -1134,12 +1134,16 @@ static int nbd_negotiate_options(NBDClient *client, uint16_t myflags,
return -EINVAL;
default:
- ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD, errp,
- "Option 0x%" PRIx32
- "not permitted before TLS", option);
/* Let the client keep trying, unless they asked to
- * quit. In this mode, we've already sent an error, so
- * we can't ack the abort. */
+ * quit. Always try to give an error back to the
+ * client; but when replying to OPT_ABORT, be aware
+ * that the client may hang up before receiving the
+ * error, in which case we are fine ignoring the
+ * resulting EPIPE. */
+ ret = nbd_opt_drop(client, NBD_REP_ERR_TLS_REQD,
+ option == NBD_OPT_ABORT ? NULL : errp,
+ "Option 0x%" PRIx32
+ " not permitted before TLS", option);
if (option == NBD_OPT_ABORT) {
return 1;
}
diff --git a/scripts/coccinelle/tcg_gen_extract.cocci b/scripts/coccinelle/tcg_gen_extract.cocci
index 81e66a3..c10c863 100644
--- a/scripts/coccinelle/tcg_gen_extract.cocci
+++ b/scripts/coccinelle/tcg_gen_extract.cocci
@@ -17,7 +17,7 @@
// --keep-comments --in-place \
// --use-gitgrep --dir target
//
-// $ docker run --rm -v `pwd`:`pwd` -w `pwd` philmd/coccinelle \
+// $ docker run --rm -v $PWD:$PWD -w $PWD philmd/coccinelle \
// --macro-file scripts/cocci-macro-file.h \
// --sp-file scripts/coccinelle/tcg_gen_extract.cocci \
// --keep-comments --in-place \
diff --git a/tests/check-block.sh b/tests/check-block.sh
index c3de378..f3d12fd 100755
--- a/tests/check-block.sh
+++ b/tests/check-block.sh
@@ -5,9 +5,9 @@ if [ "$#" -ne 0 ]; then
FORMAT_LIST="$@"
fi
-export QEMU_PROG="$(pwd)/x86_64-softmmu/qemu-system-x86_64"
-export QEMU_IMG_PROG="$(pwd)/qemu-img"
-export QEMU_IO_PROG="$(pwd)/qemu-io"
+export QEMU_PROG="$PWD/x86_64-softmmu/qemu-system-x86_64"
+export QEMU_IMG_PROG="$PWD/qemu-img"
+export QEMU_IO_PROG="$PWD/qemu-io"
if [ ! -x $QEMU_PROG ]; then
echo "'make check-block' requires qemu-system-x86_64"
diff --git a/tests/qemu-iotests/001 b/tests/qemu-iotests/001
index ffd14e2..55dcbb7 100755
--- a/tests/qemu-iotests/001
+++ b/tests/qemu-iotests/001
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/002 b/tests/qemu-iotests/002
index d4f8e91..74572b4 100755
--- a/tests/qemu-iotests/002
+++ b/tests/qemu-iotests/002
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/003 b/tests/qemu-iotests/003
index 19889b9..bf25955 100755
--- a/tests/qemu-iotests/003
+++ b/tests/qemu-iotests/003
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/004 b/tests/qemu-iotests/004
index 6f2aa3d..841b15d 100755
--- a/tests/qemu-iotests/004
+++ b/tests/qemu-iotests/004
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/005 b/tests/qemu-iotests/005
index 4447377..8aa4283 100755
--- a/tests/qemu-iotests/005
+++ b/tests/qemu-iotests/005
@@ -27,7 +27,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/007 b/tests/qemu-iotests/007
index fa543ee..b983022 100755
--- a/tests/qemu-iotests/007
+++ b/tests/qemu-iotests/007
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/008 b/tests/qemu-iotests/008
index 8e89d74..8dfa10b 100755
--- a/tests/qemu-iotests/008
+++ b/tests/qemu-iotests/008
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/009 b/tests/qemu-iotests/009
index 16e4475..73ae09d 100755
--- a/tests/qemu-iotests/009
+++ b/tests/qemu-iotests/009
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/010 b/tests/qemu-iotests/010
index 151dac2..751aca9 100755
--- a/tests/qemu-iotests/010
+++ b/tests/qemu-iotests/010
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/011 b/tests/qemu-iotests/011
index f8d044e..3590956 100755
--- a/tests/qemu-iotests/011
+++ b/tests/qemu-iotests/011
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/012 b/tests/qemu-iotests/012
index 01a770d..de9a5fb 100755
--- a/tests/qemu-iotests/012
+++ b/tests/qemu-iotests/012
@@ -26,7 +26,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/013 b/tests/qemu-iotests/013
index d013f87..5e1efce 100755
--- a/tests/qemu-iotests/013
+++ b/tests/qemu-iotests/013
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/014 b/tests/qemu-iotests/014
index 2ea79e8..9ade571 100755
--- a/tests/qemu-iotests/014
+++ b/tests/qemu-iotests/014
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/015 b/tests/qemu-iotests/015
index aaf9c3f..21f7d42 100755
--- a/tests/qemu-iotests/015
+++ b/tests/qemu-iotests/015
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/017 b/tests/qemu-iotests/017
index 4f9302d..1ac6f74 100755
--- a/tests/qemu-iotests/017
+++ b/tests/qemu-iotests/017
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/018 b/tests/qemu-iotests/018
index 1d39d35..bba30a1 100755
--- a/tests/qemu-iotests/018
+++ b/tests/qemu-iotests/018
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/019 b/tests/qemu-iotests/019
index 24a789a..8f911a7 100755
--- a/tests/qemu-iotests/019
+++ b/tests/qemu-iotests/019
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/020 b/tests/qemu-iotests/020
index eac5080..6b972d0 100755
--- a/tests/qemu-iotests/020
+++ b/tests/qemu-iotests/020
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/021 b/tests/qemu-iotests/021
index 11e8ed7..c15ebf9 100755
--- a/tests/qemu-iotests/021
+++ b/tests/qemu-iotests/021
@@ -24,7 +24,6 @@ owner=hch@lst.de
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/022 b/tests/qemu-iotests/022
index 2452a9f..44765c7 100755
--- a/tests/qemu-iotests/022
+++ b/tests/qemu-iotests/022
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/023 b/tests/qemu-iotests/023
index 497ae1e..c8e1b9a 100755
--- a/tests/qemu-iotests/023
+++ b/tests/qemu-iotests/023
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/024 b/tests/qemu-iotests/024
index 4071ed6..428b5c8 100755
--- a/tests/qemu-iotests/024
+++ b/tests/qemu-iotests/024
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/025 b/tests/qemu-iotests/025
index 70dd5f1..fcd4d97 100755
--- a/tests/qemu-iotests/025
+++ b/tests/qemu-iotests/025
@@ -24,7 +24,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/026 b/tests/qemu-iotests/026
index 582d254..31276d9 100755
--- a/tests/qemu-iotests/026
+++ b/tests/qemu-iotests/026
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/027 b/tests/qemu-iotests/027
index 08593da..2c46ae1 100755
--- a/tests/qemu-iotests/027
+++ b/tests/qemu-iotests/027
@@ -24,7 +24,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/028 b/tests/qemu-iotests/028
index 97a8869..a2a7c93 100755
--- a/tests/qemu-iotests/028
+++ b/tests/qemu-iotests/028
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/029 b/tests/qemu-iotests/029
index 5cff687..cf0fe0f 100755
--- a/tests/qemu-iotests/029
+++ b/tests/qemu-iotests/029
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/031 b/tests/qemu-iotests/031
index 1e08abc..ac0dfae 100755
--- a/tests/qemu-iotests/031
+++ b/tests/qemu-iotests/031
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/032 b/tests/qemu-iotests/032
index 24bcb52..3e86bb0 100755
--- a/tests/qemu-iotests/032
+++ b/tests/qemu-iotests/032
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/033 b/tests/qemu-iotests/033
index ee8a133..46b9138 100755
--- a/tests/qemu-iotests/033
+++ b/tests/qemu-iotests/033
@@ -24,7 +24,6 @@ owner=pbonzini@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/034 b/tests/qemu-iotests/034
index 1b28bda..62812cd 100755
--- a/tests/qemu-iotests/034
+++ b/tests/qemu-iotests/034
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/035 b/tests/qemu-iotests/035
index efc38e4..85d9ef7 100755
--- a/tests/qemu-iotests/035
+++ b/tests/qemu-iotests/035
@@ -25,7 +25,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -50,7 +49,7 @@ echo
echo "creating image"
_make_test_img $size
-function generate_requests() {
+generate_requests() {
for i in $(seq 0 63); do
echo "aio_write ${i}M 512"
echo "aio_write ${i}M 512"
diff --git a/tests/qemu-iotests/036 b/tests/qemu-iotests/036
index ce638d6..4e76602 100755
--- a/tests/qemu-iotests/036
+++ b/tests/qemu-iotests/036
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/037 b/tests/qemu-iotests/037
index c476b82..a11992d 100755
--- a/tests/qemu-iotests/037
+++ b/tests/qemu-iotests/037
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -55,7 +54,7 @@ TEST_IMG="$TEST_IMG.base"
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
diff --git a/tests/qemu-iotests/038 b/tests/qemu-iotests/038
index d99a150..575093e 100755
--- a/tests/qemu-iotests/038
+++ b/tests/qemu-iotests/038
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -52,7 +51,7 @@ TEST_IMG="$TEST_IMG.base"
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
@@ -77,7 +76,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
echo
echo "== Some concurrent requests touching the same cluster =="
-function overlay_io()
+overlay_io()
{
# Start with a request touching two clusters
echo aio_write -P 0x80 2020k 80k
@@ -103,7 +102,7 @@ overlay_io | $QEMU_IO "$TEST_IMG" | _filter_qemu_io |\
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
echo read -P 31 2016k 4k
echo read -P 0x80 2020k 80k
diff --git a/tests/qemu-iotests/039 b/tests/qemu-iotests/039
index 1f483396..b3c344c 100755
--- a/tests/qemu-iotests/039
+++ b/tests/qemu-iotests/039
@@ -27,7 +27,6 @@ owner=stefanha@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/042 b/tests/qemu-iotests/042
index a53e7cb..beaa339 100755
--- a/tests/qemu-iotests/042
+++ b/tests/qemu-iotests/042
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/043 b/tests/qemu-iotests/043
index 1c6c22d..fc9005b 100755
--- a/tests/qemu-iotests/043
+++ b/tests/qemu-iotests/043
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/046 b/tests/qemu-iotests/046
index f2ebecf..5e41d96 100755
--- a/tests/qemu-iotests/046
+++ b/tests/qemu-iotests/046
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -49,7 +48,7 @@ echo "== creating backing file for COW tests =="
_make_test_img $size
-function backing_io()
+backing_io()
{
local offset=$1
local sectors=$2
@@ -74,7 +73,7 @@ _make_test_img -b "$TEST_IMG.base" 6G
echo
echo "== Some concurrent requests touching the same cluster =="
-function overlay_io()
+overlay_io()
{
# Allocate middle of cluster 1, then write to somewhere before and after it
cat <<EOF
@@ -190,7 +189,7 @@ overlay_io | $QEMU_IO blkdebug::"$TEST_IMG" | _filter_qemu_io |\
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
if ($QEMU_IMG info -U -f "$IMGFMT" "$TEST_IMG" | grep "compat: 0.10" > /dev/null); then
# For v2 images, discarded clusters are read from the backing file
diff --git a/tests/qemu-iotests/047 b/tests/qemu-iotests/047
index 1b8f3d4..6e776d2 100755
--- a/tests/qemu-iotests/047
+++ b/tests/qemu-iotests/047
@@ -25,7 +25,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ size=128M
_make_test_img $size
-function qemu_io_cmds()
+qemu_io_cmds()
{
cat <<EOF
write -P 0x66 0 320k
diff --git a/tests/qemu-iotests/049 b/tests/qemu-iotests/049
index df35b6d..97d8a64 100755
--- a/tests/qemu-iotests/049
+++ b/tests/qemu-iotests/049
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,13 +40,13 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function filter_test_dir()
+filter_test_dir()
{
sed -e "s#$IMGPROTO:$TEST_DIR#TEST_DIR#g" \
-e "s#$TEST_DIR#TEST_DIR#g"
}
-function test_qemu_img()
+test_qemu_img()
{
echo qemu-img "$@" | filter_test_dir
$QEMU_IMG "$@" 2>&1 | filter_test_dir
diff --git a/tests/qemu-iotests/050 b/tests/qemu-iotests/050
index 03b4a5d..963a0db 100755
--- a/tests/qemu-iotests/050
+++ b/tests/qemu-iotests/050
@@ -24,7 +24,6 @@ owner=pbonzini@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/051 b/tests/qemu-iotests/051
index 25d3b2d..32741d7 100755
--- a/tests/qemu-iotests/051
+++ b/tests/qemu-iotests/051
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -44,7 +43,7 @@ _supported_os Linux
# other than refcount_bits=16
_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -58,7 +57,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu |
_filter_generated_node_ids | _filter_hmp
diff --git a/tests/qemu-iotests/052 b/tests/qemu-iotests/052
index 842eace..b992adf 100755
--- a/tests/qemu-iotests/052
+++ b/tests/qemu-iotests/052
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/053 b/tests/qemu-iotests/053
index 2a04f5f..afa109c 100755
--- a/tests/qemu-iotests/053
+++ b/tests/qemu-iotests/053
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/054 b/tests/qemu-iotests/054
index bf47ef9..cf88a7c 100755
--- a/tests/qemu-iotests/054
+++ b/tests/qemu-iotests/054
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/058 b/tests/qemu-iotests/058
index 5eb8784..d6d4f94 100755
--- a/tests/qemu-iotests/058
+++ b/tests/qemu-iotests/058
@@ -26,58 +26,21 @@ owner=xiawenc@linux.vnet.ibm.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
-nbd_unix_socket=$TEST_DIR/test_qemu_nbd_socket
-nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
-rm -f "${TEST_DIR}/qemu-nbd.pid"
-
-_cleanup_nbd()
-{
- local NBD_SNAPSHOT_PID
- if [ -f "${TEST_DIR}/qemu-nbd.pid" ]; then
- read NBD_SNAPSHOT_PID < "${TEST_DIR}/qemu-nbd.pid"
- rm -f "${TEST_DIR}/qemu-nbd.pid"
- if [ -n "$NBD_SNAPSHOT_PID" ]; then
- kill "$NBD_SNAPSHOT_PID"
- fi
- fi
- rm -f "$nbd_unix_socket"
-}
-
-_wait_for_nbd()
-{
- for ((i = 0; i < 300; i++))
- do
- if [ -r "$nbd_unix_socket" ]; then
- return
- fi
- sleep 0.1
- done
- echo "Failed in check of unix socket created by qemu-nbd"
- exit 1
-}
-
-converted_image=$TEST_IMG.converted
-
_export_nbd_snapshot()
{
- _cleanup_nbd
- $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l $1 &
- _wait_for_nbd
+ nbd_server_start_unix_socket "$TEST_IMG" -l $1
}
_export_nbd_snapshot1()
{
- _cleanup_nbd
- $QEMU_NBD -v -t -k "$nbd_unix_socket" "$TEST_IMG" -l snapshot.name=$1 &
- _wait_for_nbd
+ nbd_server_start_unix_socket "$TEST_IMG" -l snapshot.name=$1
}
_cleanup()
{
- _cleanup_nbd
+ nbd_server_stop
_cleanup_test_img
rm -f "$converted_image"
}
@@ -87,6 +50,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
. ./common.rc
. ./common.filter
. ./common.pattern
+. ./common.nbd
_supported_fmt qcow2
_supported_proto file
@@ -95,6 +59,10 @@ _require_command QEMU_NBD
# Internal snapshots are (currently) impossible with refcount_bits=1
_unsupported_imgopts 'refcount_bits=1[^0-9]'
+nbd_snapshot_img="nbd:unix:$nbd_unix_socket"
+
+converted_image=$TEST_IMG.converted
+
# Use -f raw instead of -f $IMGFMT for the NBD connection
QEMU_IO_NBD="$QEMU_IO -f raw --cache=$CACHEMODE"
diff --git a/tests/qemu-iotests/059 b/tests/qemu-iotests/059
index 530bbbe..54d5567 100755
--- a/tests/qemu-iotests/059
+++ b/tests/qemu-iotests/059
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/060 b/tests/qemu-iotests/060
index 74ad371..af0588a 100755
--- a/tests/qemu-iotests/060
+++ b/tests/qemu-iotests/060
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/061 b/tests/qemu-iotests/061
index 911b6f2..1a50163 100755
--- a/tests/qemu-iotests/061
+++ b/tests/qemu-iotests/061
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/062 b/tests/qemu-iotests/062
index 051fb9f..985fbef 100755
--- a/tests/qemu-iotests/062
+++ b/tests/qemu-iotests/062
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/063 b/tests/qemu-iotests/063
index adc037c..041fb5c 100755
--- a/tests/qemu-iotests/063
+++ b/tests/qemu-iotests/063
@@ -25,7 +25,6 @@ owner=alex@alex.org.uk
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/064 b/tests/qemu-iotests/064
index 5792fbb..f55ff37 100755
--- a/tests/qemu-iotests/064
+++ b/tests/qemu-iotests/064
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/066 b/tests/qemu-iotests/066
index 8638217..26c0437 100755
--- a/tests/qemu-iotests/066
+++ b/tests/qemu-iotests/066
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/067 b/tests/qemu-iotests/067
index fe259f6..342b2b0 100755
--- a/tests/qemu-iotests/067
+++ b/tests/qemu-iotests/067
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
# get standard environment, filters and checks
@@ -37,7 +36,7 @@ _supported_os Linux
# Because anything other than 16 would change the output of query-block
_unsupported_imgopts 'refcount_bits=\([^1]\|.\([^6]\|$\)\)'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
@@ -53,7 +52,7 @@ _filter_qmp_events()
| tr '\t' '\n'
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp | _filter_qemu \
| _filter_actual_image_size \
diff --git a/tests/qemu-iotests/068 b/tests/qemu-iotests/068
index e7fca6a..f0583d5 100755
--- a/tests/qemu-iotests/068
+++ b/tests/qemu-iotests/068
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/069 b/tests/qemu-iotests/069
index 96e55ef..fdee121 100755
--- a/tests/qemu-iotests/069
+++ b/tests/qemu-iotests/069
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/070 b/tests/qemu-iotests/070
index 8d08d74..78e0390 100755
--- a/tests/qemu-iotests/070
+++ b/tests/qemu-iotests/070
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/071 b/tests/qemu-iotests/071
index 48b4955..6e467dc 100755
--- a/tests/qemu-iotests/071
+++ b/tests/qemu-iotests/071
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -41,14 +40,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp | _filter_qemu_io
}
diff --git a/tests/qemu-iotests/072 b/tests/qemu-iotests/072
index aa027c7..08ef29f 100755
--- a/tests/qemu-iotests/072
+++ b/tests/qemu-iotests/072
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/073 b/tests/qemu-iotests/073
index 40f85b1..5e7f76c 100755
--- a/tests/qemu-iotests/073
+++ b/tests/qemu-iotests/073
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/075 b/tests/qemu-iotests/075
index caa30d4..45b8901 100755
--- a/tests/qemu-iotests/075
+++ b/tests/qemu-iotests/075
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/076 b/tests/qemu-iotests/076
index ef9e6a4..3b5ab3f 100755
--- a/tests/qemu-iotests/076
+++ b/tests/qemu-iotests/076
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/077 b/tests/qemu-iotests/077
index b3c6fb1..58fe893 100755
--- a/tests/qemu-iotests/077
+++ b/tests/qemu-iotests/077
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -49,7 +48,7 @@ _make_test_img $size
echo
echo "== Some concurrent requests involving RMW =="
-function test_io()
+test_io()
{
echo "open -o driver=$IMGFMT,file.align=4k blkdebug::$TEST_IMG"
# A simple RMW request
@@ -194,7 +193,7 @@ test_io | $QEMU_IO | _filter_qemu_io | \
echo
echo "== Verify image content =="
-function verify_io()
+verify_io()
{
# A simple RMW request
echo read -P 0 0 0x200
diff --git a/tests/qemu-iotests/078 b/tests/qemu-iotests/078
index a106c26..68d0ea8 100755
--- a/tests/qemu-iotests/078
+++ b/tests/qemu-iotests/078
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/079 b/tests/qemu-iotests/079
index b2e3f74..fca2f77 100755
--- a/tests/qemu-iotests/079
+++ b/tests/qemu-iotests/079
@@ -24,7 +24,6 @@ owner=hutao@cn.fujitsu.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/080 b/tests/qemu-iotests/080
index f0eb42f..cec2376 100755
--- a/tests/qemu-iotests/080
+++ b/tests/qemu-iotests/080
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/081 b/tests/qemu-iotests/081
index 9f1dece..edf6e61 100755
--- a/tests/qemu-iotests/081
+++ b/tests/qemu-iotests/081
@@ -24,7 +24,6 @@ owner=benoit@irqsave.net
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -43,14 +42,14 @@ _supported_fmt raw
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
| _filter_qemu_io | _filter_generated_node_ids
diff --git a/tests/qemu-iotests/082 b/tests/qemu-iotests/082
index 3e605d5..61eec63 100755
--- a/tests/qemu-iotests/082
+++ b/tests/qemu-iotests/082
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt qcow2
_supported_proto file nfs
_supported_os Linux
-function run_qemu_img()
+run_qemu_img()
{
echo
echo Testing: "$@" | _filter_testdir
diff --git a/tests/qemu-iotests/083 b/tests/qemu-iotests/083
index 9f92317..89f67db 100755
--- a/tests/qemu-iotests/083
+++ b/tests/qemu-iotests/083
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/084 b/tests/qemu-iotests/084
index 04f2aa9..e131fa9 100755
--- a/tests/qemu-iotests/084
+++ b/tests/qemu-iotests/084
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/085 b/tests/qemu-iotests/085
index 5c7668c..ade68ef 100755
--- a/tests/qemu-iotests/085
+++ b/tests/qemu-iotests/085
@@ -29,7 +29,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
snapshot_virt0="snapshot-v0.qcow2"
@@ -61,7 +60,7 @@ _supported_os Linux
# ${1}: unique identifier for the snapshot filename
-function create_single_snapshot()
+create_single_snapshot()
{
cmd="{ 'execute': 'blockdev-snapshot-sync',
'arguments': { 'device': 'virtio0',
@@ -71,7 +70,7 @@ function create_single_snapshot()
}
# ${1}: unique identifier for the snapshot filename
-function create_group_snapshot()
+create_group_snapshot()
{
cmd="{ 'execute': 'transaction', 'arguments':
{'actions': [
@@ -89,7 +88,7 @@ function create_group_snapshot()
# ${1}: unique identifier for the snapshot filename
# ${2}: extra_params to the blockdev-add command
# ${3}: filename
-function do_blockdev_add()
+do_blockdev_add()
{
cmd="{ 'execute': 'blockdev-add', 'arguments':
{ 'driver': 'qcow2', 'node-name': 'snap_${1}', ${2}
@@ -100,7 +99,7 @@ function do_blockdev_add()
}
# ${1}: unique identifier for the snapshot filename
-function add_snapshot_image()
+add_snapshot_image()
{
base_image="${TEST_DIR}/$((${1}-1))-${snapshot_virt0}"
snapshot_file="${TEST_DIR}/${1}-${snapshot_virt0}"
@@ -111,7 +110,7 @@ function add_snapshot_image()
# ${1}: unique identifier for the snapshot filename
# ${2}: expected response, defaults to 'return'
-function blockdev_snapshot()
+blockdev_snapshot()
{
cmd="{ 'execute': 'blockdev-snapshot',
'arguments': { 'node': 'virtio0',
diff --git a/tests/qemu-iotests/086 b/tests/qemu-iotests/086
index 84e3835..3cca368 100755
--- a/tests/qemu-iotests/086
+++ b/tests/qemu-iotests/086
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt qcow2 raw
_supported_proto file
_supported_os Linux
-function run_qemu_img()
+run_qemu_img()
{
echo
echo Testing: "$@" | _filter_testdir
diff --git a/tests/qemu-iotests/087 b/tests/qemu-iotests/087
index 2561a14..f625887 100755
--- a/tests/qemu-iotests/087
+++ b/tests/qemu-iotests/087
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
# get standard environment, filters and checks
@@ -35,14 +34,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
@@ -103,7 +102,7 @@ echo === aio=native without O_DIRECT ===
echo
# Skip this test if AIO is not enabled in this build
-function run_qemu_filter_aio()
+run_qemu_filter_aio()
{
run_qemu "$@" | \
sed -e 's/is not supported in this build/it requires cache.direct=on, which was not specified/'
diff --git a/tests/qemu-iotests/088 b/tests/qemu-iotests/088
index b8076f2..c5e9ab4 100755
--- a/tests/qemu-iotests/088
+++ b/tests/qemu-iotests/088
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/089 b/tests/qemu-iotests/089
index aa1ba4a..3165d79 100755
--- a/tests/qemu-iotests/089
+++ b/tests/qemu-iotests/089
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/090 b/tests/qemu-iotests/090
index 7380503..1450993 100755
--- a/tests/qemu-iotests/090
+++ b/tests/qemu-iotests/090
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/091 b/tests/qemu-iotests/091
index 10ac4a8..2f2f98e 100755
--- a/tests/qemu-iotests/091
+++ b/tests/qemu-iotests/091
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_FIFO="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/092 b/tests/qemu-iotests/092
index 5bbdd07..8e318f1 100755
--- a/tests/qemu-iotests/092
+++ b/tests/qemu-iotests/092
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/094 b/tests/qemu-iotests/094
index 9aa01e3..7adc9b9 100755
--- a/tests/qemu-iotests/094
+++ b/tests/qemu-iotests/094
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/095 b/tests/qemu-iotests/095
index 72ecc22..9fc47f6 100755
--- a/tests/qemu-iotests/095
+++ b/tests/qemu-iotests/095
@@ -27,7 +27,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/097 b/tests/qemu-iotests/097
index e22670c..7234b16 100755
--- a/tests/qemu-iotests/097
+++ b/tests/qemu-iotests/097
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/098 b/tests/qemu-iotests/098
index b002e96..c7977da 100755
--- a/tests/qemu-iotests/098
+++ b/tests/qemu-iotests/098
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/099 b/tests/qemu-iotests/099
index caaf58e..578808b 100755
--- a/tests/qemu-iotests/099
+++ b/tests/qemu-iotests/099
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -46,12 +45,12 @@ _supported_os Linux
_unsupported_imgopts "subformat=monolithicFlat" "subformat=twoGbMaxExtentFlat" \
"subformat=twoGbMaxExtentSparse"
-function do_run_qemu()
+do_run_qemu()
{
$QEMU -nographic -qmp stdio -serial none "$@"
}
-function run_qemu()
+run_qemu()
{
# Get the "file": "foo" entry ($foo may only contain escaped double quotes,
# which is how we can extract it)
@@ -60,7 +59,7 @@ function run_qemu()
| sed -e 's/^.*"file": "\(\(\\"\|[^"]\)*\)".*$/\1/' -e 's/\\"/"/g'
}
-function test_qemu()
+test_qemu()
{
run_qemu -drive "if=none,id=drv0,$1" <<EOF
{ 'execute': 'qmp_capabilities' }
diff --git a/tests/qemu-iotests/101 b/tests/qemu-iotests/101
index ea53f8b..3001ba3 100755
--- a/tests/qemu-iotests/101
+++ b/tests/qemu-iotests/101
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/102 b/tests/qemu-iotests/102
index 04b3f28..29a6a94 100755
--- a/tests/qemu-iotests/102
+++ b/tests/qemu-iotests/102
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/103 b/tests/qemu-iotests/103
index 2841318..66f8167 100755
--- a/tests/qemu-iotests/103
+++ b/tests/qemu-iotests/103
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/104 b/tests/qemu-iotests/104
index 726d467..34bb0d2 100755
--- a/tests/qemu-iotests/104
+++ b/tests/qemu-iotests/104
@@ -24,7 +24,6 @@ owner=hutao@cn.fujitsu.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
trap "exit \$status" 0 1 2 3 15
diff --git a/tests/qemu-iotests/105 b/tests/qemu-iotests/105
index 3db4ce3..943bda2 100755
--- a/tests/qemu-iotests/105
+++ b/tests/qemu-iotests/105
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/106 b/tests/qemu-iotests/106
index 5e51f88..4129fee 100755
--- a/tests/qemu-iotests/106
+++ b/tests/qemu-iotests/106
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/107 b/tests/qemu-iotests/107
index d7222dc..5d70ad2 100755
--- a/tests/qemu-iotests/107
+++ b/tests/qemu-iotests/107
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/108 b/tests/qemu-iotests/108
index 2355d98..58e8ad7 100755
--- a/tests/qemu-iotests/108
+++ b/tests/qemu-iotests/108
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/109 b/tests/qemu-iotests/109
index acbd079..b51e461 100755
--- a/tests/qemu-iotests/109
+++ b/tests/qemu-iotests/109
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ _supported_os Linux
qemu_comm_method=qmp
-function run_qemu()
+run_qemu()
{
local raw_img="$1"
local source_img="$2"
diff --git a/tests/qemu-iotests/110 b/tests/qemu-iotests/110
index 9de7369..b64b3b2 100755
--- a/tests/qemu-iotests/110
+++ b/tests/qemu-iotests/110
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/111 b/tests/qemu-iotests/111
index a1c152d..e15e66a 100755
--- a/tests/qemu-iotests/111
+++ b/tests/qemu-iotests/111
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/112 b/tests/qemu-iotests/112
index 28eb9aa..d67e6eb 100755
--- a/tests/qemu-iotests/112
+++ b/tests/qemu-iotests/112
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -45,7 +44,7 @@ _supported_os Linux
# manual setting; compat will be overridden as well
_unsupported_imgopts refcount_bits 'compat=0.10'
-function print_refcount_bits()
+print_refcount_bits()
{
$QEMU_IMG info "$TEST_IMG" | sed -n '/refcount bits:/ s/^ *//p'
}
diff --git a/tests/qemu-iotests/113 b/tests/qemu-iotests/113
index 4e09810..d8d78c4 100755
--- a/tests/qemu-iotests/113
+++ b/tests/qemu-iotests/113
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/114 b/tests/qemu-iotests/114
index 5b7dc54..e17fb51 100755
--- a/tests/qemu-iotests/114
+++ b/tests/qemu-iotests/114
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/115 b/tests/qemu-iotests/115
index 665c2ea..0581e03 100755
--- a/tests/qemu-iotests/115
+++ b/tests/qemu-iotests/115
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/116 b/tests/qemu-iotests/116
index df0172f..f8a27b9 100755
--- a/tests/qemu-iotests/116
+++ b/tests/qemu-iotests/116
@@ -27,7 +27,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/117 b/tests/qemu-iotests/117
index 6c83461..e533e23 100755
--- a/tests/qemu-iotests/117
+++ b/tests/qemu-iotests/117
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/119 b/tests/qemu-iotests/119
index 4f34fb4..32810d5 100755
--- a/tests/qemu-iotests/119
+++ b/tests/qemu-iotests/119
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/120 b/tests/qemu-iotests/120
index f40b97d..76afdf4 100755
--- a/tests/qemu-iotests/120
+++ b/tests/qemu-iotests/120
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/121 b/tests/qemu-iotests/121
index 6d6f55a..d2885c7 100755
--- a/tests/qemu-iotests/121
+++ b/tests/qemu-iotests/121
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/122 b/tests/qemu-iotests/122
index d8c8ad7..eab3399 100755
--- a/tests/qemu-iotests/122
+++ b/tests/qemu-iotests/122
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/123 b/tests/qemu-iotests/123
index b18e3fc..168b985 100755
--- a/tests/qemu-iotests/123
+++ b/tests/qemu-iotests/123
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/125 b/tests/qemu-iotests/125
index c20c715..778c874 100755
--- a/tests/qemu-iotests/125
+++ b/tests/qemu-iotests/125
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/126 b/tests/qemu-iotests/126
index a2d4d6c..9114838 100755
--- a/tests/qemu-iotests/126
+++ b/tests/qemu-iotests/126
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127
index 9e0d7d3..c9139ed 100755
--- a/tests/qemu-iotests/127
+++ b/tests/qemu-iotests/127
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
index 0976a18..925f5c7 100755
--- a/tests/qemu-iotests/128
+++ b/tests/qemu-iotests/128
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
devname="eiodev$$"
diff --git a/tests/qemu-iotests/130 b/tests/qemu-iotests/130
index 2c4b94d..f2f2706 100755
--- a/tests/qemu-iotests/130
+++ b/tests/qemu-iotests/130
@@ -26,7 +26,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/131 b/tests/qemu-iotests/131
index 94a9ae7..58c25f7 100755
--- a/tests/qemu-iotests/131
+++ b/tests/qemu-iotests/131
@@ -24,7 +24,6 @@ owner=den@openvz.org
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/133 b/tests/qemu-iotests/133
index af6b3e1..a9a47a3 100755
--- a/tests/qemu-iotests/133
+++ b/tests/qemu-iotests/133
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/134 b/tests/qemu-iotests/134
index 9914415..cacabcd 100755
--- a/tests/qemu-iotests/134
+++ b/tests/qemu-iotests/134
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/135 b/tests/qemu-iotests/135
index ce60831..a18a0c7 100755
--- a/tests/qemu-iotests/135
+++ b/tests/qemu-iotests/135
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/137 b/tests/qemu-iotests/137
index 19e8597..09cd445 100755
--- a/tests/qemu-iotests/137
+++ b/tests/qemu-iotests/137
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/138 b/tests/qemu-iotests/138
index 21650d8..eccbcae 100755
--- a/tests/qemu-iotests/138
+++ b/tests/qemu-iotests/138
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/140 b/tests/qemu-iotests/140
index a8fc951..d4623b5 100755
--- a/tests/qemu-iotests/140
+++ b/tests/qemu-iotests/140
@@ -28,7 +28,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/141 b/tests/qemu-iotests/141
index 4246d38..e2408c7 100755
--- a/tests/qemu-iotests/141
+++ b/tests/qemu-iotests/141
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/142 b/tests/qemu-iotests/142
index 1639c83..5fc488f 100755
--- a/tests/qemu-iotests/142
+++ b/tests/qemu-iotests/142
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -46,7 +45,7 @@ _supported_os Linux
_default_cache_mode none
_supported_cache_modes none directsync
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp
}
@@ -89,7 +88,7 @@ echo
files="if=none,file=$TEST_IMG,backing.file.filename=$TEST_IMG.base"
ids="node-name=image,backing.node-name=backing,backing.file.node-name=backing-file,file.node-name=file"
-function check_cache_all()
+check_cache_all()
{
# cache.direct is supposed to be inherited by both bs->file and
# bs->backing
@@ -232,7 +231,7 @@ drv_bk="if=none,file=json:{'driver':'$IMGFMT',,'file':'backing-file',,'node-name
drv_file="if=none,driver=file,filename=$TEST_IMG,node-name=file"
drv_img="if=none,id=blk,file=json:{'driver':'$IMGFMT',,'file':'file',,'backing':'backing',,'node-name':'image'}"
-function check_cache_all_separate()
+check_cache_all_separate()
{
# Check cache.direct
diff --git a/tests/qemu-iotests/143 b/tests/qemu-iotests/143
index 5ff1944..d6302cc 100755
--- a/tests/qemu-iotests/143
+++ b/tests/qemu-iotests/143
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/144 b/tests/qemu-iotests/144
index 4b91571..118c099 100755
--- a/tests/qemu-iotests/144
+++ b/tests/qemu-iotests/144
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
TMP_SNAP1=${TEST_DIR}/tmp.qcow2
diff --git a/tests/qemu-iotests/145 b/tests/qemu-iotests/145
index c371b3c..6ce8a46 100755
--- a/tests/qemu-iotests/145
+++ b/tests/qemu-iotests/145
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/146 b/tests/qemu-iotests/146
index 043711b..3f61351 100755
--- a/tests/qemu-iotests/146
+++ b/tests/qemu-iotests/146
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/150 b/tests/qemu-iotests/150
index ee8f637..955b877 100755
--- a/tests/qemu-iotests/150
+++ b/tests/qemu-iotests/150
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/153 b/tests/qemu-iotests/153
index 0daeb1b..3120a61 100755
--- a/tests/qemu-iotests/153
+++ b/tests/qemu-iotests/153
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
tmp=/tmp/$$
status=1 # failure is the default!
@@ -71,7 +70,7 @@ _run_cmd()
(echo "$@"; "$@" 2>&1 1>/dev/null) | _filter_testdir
}
-function _do_run_qemu()
+_do_run_qemu()
{
(
if ! test -t 0; then
@@ -83,7 +82,7 @@ function _do_run_qemu()
) | $QEMU -nographic -monitor stdio -serial none "$@" 1>/dev/null
}
-function _run_qemu_with_images()
+_run_qemu_with_images()
{
_do_run_qemu \
$(for i in $@; do echo "-drive if=none,file=$i"; done) 2>&1 \
diff --git a/tests/qemu-iotests/154 b/tests/qemu-iotests/154
index fde03b0..4a4abf0 100755
--- a/tests/qemu-iotests/154
+++ b/tests/qemu-iotests/154
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/156 b/tests/qemu-iotests/156
index 0a9a098..f97f96f 100755
--- a/tests/qemu-iotests/156
+++ b/tests/qemu-iotests/156
@@ -32,7 +32,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/157 b/tests/qemu-iotests/157
index 2bf02be..6fb2659 100755
--- a/tests/qemu-iotests/157
+++ b/tests/qemu-iotests/157
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -41,7 +40,7 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
(
if ! test -t 0; then
@@ -54,7 +53,7 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt \
| _filter_qemu | _filter_generated_node_ids
diff --git a/tests/qemu-iotests/158 b/tests/qemu-iotests/158
index 24ac600..d277ddc 100755
--- a/tests/qemu-iotests/158
+++ b/tests/qemu-iotests/158
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/159 b/tests/qemu-iotests/159
index 9b0e1ec..e74b273 100755
--- a/tests/qemu-iotests/159
+++ b/tests/qemu-iotests/159
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/160 b/tests/qemu-iotests/160
index 5c910e5..92fff45 100755
--- a/tests/qemu-iotests/160
+++ b/tests/qemu-iotests/160
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/162 b/tests/qemu-iotests/162
index 477a806..ef02d84 100755
--- a/tests/qemu-iotests/162
+++ b/tests/qemu-iotests/162
@@ -25,7 +25,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/170 b/tests/qemu-iotests/170
index b79359f..861eabf 100755
--- a/tests/qemu-iotests/170
+++ b/tests/qemu-iotests/170
@@ -23,7 +23,6 @@ owner=fullmanet@gmail.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1
_cleanup()
diff --git a/tests/qemu-iotests/171 b/tests/qemu-iotests/171
index bcfaaf1..5b46069 100755
--- a/tests/qemu-iotests/171
+++ b/tests/qemu-iotests/171
@@ -25,7 +25,6 @@ owner=tgolembi@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index 02c5f79..1e60a7e 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -47,7 +46,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
_notrun "Requires a PC machine"
fi
-function do_run_qemu()
+do_run_qemu()
{
(
if ! test -t 0; then
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function check_floppy_qtree()
+check_floppy_qtree()
{
echo
echo Testing: "$@" | _filter_testdir
@@ -76,7 +75,7 @@ function check_floppy_qtree()
_filter_win32 | _filter_qemu
}
-function check_cache_mode()
+check_cache_mode()
{
echo "info block none0" |
QEMU_OPTIONS="" do_run_qemu -drive if=none,file="$TEST_IMG" "$@" |
diff --git a/tests/qemu-iotests/173 b/tests/qemu-iotests/173
index bdaa092..1fe8c5d 100755
--- a/tests/qemu-iotests/173
+++ b/tests/qemu-iotests/173
@@ -24,7 +24,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/174 b/tests/qemu-iotests/174
index 552879d..d8bb05c 100755
--- a/tests/qemu-iotests/174
+++ b/tests/qemu-iotests/174
@@ -24,7 +24,6 @@ owner=nirsof@gmail.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/175 b/tests/qemu-iotests/175
index ca56e82..ebbeb6e 100755
--- a/tests/qemu-iotests/175
+++ b/tests/qemu-iotests/175
@@ -24,7 +24,6 @@ owner=nirsof@gmail.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/176 b/tests/qemu-iotests/176
index 32baa11..4ecd589 100755
--- a/tests/qemu-iotests/176
+++ b/tests/qemu-iotests/176
@@ -29,7 +29,6 @@ owner=mreitz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -51,7 +50,7 @@ _supported_os Linux
# Persistent dirty bitmaps require compat=1.1
_unsupported_imgopts 'compat=0.10'
-function run_qemu()
+run_qemu()
{
$QEMU -nographic -qmp stdio -serial none "$@" 2>&1 \
| _filter_testdir | _filter_qmp | _filter_qemu \
diff --git a/tests/qemu-iotests/177 b/tests/qemu-iotests/177
index 396986d..f0c1155 100755
--- a/tests/qemu-iotests/177
+++ b/tests/qemu-iotests/177
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -86,7 +85,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
echo
echo "== verify image content =="
-function verify_io()
+verify_io()
{
if ($QEMU_IMG info -f "$IMGFMT" "$TEST_IMG" |
grep "compat: 0.10" > /dev/null); then
diff --git a/tests/qemu-iotests/178 b/tests/qemu-iotests/178
index 6af52c6..3f4b4a4 100755
--- a/tests/qemu-iotests/178
+++ b/tests/qemu-iotests/178
@@ -24,7 +24,6 @@ owner=stefanha@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/179 b/tests/qemu-iotests/179
index 115944a..3040631 100755
--- a/tests/qemu-iotests/179
+++ b/tests/qemu-iotests/179
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/181 b/tests/qemu-iotests/181
index e029793..0c44108 100755
--- a/tests/qemu-iotests/181
+++ b/tests/qemu-iotests/181
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_SOCKET="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/182 b/tests/qemu-iotests/182
index 3b7689c..9e078c5 100755
--- a/tests/qemu-iotests/182
+++ b/tests/qemu-iotests/182
@@ -24,7 +24,6 @@ owner=famz@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
tmp=/tmp/$$
status=1 # failure is the default!
diff --git a/tests/qemu-iotests/183 b/tests/qemu-iotests/183
index c49e1ad..ebb5e30 100755
--- a/tests/qemu-iotests/183
+++ b/tests/qemu-iotests/183
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
MIG_SOCKET="${TEST_DIR}/migrate"
diff --git a/tests/qemu-iotests/184 b/tests/qemu-iotests/184
index 2b68284..0af7a73 100755
--- a/tests/qemu-iotests/184
+++ b/tests/qemu-iotests/184
@@ -24,7 +24,6 @@ owner="Manos Pitsidianakis"
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
trap "exit \$status" 0 1 2 3 15
@@ -35,14 +34,14 @@ trap "exit \$status" 0 1 2 3 15
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@" | _filter_imgfmt
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_qmp\
| _filter_qemu_io | _filter_generated_node_ids \
diff --git a/tests/qemu-iotests/185 b/tests/qemu-iotests/185
index 7dcfdea..d8f1505 100755
--- a/tests/qemu-iotests/185
+++ b/tests/qemu-iotests/185
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/186 b/tests/qemu-iotests/186
index 0aa4395..c27dc95 100755
--- a/tests/qemu-iotests/186
+++ b/tests/qemu-iotests/186
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -45,7 +44,7 @@ if [ "$QEMU_DEFAULT_MACHINE" != "pc" ]; then
_notrun "Requires a PC machine"
fi
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
@@ -60,7 +59,7 @@ function do_run_qemu()
echo
}
-function check_info_block()
+check_info_block()
{
echo "info block" |
do_run_qemu "$@" | _filter_win32 | _filter_hmp | _filter_qemu |
diff --git a/tests/qemu-iotests/187 b/tests/qemu-iotests/187
index 7bb7833..1feddca 100755
--- a/tests/qemu-iotests/187
+++ b/tests/qemu-iotests/187
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/188 b/tests/qemu-iotests/188
index 83ed03e..af40e49 100755
--- a/tests/qemu-iotests/188
+++ b/tests/qemu-iotests/188
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/189 b/tests/qemu-iotests/189
index e695475..222bec1 100755
--- a/tests/qemu-iotests/189
+++ b/tests/qemu-iotests/189
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/190 b/tests/qemu-iotests/190
index 8f808fe..95ba06d 100755
--- a/tests/qemu-iotests/190
+++ b/tests/qemu-iotests/190
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/191 b/tests/qemu-iotests/191
index d6860e7..198272e 100755
--- a/tests/qemu-iotests/191
+++ b/tests/qemu-iotests/191
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/192 b/tests/qemu-iotests/192
index 595f0d7..415c706 100755
--- a/tests/qemu-iotests/192
+++ b/tests/qemu-iotests/192
@@ -25,7 +25,6 @@ owner=famz@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/195 b/tests/qemu-iotests/195
index e7a403d..a977c97 100755
--- a/tests/qemu-iotests/195
+++ b/tests/qemu-iotests/195
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -42,14 +41,14 @@ _supported_fmt qcow2
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_imgfmt | _filter_qemu \
| _filter_qmp | _filter_qemu_io \
diff --git a/tests/qemu-iotests/197 b/tests/qemu-iotests/197
index 0369aa5..8170f5d 100755
--- a/tests/qemu-iotests/197
+++ b/tests/qemu-iotests/197
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/198 b/tests/qemu-iotests/198
index 54eaaf5..4d961f4 100755
--- a/tests/qemu-iotests/198
+++ b/tests/qemu-iotests/198
@@ -24,7 +24,6 @@ owner=berrange@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/200 b/tests/qemu-iotests/200
index ddbdedc..b9ebd5a 100755
--- a/tests/qemu-iotests/200
+++ b/tests/qemu-iotests/200
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/204 b/tests/qemu-iotests/204
index feb69d2..30f0653 100755
--- a/tests/qemu-iotests/204
+++ b/tests/qemu-iotests/204
@@ -24,7 +24,6 @@ owner=eblake@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -94,7 +93,7 @@ $QEMU_IO -c "open -o $options,$limits blkdebug::$TEST_IMG" \
echo
echo "== verify image content =="
-function verify_io()
+verify_io()
{
echo read -P 22 0 1000
echo read -P 33 1000 128k
diff --git a/tests/qemu-iotests/214 b/tests/qemu-iotests/214
index c46ca2a..7a2d539 100755
--- a/tests/qemu-iotests/214
+++ b/tests/qemu-iotests/214
@@ -22,7 +22,6 @@
seq=$(basename "$0")
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/215 b/tests/qemu-iotests/215
index 2e616ed..230fd25 100755
--- a/tests/qemu-iotests/215
+++ b/tests/qemu-iotests/215
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
# get standard environment, filters and checks
diff --git a/tests/qemu-iotests/221 b/tests/qemu-iotests/221
index 41c4e4b..06f48f1 100755
--- a/tests/qemu-iotests/221
+++ b/tests/qemu-iotests/221
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/223 b/tests/qemu-iotests/223
index 8b1859c..72419e0 100755
--- a/tests/qemu-iotests/223
+++ b/tests/qemu-iotests/223
@@ -21,7 +21,6 @@
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
@@ -43,14 +42,14 @@ _supported_os Linux
# Persistent dirty bitmaps require compat=1.1
_unsupported_imgopts 'compat=0.10'
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
diff --git a/tests/qemu-iotests/225 b/tests/qemu-iotests/225
index f2ee715..e42ee94 100755
--- a/tests/qemu-iotests/225
+++ b/tests/qemu-iotests/225
@@ -24,7 +24,6 @@ owner=mreitz@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/226 b/tests/qemu-iotests/226
index 8ec3e61..aec413b 100755
--- a/tests/qemu-iotests/226
+++ b/tests/qemu-iotests/226
@@ -25,7 +25,6 @@ owner=jsnow@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/227 b/tests/qemu-iotests/227
index 9a5f7f9..be1b636 100755
--- a/tests/qemu-iotests/227
+++ b/tests/qemu-iotests/227
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=$(basename $0)
echo "QA output created by $seq"
-here=$PWD
status=1 # failure is the default!
_cleanup()
@@ -41,14 +40,14 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
$QEMU -nographic -qmp-pretty stdio -serial none "$@"
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qmp \
| _filter_qemu | _filter_imgfmt \
diff --git a/tests/qemu-iotests/229 b/tests/qemu-iotests/229
index ff851ec..8660243 100755
--- a/tests/qemu-iotests/229
+++ b/tests/qemu-iotests/229
@@ -25,7 +25,6 @@ owner=jcody@redhat.com
seq="$(basename $0)"
echo "QA output created by $seq"
-here="$PWD"
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/231 b/tests/qemu-iotests/231
index 3e28370..e9f8aaa 100755
--- a/tests/qemu-iotests/231
+++ b/tests/qemu-iotests/231
@@ -26,7 +26,6 @@ owner=jcody@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
diff --git a/tests/qemu-iotests/232 b/tests/qemu-iotests/232
index bc2972d..0708b8b 100755
--- a/tests/qemu-iotests/232
+++ b/tests/qemu-iotests/232
@@ -24,7 +24,6 @@ owner=kwolf@redhat.com
seq=`basename $0`
echo "QA output created by $seq"
-here=`pwd`
status=1 # failure is the default!
_cleanup()
@@ -42,7 +41,7 @@ _supported_fmt generic
_supported_proto file
_supported_os Linux
-function do_run_qemu()
+do_run_qemu()
{
echo Testing: "$@"
(
@@ -56,13 +55,13 @@ function do_run_qemu()
echo
}
-function run_qemu()
+run_qemu()
{
do_run_qemu "$@" 2>&1 | _filter_testdir | _filter_qemu | _filter_hmp |
_filter_generated_node_ids | _filter_imgfmt
}
-function run_qemu_info_block()
+run_qemu_info_block()
{
echo "info block -n" | run_qemu "$@" | grep -e "(file" -e "QEMU_PROG"
}
diff --git a/tests/qemu-iotests/233 b/tests/qemu-iotests/233
new file mode 100755
index 0000000..a4da60d
--- /dev/null
+++ b/tests/qemu-iotests/233
@@ -0,0 +1,112 @@
+#!/bin/bash
+#
+# Test NBD TLS certificate / authorization integration
+#
+# Copyright (C) 2018 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"
+
+status=1 # failure is the default!
+
+_cleanup()
+{
+ nbd_server_stop
+ _cleanup_test_img
+ tls_x509_cleanup
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.pattern
+. ./common.tls
+. ./common.nbd
+
+_supported_fmt raw qcow2
+_supported_proto file
+# If porting to non-Linux, consider using socat instead of ss in common.nbd
+_supported_os Linux
+_require_command QEMU_NBD
+
+nbd_server_set_tcp_port
+tls_x509_init
+
+echo
+echo "== preparing TLS creds =="
+
+tls_x509_create_root_ca "ca1"
+tls_x509_create_root_ca "ca2"
+tls_x509_create_server "ca1" "server1"
+tls_x509_create_client "ca1" "client1"
+tls_x509_create_client "ca2" "client2"
+
+echo
+echo "== preparing image =="
+_make_test_img 64M
+$QEMU_IO -c 'w -P 0x11 1m 1m' "$TEST_IMG" | _filter_qemu_io
+
+echo
+echo "== check TLS client to plain server fails =="
+nbd_server_start_tcp_socket "$TEST_IMG"
+
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+nbd_server_stop
+
+echo
+echo "== check plain client to TLS server fails =="
+
+nbd_server_start_tcp_socket --object tls-creds-x509,dir=${tls_dir}/server1,endpoint=server,id=tls0,verify-peer=yes --tls-creds tls0 "$TEST_IMG"
+
+$QEMU_IMG info nbd://localhost:$nbd_tcp_port 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== check TLS works =="
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== check TLS with different CA fails =="
+$QEMU_IMG info --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client2,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | sed "s/$nbd_tcp_port/PORT/g"
+
+echo
+echo "== perform I/O over TLS =="
+QEMU_IO_OPTIONS=$QEMU_IO_OPTIONS_NO_FMT
+$QEMU_IO -c 'r -P 0x11 1m 1m' -c 'w -P 0x22 1m 1m' --image-opts \
+ --object tls-creds-x509,dir=${tls_dir}/client1,endpoint=client,id=tls0 \
+ driver=nbd,host=$nbd_tcp_addr,port=$nbd_tcp_port,tls-creds=tls0 \
+ 2>&1 | _filter_qemu_io
+
+$QEMU_IO -f qcow2 -r -U -c 'r -P 0x22 1m 1m' "$TEST_IMG" | _filter_qemu_io
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
diff --git a/tests/qemu-iotests/233.out b/tests/qemu-iotests/233.out
new file mode 100644
index 0000000..94acd9b
--- /dev/null
+++ b/tests/qemu-iotests/233.out
@@ -0,0 +1,40 @@
+QA output created by 233
+
+== preparing TLS creds ==
+Generating a self signed certificate...
+Generating a self signed certificate...
+Generating a signed certificate...
+Generating a signed certificate...
+Generating a signed certificate...
+
+== preparing image ==
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
+wrote 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+
+== check TLS client to plain server fails ==
+qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': Denied by server for option 5 (starttls)
+server reported: TLS not configured
+
+== check plain client to TLS server fails ==
+qemu-img: Could not open 'nbd://localhost:PORT': TLS negotiation required before option 8 (structured reply)
+server reported: Option 0x8 not permitted before TLS
+
+== check TLS works ==
+image: nbd://127.0.0.1:PORT
+file format: nbd
+virtual size: 64M (67108864 bytes)
+disk size: unavailable
+
+== check TLS with different CA fails ==
+option negotiation failed: Verify failed: No certificate was found.
+qemu-img: Could not open 'driver=nbd,host=127.0.0.1,port=PORT,tls-creds=tls0': The certificate hasn't got a known issuer
+
+== perform I/O over TLS ==
+read 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+wrote 1048576/1048576 bytes at offset 1048576
+1 MiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
+read 1048576/1048576 bytes at offset 1048576
+1 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 aa94c6c..89ed275 100755
--- a/tests/qemu-iotests/check
+++ b/tests/qemu-iotests/check
@@ -80,17 +80,17 @@ _full_imgfmt_details()
_full_platform_details()
{
- os=`uname -s`
- host=`hostname -s`
- kernel=`uname -r`
- platform=`uname -m`
+ os=$(uname -s)
+ host=$(hostname -s)
+ kernel=$(uname -r)
+ platform=$(uname -m)
echo "$os/$platform $host $kernel"
}
# $1 = prog to look for
set_prog_path()
{
- p=`command -v $1 2> /dev/null`
+ p=$(command -v $1 2> /dev/null)
if [ -n "$p" -a -x "$p" ]; then
type -p "$p"
else
@@ -99,7 +99,7 @@ set_prog_path()
}
if [ -z "$TEST_DIR" ]; then
- TEST_DIR=`pwd`/scratch
+ TEST_DIR=$PWD/scratch
fi
if [ ! -e "$TEST_DIR" ]; then
@@ -147,9 +147,9 @@ do
if $group
then
# arg after -g
- group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
-}'`
+}')
if [ -z "$group_list" ]
then
echo "Group \"$r\" is empty or not defined?"
@@ -173,9 +173,9 @@ s/ .*//p
# arg after -x
# Populate $tmp.list with all tests
awk '/^[0-9]{3,}/ {print $1}' "${source_iotests}/group" > $tmp.list 2>/dev/null
- group_list=`sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
+ group_list=$(sed -n <"$source_iotests/group" -e 's/$/ /' -e "/^[0-9][0-9][0-9].* $r /"'{
s/ .*//p
-}'`
+}')
if [ -z "$group_list" ]
then
echo "Group \"$r\" is empty or not defined?"
@@ -193,7 +193,7 @@ s/ .*//p
rm -f $tmp.sed
fi
echo "/^$t\$/d" >>$tmp.sed
- numsed=`expr $numsed + 1`
+ numsed=$(expr $numsed + 1)
done
sed -f $tmp.sed <$tmp.list >$tmp.tmp
mv $tmp.tmp $tmp.list
@@ -433,12 +433,12 @@ testlist options
;;
[0-9]*-[0-9]*)
- eval `echo $r | sed -e 's/^/start=/' -e 's/-/ end=/'`
+ eval $(echo $r | sed -e 's/^/start=/' -e 's/-/ end=/')
;;
[0-9]*-)
- eval `echo $r | sed -e 's/^/start=/' -e 's/-//'`
- end=`echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //'`
+ eval $(echo $r | sed -e 's/^/start=/' -e 's/-//')
+ end=$(echo [0-9][0-9][0-9] [0-9][0-9][0-9][0-9] | sed -e 's/\[0-9]//g' -e 's/ *$//' -e 's/.* //')
if [ -z "$end" ]
then
echo "No tests in range \"$r\"?"
@@ -455,8 +455,8 @@ testlist options
esac
# get rid of leading 0s as can be interpreted as octal
- start=`echo $start | sed 's/^0*//'`
- end=`echo $end | sed 's/^0*//'`
+ start=$(echo $start | sed 's/^0*//')
+ end=$(echo $end | sed 's/^0*//')
if $xpand
then
@@ -531,7 +531,7 @@ fi
# should be sort -n, but this did not work for Linux when this
# was ported from IRIX
#
-list=`sort $tmp.list`
+list=$(sort $tmp.list)
rm -f $tmp.list $tmp.tmp $tmp.sed
if [ -z "$QEMU_PROG" ]
@@ -590,7 +590,7 @@ fi
export QEMU_NBD_PROG="$(type -p "$QEMU_NBD_PROG")"
if [ -z "$QEMU_VXHS_PROG" ]; then
- export QEMU_VXHS_PROG="`set_prog_path qnio_server`"
+ export QEMU_VXHS_PROG="$(set_prog_path qnio_server)"
fi
if [ -x "$build_iotests/socket_scm_helper" ]
@@ -616,7 +616,7 @@ _wallclock()
_timestamp()
{
- now=`date "+%T"`
+ now=$(date "+%T")
printf %s " [$now]"
}
@@ -642,9 +642,9 @@ END { if (NR > 0) {
if [ -f $tmp.expunged ]
then
- notrun=`wc -l <$tmp.expunged | sed -e 's/ *//g'`
- try=`expr $try - $notrun`
- list=`echo "$list" | sed -f $tmp.expunged`
+ notrun=$(wc -l <$tmp.expunged | sed -e 's/ *//g')
+ try=$(expr $try - $notrun)
+ list=$(echo "$list" | sed -f $tmp.expunged)
fi
echo "" >>check.log
@@ -682,8 +682,8 @@ trap "_wrapup; exit \$status" 0 1 2 3 15
[ -f $TIMESTAMP_FILE ] || touch $TIMESTAMP_FILE
-FULL_IMGFMT_DETAILS=`_full_imgfmt_details`
-FULL_HOST_DETAILS=`_full_platform_details`
+FULL_IMGFMT_DETAILS=$(_full_imgfmt_details)
+FULL_HOST_DETAILS=$(_full_platform_details)
cat <<EOF
QEMU -- "$QEMU_PROG" $QEMU_OPTIONS
@@ -729,7 +729,7 @@ do
# really going to try and run this one
#
rm -f $seq.out.bad
- lasttime=`sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE`
+ lasttime=$(sed -n -e "/^$seq /s/.* //p" <$TIMESTAMP_FILE)
if [ "X$lasttime" != X ]; then
printf %s " ${lasttime}s ..."
else
@@ -737,7 +737,7 @@ do
fi
rm -f core $seq.notrun
- start=`_wallclock`
+ start=$(_wallclock)
$timestamp && printf %s " [$(date "+%T")]"
if [ "$(head -n 1 "$source_iotests/$seq")" == "#!/usr/bin/env python" ]; then
@@ -757,7 +757,7 @@ do
fi
sts=$?
$timestamp && _timestamp
- stop=`_wallclock`
+ stop=$(_wallclock)
if [ -f core ]
then
@@ -806,7 +806,7 @@ do
then
:
else
- echo "$seq `expr $stop - $start`" >>$tmp.time
+ echo "$seq $(expr $stop - $start)" >>$tmp.time
fi
else
echo " - output mismatch (see $seq.out.bad)"
@@ -824,14 +824,14 @@ do
if $err
then
bad="$bad $seq"
- n_bad=`expr $n_bad + 1`
+ n_bad=$(expr $n_bad + 1)
quick=false
fi
- [ -f $seq.notrun ] || try=`expr $try + 1`
+ [ -f $seq.notrun ] || try=$(expr $try + 1)
seq="after_$seq"
done
interrupt=false
-status=`expr $n_bad`
+status=$(expr $n_bad)
exit
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 102aa68..9f460f2 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -21,12 +21,10 @@ export LANG=C
PATH=".:$PATH"
-HOSTOS=`uname -s`
-arch=`uname -m`
+HOSTOS=$(uname -s)
+arch=$(uname -m)
[[ "$arch" =~ "ppc64" ]] && qemu_arch=ppc64 || qemu_arch="$arch"
-export PWD=`pwd`
-
# make sure we have a standard umask
umask 022
diff --git a/tests/qemu-iotests/common.nbd b/tests/qemu-iotests/common.nbd
new file mode 100644
index 0000000..233187a
--- /dev/null
+++ b/tests/qemu-iotests/common.nbd
@@ -0,0 +1,109 @@
+#!/bin/bash
+# -*- shell-script-mode -*-
+#
+# Helpers for NBD server related config
+#
+# Copyright (C) 2018 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/>.
+#
+
+nbd_unix_socket="${TEST_DIR}/qemu-nbd.sock"
+nbd_tcp_addr="127.0.0.1"
+nbd_pid_file="${TEST_DIR}/qemu-nbd.pid"
+
+nbd_server_stop()
+{
+ local NBD_PID
+ if [ -f "$nbd_pid_file" ]; then
+ read NBD_PID < "$nbd_pid_file"
+ rm -f "$nbd_pid_file"
+ if [ -n "$NBD_PID" ]; then
+ kill "$NBD_PID"
+ fi
+ fi
+ rm -f "$nbd_unix_socket"
+}
+
+nbd_server_wait_for_unix_socket()
+{
+ pid=$1
+
+ for ((i = 0; i < 300; i++))
+ do
+ if [ -r "$nbd_unix_socket" ]; then
+ return
+ fi
+ kill -s 0 $pid 2>/dev/null
+ if test $? != 0
+ then
+ echo "qemu-nbd unexpectedly quit"
+ exit 1
+ fi
+ sleep 0.1
+ done
+ echo "Failed in check of unix socket created by qemu-nbd"
+ exit 1
+}
+
+nbd_server_start_unix_socket()
+{
+ nbd_server_stop
+ $QEMU_NBD -v -t -k "$nbd_unix_socket" "$@" &
+ nbd_server_wait_for_unix_socket $!
+}
+
+nbd_server_set_tcp_port()
+{
+ (ss --help) >/dev/null 2>&1 || _notrun "ss utility not found, skipping test"
+
+ for ((port = 10809; port <= 10909; port++))
+ do
+ if ! ss -tln | grep -sqE ":$port\b"; then
+ nbd_tcp_port=$port
+ return
+ fi
+ done
+
+ echo "Cannot find free TCP port for nbd in range 10809-10909"
+ exit 1
+}
+
+nbd_server_wait_for_tcp_socket()
+{
+ pid=$1
+
+ for ((i = 0; i < 300; i++))
+ do
+ if ss -tln | grep -sqE ":$nbd_tcp_port\b"; then
+ return
+ fi
+ kill -s 0 $pid 2>/dev/null
+ if test $? != 0
+ then
+ echo "qemu-nbd unexpectedly quit"
+ exit 1
+ fi
+ sleep 0.1
+ done
+ echo "Failed in check of TCP socket created by qemu-nbd"
+ exit 1
+}
+
+nbd_server_start_tcp_socket()
+{
+ nbd_server_stop
+ $QEMU_NBD -v -t -b $nbd_tcp_addr -p $nbd_tcp_port "$@" &
+ nbd_server_wait_for_tcp_socket $!
+}
diff --git a/tests/qemu-iotests/common.pattern b/tests/qemu-iotests/common.pattern
index 34f4a8d..b67bb34 100644
--- a/tests/qemu-iotests/common.pattern
+++ b/tests/qemu-iotests/common.pattern
@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-function do_is_allocated() {
+do_is_allocated() {
local start=$1
local size=$2
local step=$3
@@ -27,11 +27,11 @@ function do_is_allocated() {
done
}
-function is_allocated() {
+is_allocated() {
do_is_allocated "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function do_io() {
+do_io() {
local op=$1
local start=$2
local size=$3
@@ -45,22 +45,22 @@ function do_io() {
done
}
-function io_pattern() {
+io_pattern() {
do_io "$@" | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io() {
+io() {
local start=$2
local pattern=$(( (start >> 9) % 256 ))
do_io "$@" $pattern | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io_zero() {
+io_zero() {
do_io "$@" 0 | $QEMU_IO "$TEST_IMG" | _filter_qemu_io
}
-function io_test() {
+io_test() {
local op=$1
local offset=$2
local cluster_size=$3
@@ -100,7 +100,7 @@ function io_test() {
offset=$((offset + num_large * ( l2_size + half_cluster )))
}
-function io_test2() {
+io_test2() {
local orig_offset=$1
local cluster_size=$2
local num=$3
diff --git a/tests/qemu-iotests/common.qemu b/tests/qemu-iotests/common.qemu
index dadde2a..7c87b89 100644
--- a/tests/qemu-iotests/common.qemu
+++ b/tests/qemu-iotests/common.qemu
@@ -60,7 +60,7 @@ _in_fd=4
# $3: A string to search for in the response; if found, this indicates
# failure and the test is either aborted (if $qemu_error_no_exit
# is not set) or ${QEMU_STATUS[$1]} is set to -1 (otherwise).
-function _timed_wait_for()
+_timed_wait_for()
{
local h=${1}
shift
@@ -131,7 +131,7 @@ function _timed_wait_for()
# strings the response will be scanned for. The first of the two
# indicates success, the latter indicates failure. Failure is handled
# like a timeout.
-function _send_qemu_cmd()
+_send_qemu_cmd()
{
local h=${1}
local count=1
@@ -186,7 +186,7 @@ function _send_qemu_cmd()
# Returns:
# $QEMU_HANDLE: set to a handle value to communicate with this QEMU instance.
#
-function _launch_qemu()
+_launch_qemu()
{
local comm=
local fifo_out=
@@ -262,7 +262,7 @@ function _launch_qemu()
# If $wait is set to anything other than the empty string, the process will not
# be killed but only waited for, and any output will be forwarded to stdout. If
# $wait is empty, the process will be killed and all output will be suppressed.
-function _cleanup_qemu()
+_cleanup_qemu()
{
# QEMU_PID[], QEMU_IN[], QEMU_OUT[] all use same indices
for i in "${!QEMU_OUT[@]}"
diff --git a/tests/qemu-iotests/common.rc b/tests/qemu-iotests/common.rc
index 70ca65b..e15e7a7 100644
--- a/tests/qemu-iotests/common.rc
+++ b/tests/qemu-iotests/common.rc
@@ -160,7 +160,7 @@ fi
ORIG_TEST_IMG="$TEST_IMG"
if [ -z "$TEST_DIR" ]; then
- TEST_DIR=`pwd`/scratch
+ TEST_DIR=$PWD/scratch
fi
QEMU_TEST_DIR="${TEST_DIR}"
diff --git a/tests/qemu-iotests/common.tls b/tests/qemu-iotests/common.tls
new file mode 100644
index 0000000..39f17c1
--- /dev/null
+++ b/tests/qemu-iotests/common.tls
@@ -0,0 +1,137 @@
+#!/bin/bash
+#
+# Helpers for TLS related config
+#
+# Copyright (C) 2018 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/>.
+#
+
+tls_dir="${TEST_DIR}/tls"
+
+tls_x509_cleanup()
+{
+ rm -f "${tls_dir}"/*.pem
+ rm -f "${tls_dir}"/*/*.pem
+ rmdir "${tls_dir}"/*
+ rmdir "${tls_dir}"
+}
+
+
+tls_x509_init()
+{
+ mkdir -p "${tls_dir}"
+
+ # use a fixed key so we don't waste system entropy on
+ # each test run
+ cat > "${tls_dir}/key.pem" <<EOF
+-----BEGIN PRIVATE KEY-----
+MIICdQIBADANBgkqhkiG9w0BAQEFAASCAl8wggJbAgEAAoGBALVcr
+BL40Tm6yq88FBhJNw1aaoCjmtg0l4dWQZ/e9Fimx4ARxFpT+ji4FE
+Cgl9s/SGqC+1nvlkm9ViSo0j7MKDbnDB+VRHDvMAzQhA2X7e8M0n9
+rPolUY2lIVC83q0BBaOBkCj2RSmT2xTEbbC2xLukSrg2WP/ihVOxc
+kXRuyFtzAgMBAAECgYB7slBexDwXrtItAMIH6m/U+LUpNe0Xx48OL
+IOn4a4whNgO/o84uIwygUK27ZGFZT0kAGAk8CdF9hA6ArcbQ62s1H
+myxrUbF9/mrLsQw1NEqpuUk9Ay2Tx5U/wPx35S3W/X2AvR/ZpTnCn
+2q/7ym9fyiSoj86drD7BTvmKXlOnOwQJBAPOFMp4mMa9NGpGuEssO
+m3Uwbp6lhcP0cA9MK+iOmeANpoKWfBdk5O34VbmeXnGYWEkrnX+9J
+bM4wVhnnBWtgBMCQQC+qAEmvwcfhauERKYznMVUVksyeuhxhCe7EK
+mPh+U2+g0WwdKvGDgO0PPt1gq0ILEjspMDeMHVdTwkaVBo/uMhAkA
+Z5SsZyCP2aTOPFDypXRdI4eqRcjaEPOUBq27r3uYb/jeboVb2weLa
+L1MmVuHiIHoa5clswPdWVI2y0em2IGoDAkBPSp/v9VKJEZabk9Frd
+a+7u4fanrM9QrEjY3KhduslSilXZZSxrWjjAJPyPiqFb3M8XXA26W
+nz1KYGnqYKhLcBAkB7dt57n9xfrhDpuyVEv+Uv1D3VVAhZlsaZ5Pp
+dcrhrkJn2sa/+O8OKvdrPSeeu/N5WwYhJf61+CPoenMp7IFci
+-----END PRIVATE KEY-----
+EOF
+}
+
+
+tls_x509_create_root_ca()
+{
+ name=${1:-ca-cert}
+
+ cat > "${tls_dir}/ca.info" <<EOF
+cn = Cthulhu Dark Lord Enterprises $name
+ca
+cert_signing_key
+EOF
+
+ certtool --generate-self-signed \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/ca.info" \
+ --outfile "${tls_dir}/$name-cert.pem" 2>&1 | head -1
+
+ rm -f "${tls_dir}/ca.info"
+}
+
+
+tls_x509_create_server()
+{
+ caname=$1
+ name=$2
+
+ mkdir -p "${tls_dir}/$name"
+ cat > "${tls_dir}/cert.info" <<EOF
+organization = Cthulhu Dark Lord Enterprises $name
+cn = localhost
+dns_name = localhost
+dns_name = localhost.localdomain
+ip_address = 127.0.0.1
+ip_address = ::1
+tls_www_server
+encryption_key
+signing_key
+EOF
+
+ certtool --generate-certificate \
+ --load-ca-privkey "${tls_dir}/key.pem" \
+ --load-ca-certificate "${tls_dir}/$caname-cert.pem" \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/cert.info" \
+ --outfile "${tls_dir}/$name/server-cert.pem" 2>&1 | head -1
+ ln -s "${tls_dir}/$caname-cert.pem" "${tls_dir}/$name/ca-cert.pem"
+ ln -s "${tls_dir}/key.pem" "${tls_dir}/$name/server-key.pem"
+
+ rm -f "${tls_dir}/cert.info"
+}
+
+
+tls_x509_create_client()
+{
+ caname=$1
+ name=$2
+
+ mkdir -p "${tls_dir}/$name"
+ cat > "${tls_dir}/cert.info" <<EOF
+country = South Pacific
+locality = R'lyeh
+organization = Cthulhu Dark Lord Enterprises $name
+cn = localhost
+tls_www_client
+encryption_key
+signing_key
+EOF
+
+ certtool --generate-certificate \
+ --load-ca-privkey "${tls_dir}/key.pem" \
+ --load-ca-certificate "${tls_dir}/$caname-cert.pem" \
+ --load-privkey "${tls_dir}/key.pem" \
+ --template "${tls_dir}/cert.info" \
+ --outfile "${tls_dir}/$name/client-cert.pem" 2>&1 | head -1
+ ln -s "${tls_dir}/$caname-cert.pem" "${tls_dir}/$name/ca-cert.pem"
+ ln -s "${tls_dir}/key.pem" "${tls_dir}/$name/client-key.pem"
+
+ rm -f "${tls_dir}/cert.info"
+}
diff --git a/tests/qemu-iotests/group b/tests/qemu-iotests/group
index 4d19471..2722103 100644
--- a/tests/qemu-iotests/group
+++ b/tests/qemu-iotests/group
@@ -229,3 +229,4 @@
229 auto quick
231 auto quick
232 auto quick
+233 auto quick