diff mbox series

How to run a single test on kselftest

Message ID 20230814195059.GA6500@yjiang5-mobl.amr.corp.intel.com (mailing list archive)
State New
Headers show
Series How to run a single test on kselftest | expand

Commit Message

Yunhong Jiang Aug. 14, 2023, 7:50 p.m. UTC
Hi,
   Can anyone give some hints on how to run a single test on the kselftest
framework? The reason that I want such support is because I have to run
test cases inside emulator, which is very slow.

   Per the kselftest documents, I can run kvm selftests with "make
-C tools/testing/selftests TARGETS=kvm run_tests", but it does not provide
a mechanism to run a single test in KVM subsystem. It takes a very long
time to finish the KVM subset testing inside the slow emulator while I'm
only trying to replace/add one testcase.

   Currently I modify the code like below, to run only a single test. Not
sure if there is a more generic way to do that. If no such mechanism and
there are more people have similar need, is it possible to add it? I'm more
than happy to contribute with guide.

Thank you
--jyh
diff mbox series

Patch

diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
index c692cc86e7da..25fce1a3ceb8 100644
--- a/tools/testing/selftests/kvm/Makefile
+++ b/tools/testing/selftests/kvm/Makefile
@@ -56,7 +56,7 @@  LIBKVM_riscv += lib/riscv/processor.c
 LIBKVM_riscv += lib/riscv/ucall.c

 # Non-compiled test targets
-TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh
+#TEST_PROGS_x86_64 += x86_64/nx_huge_pages_test.sh

 # Compiled test targets
 TEST_GEN_PROGS_x86_64 = x86_64/cpuid_test
@@ -135,7 +135,7 @@  TEST_GEN_PROGS_x86_64 += kvm_binary_stats_test
 TEST_GEN_PROGS_x86_64 += system_counter_offset_test

 # Compiled outputs used by test targets
-TEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test
+#TEST_GEN_PROGS_EXTENDED_x86_64 += x86_64/nx_huge_pages_test

 TEST_GEN_PROGS_aarch64 += aarch64/aarch32_id_regs
 TEST_GEN_PROGS_aarch64 += aarch64/arch_timer
@@ -186,6 +186,8 @@  TEST_GEN_PROGS += $(TEST_GEN_PROGS_$(ARCH_DIR))
 TEST_GEN_PROGS_EXTENDED += $(TEST_GEN_PROGS_EXTENDED_$(ARCH_DIR))
 LIBKVM += $(LIBKVM_$(ARCH_DIR))

+TEST_GEN_PROGS = x86_64/cr4_cpuid_sync_test
+
 OVERRIDE_TARGETS = 1

 # lib.mak defines $(OUTPUT), prepends $(OUTPUT)/ to $(TEST_GEN_PROGS), and most