From: Avi Kivity <[email protected]>

  qemu -device testdev,chardev=log -chardev stdio,id=log \
       -kernel vmexit.flat -append 'test1 test2 test3'

will run test1, test2, and test3, and skip all others.

Signed-off-by: Avi Kivity <[email protected]>

diff --git a/x86/vmexit.c b/x86/vmexit.c
index 67746c6..31858ea 100644
--- a/x86/vmexit.c
+++ b/x86/vmexit.c
@@ -148,7 +148,21 @@ static void enable_nx(void *junk)
                wrmsr(MSR_EFER, rdmsr(MSR_EFER) | EFER_NX_MASK);
 }
 
-int main(void)
+bool test_wanted(struct test *test, char *wanted[], int nwanted)
+{
+       int i;
+
+       if (!nwanted)
+               return true;
+
+       for (i = 0; i < nwanted; ++i)
+               if (strcmp(wanted[i], test->name) == 0)
+                       return true;
+
+       return false;
+}
+
+int main(int ac, char **av)
 {
        int i;
 
@@ -158,7 +172,8 @@ int main(void)
                on_cpu(i-1, enable_nx, 0);
 
        for (i = 0; i < ARRAY_SIZE(tests); ++i)
-               do_test(&tests[i]);
+               if (test_wanted(&tests[i], av + 1, ac - 1))
+                       do_test(&tests[i]);
 
        return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to