[sheepdog] [PATCH stable-0.6 22/22] tests/functional: make qemu commands specifiable
Hitoshi Mitake
mitake.hitoshi at gmail.com
Mon Aug 12 16:55:26 CEST 2013
Current scripts under tests/functional use qemu-io and qemu-img
directly. This patch makes these commands specifiable via environment
variables: QEMU_IO_PROG and QEMU_IMG_PROG. This is important for
testing stable branches because output format of these commands can be
changed during update of qemu.
Example:
$ sudo QEMU_IO_PROG=/usr/local/qemu-stable-1.5/qemu-io DRIVER=local ./check 39
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp>
---
tests/functional/013 | 10 +++++-----
tests/functional/016 | 2 +-
tests/functional/017 | 20 ++++++++++----------
tests/functional/024 | 6 +++---
tests/functional/025 | 4 ++--
tests/functional/039 | 22 +++++++++++-----------
tests/functional/058 | 2 +-
tests/functional/059 | 2 +-
tests/functional/common.config | 2 ++
9 files changed, 36 insertions(+), 34 deletions(-)
diff --git a/tests/functional/013 b/tests/functional/013
index 76f62a8..49c6217 100755
--- a/tests/functional/013
+++ b/tests/functional/013
@@ -23,13 +23,13 @@ _wait_for_sheep 3
_cluster_format -c 1
-qemu-img create sheepdog:test 4G
+$QEMU_IMG create sheepdog:test 4G
for i in `seq 1 9`; do
- qemu-io -c "write 0 512 -P $i" sheepdog:test | _filter_qemu_io
- qemu-img snapshot -c tag$i sheepdog:test
+ $QEMU_IO -c "write 0 512 -P $i" sheepdog:test | _filter_qemu_io
+ $QEMU_IMG snapshot -c tag$i sheepdog:test
done
-qemu-io -c "read 0 512 -P 9" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 9" sheepdog:test | _filter_qemu_io
for i in `seq 1 9`; do
- qemu-io -c "read 0 512 -P $i" sheepdog:test:tag$i | _filter_qemu_io
+ $QEMU_IO -c "read 0 512 -P $i" sheepdog:test:tag$i | _filter_qemu_io
done
diff --git a/tests/functional/016 b/tests/functional/016
index 378a82a..0448d9c 100755
--- a/tests/functional/016
+++ b/tests/functional/016
@@ -24,7 +24,7 @@ _wait_for_sheep 3
_cluster_format -c 3
$COLLIE vdi create base 100M -P
-qemu-img snapshot -c tag sheepdog:base
+$QEMU_IMG snapshot -c tag sheepdog:base
sleep 1
diff --git a/tests/functional/017 b/tests/functional/017
index 9093c63..5a15551 100755
--- a/tests/functional/017
+++ b/tests/functional/017
@@ -23,15 +23,15 @@ _wait_for_sheep 3
_cluster_format -c 1
-qemu-img create sheepdog:test 4G
-qemu-img snapshot -c tag1 sheepdog:test
-qemu-img snapshot -c tag2 sheepdog:test
-qemu-img snapshot -c tag3 sheepdog:test
-
-qemu-img create sheepdog:test2 4G
-qemu-img snapshot -c tag1 sheepdog:test2
-qemu-img snapshot -c tag2 sheepdog:test2
-qemu-io -c "write 0 512" sheepdog:test2:1 | _filter_qemu_io
-qemu-img snapshot -c tag3 sheepdog:test2
+$QEMU_IMG create sheepdog:test 4G
+$QEMU_IMG snapshot -c tag1 sheepdog:test
+$QEMU_IMG snapshot -c tag2 sheepdog:test
+$QEMU_IMG snapshot -c tag3 sheepdog:test
+
+$QEMU_IMG create sheepdog:test2 4G
+$QEMU_IMG snapshot -c tag1 sheepdog:test2
+$QEMU_IMG snapshot -c tag2 sheepdog:test2
+$QEMU_IO -c "write 0 512" sheepdog:test2:1 | _filter_qemu_io
+$QEMU_IMG snapshot -c tag3 sheepdog:test2
$COLLIE vdi tree | _filter_short_date
diff --git a/tests/functional/024 b/tests/functional/024
index a8b03bc..3276615 100755
--- a/tests/functional/024
+++ b/tests/functional/024
@@ -34,14 +34,14 @@ $COLLIE vdi create ${VDI_NAME} ${VDI_SIZE}
sleep 1
echo "filling ${VDI_NAME} with data"
-qemu-io -c "write 0 ${VDI_SIZE}" sheepdog:${VDI_NAME} | _filter_qemu_io
+$QEMU_IO -c "write 0 ${VDI_SIZE}" sheepdog:${VDI_NAME} | _filter_qemu_io
echo "reading back ${VDI_NAME}"
-qemu-io -c "read 0 1m" sheepdog:${VDI_NAME} | _filter_qemu_io
+$QEMU_IO -c "read 0 1m" sheepdog:${VDI_NAME} | _filter_qemu_io
echo "starting second sheep"
_start_sheep 1
_wait_for_sheep 2
echo "reading data from second sheep"
-qemu-io -c "read 0 ${VDI_SIZE}" sheepdog:localhost:7001:${VDI_NAME} | _filter_qemu_io
+$QEMU_IO -c "read 0 ${VDI_SIZE}" sheepdog:localhost:7001:${VDI_NAME} | _filter_qemu_io
diff --git a/tests/functional/025 b/tests/functional/025
index a7f7f4c..8c70b57 100755
--- a/tests/functional/025
+++ b/tests/functional/025
@@ -37,10 +37,10 @@ echo "creating vdi ${NAME}"
$COLLIE vdi create ${VDI_NAME} ${VDI_SIZE}
echo "filling ${VDI_NAME} with data"
-qemu-io -c "write 0 ${VDI_SIZE}" sheepdog:${VDI_NAME} | _filter_qemu_io
+$QEMU_IO -c "write 0 ${VDI_SIZE}" sheepdog:${VDI_NAME} | _filter_qemu_io
echo "reading back ${VDI_NAME} from second zone"
-qemu-io -c "read 0 1m" sheepdog:localhost:7002:${VDI_NAME} | _filter_qemu_io
+$QEMU_IO -c "read 0 1m" sheepdog:localhost:7002:${VDI_NAME} | _filter_qemu_io
echo "starting a sheep in the third zone"
for i in `seq 3 3`; do
diff --git a/tests/functional/039 b/tests/functional/039
index d88ea70..9a58a7a 100755
--- a/tests/functional/039
+++ b/tests/functional/039
@@ -24,37 +24,37 @@ _wait_for_sheep 5
_cluster_format
$COLLIE vdi create test 4G
-qemu-io -c "write 0 512 -P 1" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 1" sheepdog:test | _filter_qemu_io
$COLLIE vdi snapshot test -s snap1
-qemu-io -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
echo yes | $COLLIE vdi rollback test -s snap1
-qemu-io -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
$COLLIE vdi tree | _filter_short_date
$COLLIE vdi list | _filter_short_date
-qemu-io -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 2" sheepdog:test | _filter_qemu_io
$COLLIE vdi snapshot test -s snap2
-qemu-io -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
echo yes | $COLLIE vdi rollback test -s snap1
-qemu-io -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
$COLLIE vdi tree | _filter_short_date
$COLLIE vdi list | _filter_short_date
echo yes | $COLLIE vdi rollback test -s snap2
-qemu-io -c "read 0 512 -P 2" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 2" sheepdog:test | _filter_qemu_io
$COLLIE vdi tree | _filter_short_date
$COLLIE vdi list | _filter_short_date
echo yes | $COLLIE vdi rollback test -s snap1
-qemu-io -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 1" sheepdog:test | _filter_qemu_io
$COLLIE vdi tree | _filter_short_date
$COLLIE vdi list | _filter_short_date
-qemu-io -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 3" sheepdog:test | _filter_qemu_io
$COLLIE vdi snapshot test -s snap3
-qemu-io -c "write 0 512 -P 4" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "write 0 512 -P 4" sheepdog:test | _filter_qemu_io
$COLLIE vdi snapshot test -s snap4
# these fail since the snap ids don't belong to snapshots
@@ -62,6 +62,6 @@ echo yes | $COLLIE vdi rollback test -s 0
echo yes | $COLLIE vdi rollback test -s 5
echo yes | $COLLIE vdi rollback test -s snap3
-qemu-io -c "read 0 512 -P 3" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "read 0 512 -P 3" sheepdog:test | _filter_qemu_io
$COLLIE vdi tree | _filter_short_date
$COLLIE vdi list | _filter_short_date
diff --git a/tests/functional/058 b/tests/functional/058
index d7d2e9e..b8d5a8c 100755
--- a/tests/functional/058
+++ b/tests/functional/058
@@ -21,7 +21,7 @@ _wait_for_sheep 3
_cluster_format
$COLLIE vdi create test 100M
dd if=/dev/zero | $COLLIE vdi write -w test
-qemu-io -c "discard 0 100m" sheepdog:test | _filter_qemu_io
+$QEMU_IO -c "discard 0 100m" sheepdog:test | _filter_qemu_io
$COLLIE vdi check test
for i in `seq 0 24`; do
$COLLIE vdi object test -i $i;
diff --git a/tests/functional/059 b/tests/functional/059
index 6b34d39..0eda01e 100755
--- a/tests/functional/059
+++ b/tests/functional/059
@@ -35,7 +35,7 @@ _input()
echo quit
}
-_input | qemu-io sheepdog:test > /dev/null
+_input | $QEMU_IO sheepdog:test > /dev/null
$COLLIE vdi list | _filter_short_date
$COLLIE vdi tree | _filter_short_date
diff --git a/tests/functional/common.config b/tests/functional/common.config
index 1fc2825..db7d757 100644
--- a/tests/functional/common.config
+++ b/tests/functional/common.config
@@ -82,6 +82,8 @@ export COLLIE_PROG=${COLLIE_PROG:-../../collie/collie}
export COLLIE=${COLLIE:-$COLLIE_PROG}
export VALGRIND_OPTIONS=${VALGRIND_OPTIONS:-"-q"}
export MD=${MD:-false}
+export QEMU_IO=${QEMU_IO_PROG:-qemu-io}
+export QEMU_IMG=${QEMU_IMG_PROG:-qemu-img}
# make sure this script returns success
/bin/true
--
1.8.1.2
More information about the sheepdog
mailing list