public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator
@ 2025-04-25 22:05 Sean Christopherson
  2025-04-26 12:00 ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2025-04-25 22:05 UTC (permalink / raw)
  To: Thomas Huth, Andrew Jones; +Cc: kvm, Sean Christopherson

Search the entire ACCEL string for the required accelerator as searching
for an exact match incorrectly rejects ACCEL when additional accelerator
specific options are provided, e.g.

  SKIP pmu (kvm only, but ACCEL=kvm,kernel_irqchip=on)

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 scripts/runtime.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 4b9c7d6b..59d1727c 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -126,7 +126,7 @@ function run()
         machine="$MACHINE"
     fi
 
-    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then
+    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; then
         print_result "SKIP" $testname "" "$accel only, but ACCEL=$ACCEL"
         return 2
     elif [ -n "$ACCEL" ]; then

base-commit: 0d3cb7dd56ec255a71af867c2d76c8f4b22cd420
-- 
2.49.0.850.g28803427d3-goog


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

* Re: [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator
  2025-04-25 22:05 [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator Sean Christopherson
@ 2025-04-26 12:00 ` Andrew Jones
  2025-05-01 22:35   ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2025-04-26 12:00 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: Thomas Huth, Andrew Jones, kvm

On Fri, Apr 25, 2025 at 03:05:57PM -0700, Sean Christopherson wrote:
> Search the entire ACCEL string for the required accelerator as searching
> for an exact match incorrectly rejects ACCEL when additional accelerator
> specific options are provided, e.g.
> 
>   SKIP pmu (kvm only, but ACCEL=kvm,kernel_irqchip=on)
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
>  scripts/runtime.bash | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> index 4b9c7d6b..59d1727c 100644
> --- a/scripts/runtime.bash
> +++ b/scripts/runtime.bash
> @@ -126,7 +126,7 @@ function run()
>          machine="$MACHINE"
>      fi
>  
> -    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then
> +    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; then

Let's use

 [[ ! $ACCEL =~ ^$accel(,.*|$) ]]

to be a bit more precise.

Thanks,
drew

>          print_result "SKIP" $testname "" "$accel only, but ACCEL=$ACCEL"
>          return 2
>      elif [ -n "$ACCEL" ]; then
> 
> base-commit: 0d3cb7dd56ec255a71af867c2d76c8f4b22cd420
> -- 
> 2.49.0.850.g28803427d3-goog
> 

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

* Re: [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator
  2025-04-26 12:00 ` Andrew Jones
@ 2025-05-01 22:35   ` Sean Christopherson
  2025-05-02  9:25     ` Andrew Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Sean Christopherson @ 2025-05-01 22:35 UTC (permalink / raw)
  To: Andrew Jones; +Cc: Thomas Huth, Andrew Jones, kvm

On Sat, Apr 26, 2025, Andrew Jones wrote:
> On Fri, Apr 25, 2025 at 03:05:57PM -0700, Sean Christopherson wrote:
> > Search the entire ACCEL string for the required accelerator as searching
> > for an exact match incorrectly rejects ACCEL when additional accelerator
> > specific options are provided, e.g.
> > 
> >   SKIP pmu (kvm only, but ACCEL=kvm,kernel_irqchip=on)
> > 
> > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > ---
> >  scripts/runtime.bash | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > index 4b9c7d6b..59d1727c 100644
> > --- a/scripts/runtime.bash
> > +++ b/scripts/runtime.bash
> > @@ -126,7 +126,7 @@ function run()
> >          machine="$MACHINE"
> >      fi
> >  
> > -    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then
> > +    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; then
> 
> Let's use
> 
>  [[ ! $ACCEL =~ ^$accel(,.*|$) ]]
> 
> to be a bit more precise.

Sadist.  :-)

Why the ".*"?  Isn't that the same as:

  [[ ! "$ACCEL" =~ ^$accel(,|$) ]]

Or are my regex skills worse than I realize (and I fully realize they're really,
really bad)?

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

* Re: [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator
  2025-05-01 22:35   ` Sean Christopherson
@ 2025-05-02  9:25     ` Andrew Jones
  2025-05-02 13:54       ` Sean Christopherson
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Jones @ 2025-05-02  9:25 UTC (permalink / raw)
  To: Sean Christopherson; +Cc: Thomas Huth, Andrew Jones, kvm

On Thu, May 01, 2025 at 03:35:08PM -0700, Sean Christopherson wrote:
> On Sat, Apr 26, 2025, Andrew Jones wrote:
> > On Fri, Apr 25, 2025 at 03:05:57PM -0700, Sean Christopherson wrote:
> > > Search the entire ACCEL string for the required accelerator as searching
> > > for an exact match incorrectly rejects ACCEL when additional accelerator
> > > specific options are provided, e.g.
> > > 
> > >   SKIP pmu (kvm only, but ACCEL=kvm,kernel_irqchip=on)
> > > 
> > > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > > ---
> > >  scripts/runtime.bash | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > > index 4b9c7d6b..59d1727c 100644
> > > --- a/scripts/runtime.bash
> > > +++ b/scripts/runtime.bash
> > > @@ -126,7 +126,7 @@ function run()
> > >          machine="$MACHINE"
> > >      fi
> > >  
> > > -    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then
> > > +    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; then
> > 
> > Let's use
> > 
> >  [[ ! $ACCEL =~ ^$accel(,.*|$) ]]
> > 
> > to be a bit more precise.
> 
> Sadist.  :-)

Hehe

> 
> Why the ".*"?  Isn't that the same as:
> 
>   [[ ! "$ACCEL" =~ ^$accel(,|$) ]]
> 
> Or are my regex skills worse than I realize (and I fully realize they're really,
> really bad)?

Oops, that ".*" should have been a ".+" since the intention was to avoid
accepting 'kvm,', but, of course you're right, that .* still allows it,
making it equivalent to nothing at all.

We can either just drop the .* and accept 'kvm,' (because why not) or
change that * to +.

Thanks,
drew

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

* Re: [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator
  2025-05-02  9:25     ` Andrew Jones
@ 2025-05-02 13:54       ` Sean Christopherson
  0 siblings, 0 replies; 5+ messages in thread
From: Sean Christopherson @ 2025-05-02 13:54 UTC (permalink / raw)
  To: Andrew Jones; +Cc: Thomas Huth, Andrew Jones, kvm

On Fri, May 02, 2025, Andrew Jones wrote:
> On Thu, May 01, 2025 at 03:35:08PM -0700, Sean Christopherson wrote:
> > On Sat, Apr 26, 2025, Andrew Jones wrote:
> > > On Fri, Apr 25, 2025 at 03:05:57PM -0700, Sean Christopherson wrote:
> > > > Search the entire ACCEL string for the required accelerator as searching
> > > > for an exact match incorrectly rejects ACCEL when additional accelerator
> > > > specific options are provided, e.g.
> > > > 
> > > >   SKIP pmu (kvm only, but ACCEL=kvm,kernel_irqchip=on)
> > > > 
> > > > Signed-off-by: Sean Christopherson <seanjc@google.com>
> > > > ---
> > > >  scripts/runtime.bash | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/scripts/runtime.bash b/scripts/runtime.bash
> > > > index 4b9c7d6b..59d1727c 100644
> > > > --- a/scripts/runtime.bash
> > > > +++ b/scripts/runtime.bash
> > > > @@ -126,7 +126,7 @@ function run()
> > > >          machine="$MACHINE"
> > > >      fi
> > > >  
> > > > -    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then
> > > > +    if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; then
> > > 
> > > Let's use
> > > 
> > >  [[ ! $ACCEL =~ ^$accel(,.*|$) ]]
> > > 
> > > to be a bit more precise.
> > 
> > Sadist.  :-)
> 
> Hehe
> 
> > 
> > Why the ".*"?  Isn't that the same as:
> > 
> >   [[ ! "$ACCEL" =~ ^$accel(,|$) ]]
> > 
> > Or are my regex skills worse than I realize (and I fully realize they're really,
> > really bad)?
> 
> Oops, that ".*" should have been a ".+" since the intention was to avoid
> accepting 'kvm,', but, of course you're right, that .* still allows it,
> making it equivalent to nothing at all.
> 
> We can either just drop the .* and accept 'kvm,' (because why not) or
> change that * to +.

I'll drop the .*, as QEMU accepts "kvm,", i.e. it actually works.

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

end of thread, other threads:[~2025-05-02 13:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-25 22:05 [kvm-unit-tests PATCH] scripts: Search the entire string for the correct accelerator Sean Christopherson
2025-04-26 12:00 ` Andrew Jones
2025-05-01 22:35   ` Sean Christopherson
2025-05-02  9:25     ` Andrew Jones
2025-05-02 13:54       ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox