scripts: Search the entire string for the correct accelerator
Sean Christopherson
reviewerPATCH 1/1 scripts: Search the entire string for the correct accelerator
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)
--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/runtime.bash +1 -1
@@ -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
Signature · 1 line
2.49.0.850.g28803427d3-goog
Quoted 16 lines · 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 <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +0
-0
scripts/runtime.bash function run() · line 129
Quoted 5 lines
scripts/runtime.bash +1
-1@@ -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
Quoted 8 lines
scripts/runtime.bash +0
-0print_result "SKIP" $testname "" "$accel only, but ACCEL=$ACCEL" return 2 elif [ -n "$ACCEL" ]; thenbase-commit:
0d3cb7dd56ec255a71af867c2d76c8f4b22cd420Signature · 1 line
2.49.0.850.g28803427d3-goog
Sean Christopherson
reviewerQuoted 20 lines · Andrew Jones
Quoted 19 lines · 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 <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +0
-0@@ -126,7 +126,7 @@ function run() machine="$MACHINE" fi
Quoted 8 lines
scripts/runtime.bash function run() · line 129
Quoted 2 lines
scripts/runtime.bash +1
-1- if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then + if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; thenLet'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)?
Quoted 26 lines · Sean Christopherson
Quoted 25 lines · Andrew Jones
Quoted 16 lines · 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 <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +0
-0scripts/runtime.bash function run() · line 129
Quoted 5 lines
scripts/runtime.bash +1
-1@@ -126,7 +126,7 @@ function run() machine="$MACHINE" fi - if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then + if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; thenLet's use
Quoted 5 lines
Quoted 3 lines
[[ ! $ACCEL =~ ^$accel(,.*|$) ]]
to be a bit more precise.
Sadist. :-)
Hehe
Quoted 7 lines
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
Sean Christopherson
reviewerQuoted 43 lines · Andrew Jones
Quoted 26 lines · Sean Christopherson
Quoted 25 lines · Andrew Jones
Quoted 16 lines · 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 <[email protected]>--- scripts/runtime.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)scripts/runtime.bash +0
-0scripts/runtime.bash function run() · line 129
Quoted 5 lines
scripts/runtime.bash +1
-1@@ -126,7 +126,7 @@ function run() machine="$MACHINE" fi - if [ -n "$accel" ] && [ -n "$ACCEL" ] && [ "$accel" != "$ACCEL" ]; then + if [ -n "$accel" ] && [ -n "$ACCEL" ] && [[ ! "$ACCEL" =~ $accel ]]; thenLet's use
Quoted 5 lines
Quoted 3 lines
[[ ! $ACCEL =~ ^$accel(,.*|$) ]]
to be a bit more precise.
Sadist. :-)
Hehe
Quoted 7 lines
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)?
Quoted 6 lines
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.