[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 1/4] qemu-iotests: refine common.config
From: |
Max Reitz |
Subject: |
Re: [Qemu-devel] [PATCH v2 1/4] qemu-iotests: refine common.config |
Date: |
Wed, 18 Nov 2015 17:45:35 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 04.11.2015 03:26, Bo Tu wrote:
> Replacing sed with awk, then it's easier to read.
I think you meant "awk with sed".
> Replacing "[ ! -z "$default_alias_machine" ]" with
> "[[ $default_alias_machine ]]", then it's slightly shorter.
>
> Suggested-By: Sascha Silbe <address@hidden>
> Reviewed-by: Sascha Silbe <address@hidden>
> Reviewed-by: Eric Blake <address@hidden>
> Signed-off-by: Bo Tu <address@hidden>
> ---
> tests/qemu-iotests/common.config | 9 ++++-----
> 1 file changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/tests/qemu-iotests/common.config
> b/tests/qemu-iotests/common.config
> index 596bb2b..08f4b4e 100644
> --- a/tests/qemu-iotests/common.config
> +++ b/tests/qemu-iotests/common.config
> @@ -128,11 +128,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; }')
Could be shortened to "/(alias of $default_machine)/ { s/ .*//p; q; }"
(superfluous quotation marks), but that doesn't make it less correct.
With the commit message fixed:
Reviewed-by: Max Reitz <address@hidden>
> +if [[ "$default_alias_machine" ]]; then
> default_machine="$default_alias_machine"
> fi
>
>
signature.asc
Description: OpenPGP digital signature