diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2020-07-01 11:43:07 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2020-07-01 12:37:38 +0200 |
commit | b373304853a072b2aed720ecd45e752cda223465 (patch) | |
tree | f67cae980048b5a34cee347ae576671492c453bf | |
parent | a4ff5dcebf2f666aeff4d67d3a1fcffa076e736c (diff) | |
download | kvm-unit-tests-b373304853a072b2aed720ecd45e752cda223465.tar.gz |
scripts: Fix the check whether testname is in the only_tests list
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. Because "grep -w" does not consider the "-" character as
part of a word, "ioapic" successfully matches against "ioapic-split".
To fix the issue, use spaces as the only delimiter when running "grep",
removing the problematic "-w" flag from the invocation. While at it,
add "-F" to avoid unintended use of regular expression metacharacters.
Reported-by: Thomas Huth <thuth@redhat.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r-- | scripts/runtime.bash | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 8bfe31c..c88e246 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -68,6 +68,11 @@ function print_result() fi } +function find_word() +{ + grep -Fq " $1 " <<< " $2 " +} + function run() { local testname="$1" @@ -84,15 +89,15 @@ function run() return fi - if [ -n "$only_tests" ] && ! grep -qw "$testname" <<<$only_tests; then + if [ -n "$only_tests" ] && ! find_word "$testname" "$only_tests"; then return fi - if [ -n "$only_group" ] && ! grep -qw "$only_group" <<<$groups; then + if [ -n "$only_group" ] && ! find_word "$only_group" "$groups"; then return fi - if [ -z "$only_group" ] && grep -qw "nodefault" <<<$groups && + if [ -z "$only_group" ] && find_word nodefault "$groups" && skip_nodefault; then print_result "SKIP" $testname "" "test marked as manual run only" return; |