aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBo Tu <tubo@linux.vnet.ibm.com>2015-12-03 18:01:29 +0800
committerMax Reitz <mreitz@redhat.com>2015-12-18 14:36:17 +0100
commit8a7607c2e201f22aa73df03661c23c7d1fbd7540 (patch)
treea92709add4ea62f85f649f68ab76c71429eb25f9 /tests
parentba889444957aaeb073a3a95f5cb2794aa1b222f5 (diff)
qemu-iotests: refine common.config
Replacing awk with sed, then it's easier to read. Replacing "[ ! -z "$default_alias_machine" ]" with "[[ $default_alias_machine ]]", then it's slightly shorter. Reviewed-by: Max Reitz <mreitz@redhat.com> Suggested-By: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Sascha Silbe <silbe@linux.vnet.ibm.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Bo Tu <tubo@linux.vnet.ibm.com> Message-id: 1449136891-26850-2-git-send-email-tubo@linux.vnet.ibm.com Signed-off-by: Max Reitz <mreitz@redhat.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/qemu-iotests/common.config9
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/qemu-iotests/common.config b/tests/qemu-iotests/common.config
index 3ed51b8baa..60bfabf348 100644
--- a/tests/qemu-iotests/common.config
+++ b/tests/qemu-iotests/common.config
@@ -154,11 +154,10 @@ export QEMU_IMG=_qemu_img_wrapper
export QEMU_IO=_qemu_io_wrapper
export QEMU_NBD=_qemu_nbd_wrapper
-default_machine=$($QEMU -machine \? | awk '/(default)/{print $1}')
-default_alias_machine=$($QEMU -machine \? |\
- awk -v var_default_machine="$default_machine"\)\
- '{if ($(NF-2)=="(alias"&&$(NF-1)=="of"&&$(NF)==var_default_machine){print $1}}')
-if [ ! -z "$default_alias_machine" ]; then
+default_machine=$($QEMU -machine help | sed -n '/(default)/ s/ .*//p')
+default_alias_machine=$($QEMU -machine help | \
+ sed -n "/(alias of $default_machine)/ { s/ .*//p; q; }")
+if [[ "$default_alias_machine" ]]; then
default_machine="$default_alias_machine"
fi