diff mbox series

[kvm-unit-tests,01/15] KVM: Add a "-t" option to run a specific test

Message ID 20190212233451.27740-2-sean.j.christopherson@intel.com (mailing list archive)
State New, archived
Headers show
Series KVM: clean up the nVMX config | expand

Commit Message

Sean Christopherson Feb. 12, 2019, 11:34 p.m. UTC
x86's nested-VMX test space is massive, to the point where the group
option, "-g", does not provide sufficient granularity, e.g. a user may
want to run the core VMX tests but not the VMCS shadow tests, which take
an absurdly long time to run due to exhuastively testing all VMCS field
values.

Note that x86's config is currently a bit of a train wreck as far as VMX
is concerned; the "-t" option is of limited value until the config is
revamped.

Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
---
 run_tests.sh         | 6 +++++-
 scripts/runtime.bash | 6 +++---
 2 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/run_tests.sh b/run_tests.sh
index aa2e65f..7d55e74 100755
--- a/run_tests.sh
+++ b/run_tests.sh
@@ -21,6 +21,7 @@  Usage: $0 [-h] [-v] [-a] [-g group] [-j NUM-TASKS]
     -a: Run all tests, including those flagged as 'nodefault'
         and those guarded by errata.
     -g: Only execute tests in the given group
+    -t: Only execute the given test
     -j: Execute tests in parallel
 
 Set the environment variable QEMU=/path/to/qemu-system-ARCH to
@@ -32,7 +33,7 @@  EOF
 RUNTIME_arch_run="./$TEST_DIR/run"
 source scripts/runtime.bash
 
-while getopts "ag:hj:v" opt; do
+while getopts "ag:t:hj:v" opt; do
     case $opt in
         a)
             run_all_tests="yes"
@@ -41,6 +42,9 @@  while getopts "ag:hj:v" opt; do
         g)
             only_group=$OPTARG
             ;;
+        t)
+            only_test=$OPTARG
+            ;;
         h)
             usage
             exit
diff --git a/scripts/runtime.bash b/scripts/runtime.bash
index 3f5f3e2..c2d0b6b 100644
--- a/scripts/runtime.bash
+++ b/scripts/runtime.bash
@@ -65,9 +65,9 @@  function run()
 
     if [ -z "$testname" ]; then
         return
-    fi
-
-    if [ -n "$only_group" ] && ! grep -qw "$only_group" <<<$groups; then
+    elif [ -n "$only_test" ] && [ "$only_test" != "$testname" ]; then
+        return
+    elif [ -n "$only_group" ] && ! grep -qw "$only_group" <<<$groups; then
         return
     fi