Re: [kvm-unit-tests PATCH] scripts: Fix the check whether testname is in the only_tests list

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 01/07/2020 10.57, Thomas Huth wrote:
On 01/07/2020 10.51, Paolo Bonzini wrote:
On 01/07/20 10:37, Thomas Huth wrote:
When you currently run

  ./run_tests.sh ioapic-split

the kvm-unit-tests run scripts do not only execute the "ioapic-split"
test, but also the "ioapic" test, which is quite surprising. This
happens because we use "grep -w" for checking whether a test should
be run or not - and "grep -w" does not consider the "-" character as
part of a word.

To fix the issue, convert the dash into an underscore character before
running "grep -w".

Signed-off-by: Thomas Huth <thuth@xxxxxxxxxx>
---
  scripts/runtime.bash | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 8bfe31c..03fd20a 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -84,7 +84,8 @@ function run()
          return
      fi
-    if [ -n "$only_tests" ] && ! grep -qw "$testname" <<<$only_tests; then
+    if [ -n "$only_tests" ] && ! sed s/-/_/ <<<$only_tests \
+                               | grep -qw $(sed s/-/_/ <<< "$testname") ; then
          return
      fi


Simpler: grep -q " $testname " <<< " $only_tests "

That doesn't work:

I obviously missed the surrounding spaces ... not enough coffee... ;-)

 Thomas




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux