diff mbox series

[kvm-unit-tests] run_tests: allow specifying desired tests on the command line

Message ID 1550160013-10938-1-git-send-email-pbonzini@redhat.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] run_tests: allow specifying desired tests on the command line | expand

Commit Message

Paolo Bonzini Feb. 14, 2019, 4 p.m. UTC
This is a simpler version of Sean Christopherson's patch, which also allows
specifying more than one test.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 run_tests.sh         | 2 ++
 scripts/runtime.bash | 4 ++++
 2 files changed, 6 insertions(+)

Comments

Sean Christopherson Feb. 20, 2019, 6:26 p.m. UTC | #1
On Thursday, February 14, 2019, Paolo Bonzini wrote:
> This is a simpler version of Sean Christopherson's patch, which also allows
> specifying more than one test.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-and-Tested-by: Sean Christopherson <sean.j.christopherson@intel.com
diff mbox series

Patch

diff --git a/run_tests.sh b/run_tests.sh
index 102c806..6b0af19 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -65,6 +65,8 @@  while getopts "ag:htj:v" opt; do
             ;;
     esac
 done
+shift $((OPTIND - 1))
+only_tests="$*"
 
 # RUNTIME_log_file will be configured later
 RUNTIME_log_stderr () { cat >> $RUNTIME_log_file; }
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index fffa7dd..2f8026d 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -97,6 +97,10 @@  function run()
         return
     fi
 
+    if [ -n "$only_tests" ] && ! grep -qw "$testname" <<<$only_tests; then
+        return
+    fi
+
     if [ -n "$only_group" ] && ! grep -qw "$only_group" <<<$groups; then
         return
     fi