All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup
@ 2017-04-24  9:26 Andrew Jones
  2017-04-24 12:47 ` Balamuruhan S
  2017-04-27 15:52 ` Paolo Bonzini
  0 siblings, 2 replies; 5+ messages in thread
From: Andrew Jones @ 2017-04-24  9:26 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini, bala24

We use tabs in scripts/arch-run.bash, which the import of the
function forgot to convert to.  Also, while touching all lines
to add the tabs, apply some more cleanups and simplifications.

Signed-off-by: Andrew Jones <drjones@redhat.com>
---
 scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
 1 file changed, 18 insertions(+), 21 deletions(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index d526d98bcc40..5c10828e30f9 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -134,27 +134,24 @@ migration_cmd ()
 	fi
 }
 
-# qemu binary search function for all arches
 search_qemu_binary ()
 {
-    local save_path=$PATH
-    local qemucmd QEMUFOUND qemu
-    export PATH=$PATH:/usr/libexec
-    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
-    do
-        unset QEMUFOUND
-        unset qemu
-        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
-        then
-            qemu="${qemucmd}"
-            break
-        fi
-    done
-
-    if [ -z "${QEMUFOUND}" ]; then
-        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
-        exit 2
-    fi
-    which $qemu
-    export PATH=$save_path
+	local save_path=$PATH
+	local qemucmd qemu
+
+	export PATH=$PATH:/usr/libexec
+	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
+		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
+			qemu="$qemucmd"
+			break
+		fi
+	done
+
+	if [ -z "$qemu" ]; then
+		echo "A QEMU binary was not found."
+		echo "You can set a custom location by using the QEMU=<path> environment variable."
+		exit 2
+	fi
+	command -v $qemu
+	export PATH=$save_path
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup
  2017-04-24  9:26 [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup Andrew Jones
@ 2017-04-24 12:47 ` Balamuruhan S
  2017-04-24 13:02   ` Andrew Jones
  2017-04-27 15:52 ` Paolo Bonzini
  1 sibling, 1 reply; 5+ messages in thread
From: Balamuruhan S @ 2017-04-24 12:47 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm

It looks good and I have tested this patch in x86 and PowerPC.

I tried to use git am <patch> but it fails with,

# git am ./test.patch 
Patch format detection failed.

so I did git apply and tested. Henceforth I will use tabs for indentation.

Regards,
Bala

On Mon, Apr 24, 2017 at 11:26:18AM +0200, Andrew Jones wrote:
> We use tabs in scripts/arch-run.bash, which the import of the
> function forgot to convert to.  Also, while touching all lines
> to add the tabs, apply some more cleanups and simplifications.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>
> ---
>  scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index d526d98bcc40..5c10828e30f9 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -134,27 +134,24 @@ migration_cmd ()
>  	fi
>  }
> 
> -# qemu binary search function for all arches
>  search_qemu_binary ()
>  {
> -    local save_path=$PATH
> -    local qemucmd QEMUFOUND qemu
> -    export PATH=$PATH:/usr/libexec
> -    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
> -    do
> -        unset QEMUFOUND
> -        unset qemu
> -        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
> -        then
> -            qemu="${qemucmd}"
> -            break
> -        fi
> -    done
> -
> -    if [ -z "${QEMUFOUND}" ]; then
> -        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
> -        exit 2
> -    fi
> -    which $qemu
> -    export PATH=$save_path
> +	local save_path=$PATH
> +	local qemucmd qemu
> +
> +	export PATH=$PATH:/usr/libexec
> +	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
> +		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
> +			qemu="$qemucmd"
> +			break
> +		fi
> +	done
> +
> +	if [ -z "$qemu" ]; then
> +		echo "A QEMU binary was not found."
> +		echo "You can set a custom location by using the QEMU=<path> environment variable."
> +		exit 2
> +	fi
> +	command -v $qemu
> +	export PATH=$save_path
>  }
> -- 
> 2.9.3
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup
  2017-04-24 12:47 ` Balamuruhan S
@ 2017-04-24 13:02   ` Andrew Jones
  2017-04-25  6:19     ` Balamuruhan S
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2017-04-24 13:02 UTC (permalink / raw)
  To: Balamuruhan S; +Cc: kvm

On Mon, Apr 24, 2017 at 06:17:14PM +0530, Balamuruhan S wrote:
> It looks good and I have tested this patch in x86 and PowerPC.
> 
> I tried to use git am <patch> but it fails with,
> 
> # git am ./test.patch 
> Patch format detection failed.
> 
> so I did git apply and tested.

Thanks for the testing.

> Henceforth I will use tabs for indentation.

We never officially decided on a bash coding standard (we should probably
do that, as we have over 500 lines of bash now). Original files are spaces
(or mostly, occasionally you'll find a tab...), but when I wrote a couple
new bash files I used tabs, and scripts/arch-run.bash is one of those
files. While tabs might not have been the right choice, I'd prefer that at
least per file consistency is maintained.

Thanks,
drew

> 
> Regards,
> Bala
> 
> On Mon, Apr 24, 2017 at 11:26:18AM +0200, Andrew Jones wrote:
> > We use tabs in scripts/arch-run.bash, which the import of the
> > function forgot to convert to.  Also, while touching all lines
> > to add the tabs, apply some more cleanups and simplifications.
> > 
> > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > ---
> >  scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
> >  1 file changed, 18 insertions(+), 21 deletions(-)
> > 
> > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> > index d526d98bcc40..5c10828e30f9 100644
> > --- a/scripts/arch-run.bash
> > +++ b/scripts/arch-run.bash
> > @@ -134,27 +134,24 @@ migration_cmd ()
> >  	fi
> >  }
> > 
> > -# qemu binary search function for all arches
> >  search_qemu_binary ()
> >  {
> > -    local save_path=$PATH
> > -    local qemucmd QEMUFOUND qemu
> > -    export PATH=$PATH:/usr/libexec
> > -    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
> > -    do
> > -        unset QEMUFOUND
> > -        unset qemu
> > -        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
> > -        then
> > -            qemu="${qemucmd}"
> > -            break
> > -        fi
> > -    done
> > -
> > -    if [ -z "${QEMUFOUND}" ]; then
> > -        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
> > -        exit 2
> > -    fi
> > -    which $qemu
> > -    export PATH=$save_path
> > +	local save_path=$PATH
> > +	local qemucmd qemu
> > +
> > +	export PATH=$PATH:/usr/libexec
> > +	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
> > +		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
> > +			qemu="$qemucmd"
> > +			break
> > +		fi
> > +	done
> > +
> > +	if [ -z "$qemu" ]; then
> > +		echo "A QEMU binary was not found."
> > +		echo "You can set a custom location by using the QEMU=<path> environment variable."
> > +		exit 2
> > +	fi
> > +	command -v $qemu
> > +	export PATH=$save_path
> >  }
> > -- 
> > 2.9.3
> > 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup
  2017-04-24 13:02   ` Andrew Jones
@ 2017-04-25  6:19     ` Balamuruhan S
  0 siblings, 0 replies; 5+ messages in thread
From: Balamuruhan S @ 2017-04-25  6:19 UTC (permalink / raw)
  To: Andrew Jones; +Cc: kvm

On Mon, Apr 24, 2017 at 03:02:01PM +0200, Andrew Jones wrote:
> On Mon, Apr 24, 2017 at 06:17:14PM +0530, Balamuruhan S wrote:
> > It looks good and I have tested this patch in x86 and PowerPC.
> > 
> > I tried to use git am <patch> but it fails with,
> > 
> > # git am ./test.patch 
> > Patch format detection failed.
> > 
> > so I did git apply and tested.
> 
> Thanks for the testing.
> 
> > Henceforth I will use tabs for indentation.
> 
> We never officially decided on a bash coding standard (we should probably
> do that, as we have over 500 lines of bash now). Original files are spaces
> (or mostly, occasionally you'll find a tab...), but when I wrote a couple
> new bash files I used tabs, and scripts/arch-run.bash is one of those
> files. While tabs might not have been the right choice, I'd prefer that at
> least per file consistency is maintained.

Sure drew.

Thanks,
Bala

> 
> Thanks,
> drew
> 
> > 
> > Regards,
> > Bala
> > 
> > On Mon, Apr 24, 2017 at 11:26:18AM +0200, Andrew Jones wrote:
> > > We use tabs in scripts/arch-run.bash, which the import of the
> > > function forgot to convert to.  Also, while touching all lines
> > > to add the tabs, apply some more cleanups and simplifications.
> > > 
> > > Signed-off-by: Andrew Jones <drjones@redhat.com>
> > > ---
> > >  scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
> > >  1 file changed, 18 insertions(+), 21 deletions(-)
> > > 
> > > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> > > index d526d98bcc40..5c10828e30f9 100644
> > > --- a/scripts/arch-run.bash
> > > +++ b/scripts/arch-run.bash
> > > @@ -134,27 +134,24 @@ migration_cmd ()
> > >  	fi
> > >  }
> > > 
> > > -# qemu binary search function for all arches
> > >  search_qemu_binary ()
> > >  {
> > > -    local save_path=$PATH
> > > -    local qemucmd QEMUFOUND qemu
> > > -    export PATH=$PATH:/usr/libexec
> > > -    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
> > > -    do
> > > -        unset QEMUFOUND
> > > -        unset qemu
> > > -        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
> > > -        then
> > > -            qemu="${qemucmd}"
> > > -            break
> > > -        fi
> > > -    done
> > > -
> > > -    if [ -z "${QEMUFOUND}" ]; then
> > > -        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
> > > -        exit 2
> > > -    fi
> > > -    which $qemu
> > > -    export PATH=$save_path
> > > +	local save_path=$PATH
> > > +	local qemucmd qemu
> > > +
> > > +	export PATH=$PATH:/usr/libexec
> > > +	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
> > > +		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
> > > +			qemu="$qemucmd"
> > > +			break
> > > +		fi
> > > +	done
> > > +
> > > +	if [ -z "$qemu" ]; then
> > > +		echo "A QEMU binary was not found."
> > > +		echo "You can set a custom location by using the QEMU=<path> environment variable."
> > > +		exit 2
> > > +	fi
> > > +	command -v $qemu
> > > +	export PATH=$save_path
> > >  }
> > > -- 
> > > 2.9.3
> > > 
> > 
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup
  2017-04-24  9:26 [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup Andrew Jones
  2017-04-24 12:47 ` Balamuruhan S
@ 2017-04-27 15:52 ` Paolo Bonzini
  1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-04-27 15:52 UTC (permalink / raw)
  To: Andrew Jones, kvm; +Cc: bala24



On 24/04/2017 11:26, Andrew Jones wrote:
> We use tabs in scripts/arch-run.bash, which the import of the
> function forgot to convert to.  Also, while touching all lines
> to add the tabs, apply some more cleanups and simplifications.
> 
> Signed-off-by: Andrew Jones <drjones@redhat.com>

Queued, thanks.

Paolo

> ---
>  scripts/arch-run.bash | 39 ++++++++++++++++++---------------------
>  1 file changed, 18 insertions(+), 21 deletions(-)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index d526d98bcc40..5c10828e30f9 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -134,27 +134,24 @@ migration_cmd ()
>  	fi
>  }
>  
> -# qemu binary search function for all arches
>  search_qemu_binary ()
>  {
> -    local save_path=$PATH
> -    local qemucmd QEMUFOUND qemu
> -    export PATH=$PATH:/usr/libexec
> -    for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}
> -    do
> -        unset QEMUFOUND
> -        unset qemu
> -        if ! [ -z "${QEMUFOUND=$(${qemucmd} --help 2>/dev/null  | grep "QEMU")}" ]
> -        then
> -            qemu="${qemucmd}"
> -            break
> -        fi
> -    done
> -
> -    if [ -z "${QEMUFOUND}" ]; then
> -        echo "A QEMU binary was not found, You can set a custom location by using the QEMU=<path> environment variable"
> -        exit 2
> -    fi
> -    which $qemu
> -    export PATH=$save_path
> +	local save_path=$PATH
> +	local qemucmd qemu
> +
> +	export PATH=$PATH:/usr/libexec
> +	for qemucmd in ${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}; do
> +		if $qemucmd --help 2>/dev/null | grep -q 'QEMU'; then
> +			qemu="$qemucmd"
> +			break
> +		fi
> +	done
> +
> +	if [ -z "$qemu" ]; then
> +		echo "A QEMU binary was not found."
> +		echo "You can set a custom location by using the QEMU=<path> environment variable."
> +		exit 2
> +	fi
> +	command -v $qemu
> +	export PATH=$save_path
>  }
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-27 15:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-24  9:26 [PATCH kvm-unit-tests] arch-run: more qemu binary search cleanup Andrew Jones
2017-04-24 12:47 ` Balamuruhan S
2017-04-24 13:02   ` Andrew Jones
2017-04-25  6:19     ` Balamuruhan S
2017-04-27 15:52 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.