All of lore.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary
@ 2017-04-19 19:14 Balamuruhan S
  2017-04-21  6:46 ` Balamuruhan S
  2017-04-21 11:07 ` Paolo Bonzini
  0 siblings, 2 replies; 4+ messages in thread
From: Balamuruhan S @ 2017-04-19 19:14 UTC (permalink / raw)
  To: kvm; +Cc: drjones, Balamuruhan S

qemu_binary function to seach qemu binary similar to x86/run does
so that it can be reused for all arches

Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
---
 scripts/arch-run.bash | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 94c50f3..404a4c0 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -133,3 +133,25 @@ migration_cmd ()
 		echo "run_migration"
 	fi
 }
+
+# qemu binary search function for all arches
+qemu_binary ()
+{
+    PATH=$PATH:/usr/libexec
+    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
+    for qemucmd in ${qemubinarysearch}
+    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
+}
-- 
2.7.4

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

* Re: [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary
  2017-04-19 19:14 [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary Balamuruhan S
@ 2017-04-21  6:46 ` Balamuruhan S
  2017-04-21 11:07 ` Paolo Bonzini
  1 sibling, 0 replies; 4+ messages in thread
From: Balamuruhan S @ 2017-04-21  6:46 UTC (permalink / raw)
  To: drjones; +Cc: kvm

Hi drew,

I have added the function in scripts/arch-run as per your suggestion.

I have tested the patches in x86 and PowerPC but for arm I don't have
the system to test. 

Thanks,
Bala

On Thu, Apr 20, 2017 at 12:44:11AM +0530, Balamuruhan S wrote:
> qemu_binary function to seach qemu binary similar to x86/run does
> so that it can be reused for all arches
> 
> Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> ---
>  scripts/arch-run.bash | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index 94c50f3..404a4c0 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -133,3 +133,25 @@ migration_cmd ()
>  		echo "run_migration"
>  	fi
>  }
> +
> +# qemu binary search function for all arches
> +qemu_binary ()
> +{
> +    PATH=$PATH:/usr/libexec
> +    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
> +    for qemucmd in ${qemubinarysearch}
> +    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
> +}
> -- 
> 2.7.4
> 

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

* Re: [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary
  2017-04-19 19:14 [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary Balamuruhan S
  2017-04-21  6:46 ` Balamuruhan S
@ 2017-04-21 11:07 ` Paolo Bonzini
  2017-04-21 12:50   ` Balamuruhan S
  1 sibling, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2017-04-21 11:07 UTC (permalink / raw)
  To: Balamuruhan S, kvm; +Cc: drjones

Series applied with some cleanups:

diff --git a/arm/run b/arm/run
index 696228e..bae43fd 100755
--- a/arm/run
+++ b/arm/run
@@ -31,13 +31,10 @@ if [ -z "$ACCEL" ]; then
 	fi
 fi
 
-# qemu_binary () defined in scripts/arch-run.bash
-qemu_binary
-
-qpath=$(which $qemu 2>/dev/null)
+qemu=$(search_qemu_binary)
 
 if ! $qemu -machine '?' 2>&1 | grep 'ARM Virtual Machine' > /dev/null; then
-	echo "$qpath doesn't support mach-virt ('-machine virt'). Exiting."
+	echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting."
 	exit 2
 fi
 
@@ -56,13 +53,13 @@ if [ "$ACCEL" = "kvm" ]; then
 fi
 
 if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
-	echo "$qpath doesn't support virtio-console for chr-testdev. Exiting."
+	echo "$qemu doesn't support virtio-console for chr-testdev. Exiting."
 	exit 2
 fi
 
 if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
 		| grep backend > /dev/null; then
-	echo "$qpath doesn't support chr-testdev. Exiting."
+	echo "$qemu doesn't support chr-testdev. Exiting."
 	exit 2
 fi
 
diff --git a/powerpc/run b/powerpc/run
index 4302fe2..69d2b53 100755
--- a/powerpc/run
+++ b/powerpc/run
@@ -28,13 +28,10 @@ if [ -z "$ACCEL" ]; then
 	fi
 fi
 
-# qemu_binary () defined in scripts/arch-run.bash
-qemu_binary
-
-qpath=$(which $qemu 2>/dev/null)
+qemu=$(search_qemu_binary)
 
 if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then
-	echo "$qpath doesn't support pSeries ('-machine pseries'). Exiting."
+	echo "$qemu doesn't support pSeries ('-machine pseries'). Exiting."
 	exit 2
 fi
 
diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 404a4c0..fb5fd7d 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -135,11 +135,12 @@ migration_cmd ()
 }
 
 # qemu binary search function for all arches
-qemu_binary ()
+search_qemu_binary ()
 {
-    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
-    for qemucmd in ${qemubinarysearch}
+    PATH=$PATH:/usr/libexec
+    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
@@ -154,4 +155,6 @@ qemu_binary ()
         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
 }
diff --git a/x86/run b/x86/run
index eebfef9..b4db2a9 100755
--- a/x86/run
+++ b/x86/run
@@ -2,8 +2,7 @@
 
 [ -z "$STANDALONE" ] && source scripts/arch-run.bash
 
-# qemu_binary () defined in scripts/arch-run.bash
-qemu_binary
+qemu=$(search_qemu_binary)
 
 if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
 then


On 19/04/2017 21:14, Balamuruhan S wrote:
> qemu_binary function to seach qemu binary similar to x86/run does
> so that it can be reused for all arches
> 
> Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> ---
>  scripts/arch-run.bash | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index 94c50f3..404a4c0 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -133,3 +133,25 @@ migration_cmd ()
>  		echo "run_migration"
>  	fi
>  }
> +
> +# qemu binary search function for all arches
> +qemu_binary ()
> +{
> +    PATH=$PATH:/usr/libexec
> +    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
> +    for qemucmd in ${qemubinarysearch}
> +    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
> +}
> 

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

* Re: [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary
  2017-04-21 11:07 ` Paolo Bonzini
@ 2017-04-21 12:50   ` Balamuruhan S
  0 siblings, 0 replies; 4+ messages in thread
From: Balamuruhan S @ 2017-04-21 12:50 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: kvm

Thank you Paolo.

Regards,
Bala

On Fri, Apr 21, 2017 at 01:07:25PM +0200, Paolo Bonzini wrote:
> Series applied with some cleanups:
> 
> diff --git a/arm/run b/arm/run
> index 696228e..bae43fd 100755
> --- a/arm/run
> +++ b/arm/run
> @@ -31,13 +31,10 @@ if [ -z "$ACCEL" ]; then
>  	fi
>  fi
> 
> -# qemu_binary () defined in scripts/arch-run.bash
> -qemu_binary
> -
> -qpath=$(which $qemu 2>/dev/null)
> +qemu=$(search_qemu_binary)
> 
>  if ! $qemu -machine '?' 2>&1 | grep 'ARM Virtual Machine' > /dev/null; then
> -	echo "$qpath doesn't support mach-virt ('-machine virt'). Exiting."
> +	echo "$qemu doesn't support mach-virt ('-machine virt'). Exiting."
>  	exit 2
>  fi
> 
> @@ -56,13 +53,13 @@ if [ "$ACCEL" = "kvm" ]; then
>  fi
> 
>  if ! $qemu $M -device '?' 2>&1 | grep virtconsole > /dev/null; then
> -	echo "$qpath doesn't support virtio-console for chr-testdev. Exiting."
> +	echo "$qemu doesn't support virtio-console for chr-testdev. Exiting."
>  	exit 2
>  fi
> 
>  if $qemu $M -chardev testdev,id=id -initrd . 2>&1 \
>  		| grep backend > /dev/null; then
> -	echo "$qpath doesn't support chr-testdev. Exiting."
> +	echo "$qemu doesn't support chr-testdev. Exiting."
>  	exit 2
>  fi
> 
> diff --git a/powerpc/run b/powerpc/run
> index 4302fe2..69d2b53 100755
> --- a/powerpc/run
> +++ b/powerpc/run
> @@ -28,13 +28,10 @@ if [ -z "$ACCEL" ]; then
>  	fi
>  fi
> 
> -# qemu_binary () defined in scripts/arch-run.bash
> -qemu_binary
> -
> -qpath=$(which $qemu 2>/dev/null)
> +qemu=$(search_qemu_binary)
> 
>  if ! $qemu -machine '?' 2>&1 | grep 'pseries' > /dev/null; then
> -	echo "$qpath doesn't support pSeries ('-machine pseries'). Exiting."
> +	echo "$qemu doesn't support pSeries ('-machine pseries'). Exiting."
>  	exit 2
>  fi
> 
> diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> index 404a4c0..fb5fd7d 100644
> --- a/scripts/arch-run.bash
> +++ b/scripts/arch-run.bash
> @@ -135,11 +135,12 @@ migration_cmd ()
>  }
> 
>  # qemu binary search function for all arches
> -qemu_binary ()
> +search_qemu_binary ()
>  {
> -    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
> -    for qemucmd in ${qemubinarysearch}
> +    PATH=$PATH:/usr/libexec
> +    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
> @@ -154,4 +155,6 @@ qemu_binary ()
>          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
>  }
> diff --git a/x86/run b/x86/run
> index eebfef9..b4db2a9 100755
> --- a/x86/run
> +++ b/x86/run
> @@ -2,8 +2,7 @@
> 
>  [ -z "$STANDALONE" ] && source scripts/arch-run.bash
> 
> -# qemu_binary () defined in scripts/arch-run.bash
> -qemu_binary
> +qemu=$(search_qemu_binary)
> 
>  if ! ${qemu} -device '?' 2>&1 | grep -F -e \"testdev\" -e \"pc-testdev\" > /dev/null;
>  then
> 
> 
> On 19/04/2017 21:14, Balamuruhan S wrote:
> > qemu_binary function to seach qemu binary similar to x86/run does
> > so that it can be reused for all arches
> > 
> > Signed-off-by: Balamuruhan S <bala24@linux.vnet.ibm.com>
> > ---
> >  scripts/arch-run.bash | 22 ++++++++++++++++++++++
> >  1 file changed, 22 insertions(+)
> > 
> > diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
> > index 94c50f3..404a4c0 100644
> > --- a/scripts/arch-run.bash
> > +++ b/scripts/arch-run.bash
> > @@ -133,3 +133,25 @@ migration_cmd ()
> >  		echo "run_migration"
> >  	fi
> >  }
> > +
> > +# qemu binary search function for all arches
> > +qemu_binary ()
> > +{
> > +    PATH=$PATH:/usr/libexec
> > +    qemubinarysearch="${QEMU:-qemu-system-$ARCH_NAME qemu-kvm}"
> > +    for qemucmd in ${qemubinarysearch}
> > +    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
> > +}
> > 
> 

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

end of thread, other threads:[~2017-04-21 12:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 19:14 [kvm-unit-tests PATCH 1/4] scripts/arch-run: function to search qemu binary Balamuruhan S
2017-04-21  6:46 ` Balamuruhan S
2017-04-21 11:07 ` Paolo Bonzini
2017-04-21 12:50   ` Balamuruhan S

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.