[PATCH v3 6/6] perf test: Extend perf kvm tests to check default event

From: Namhyung Kim

Date: Wed Jul 01 2026 - 15:53:29 EST


It can now pass command line arguments to perf kvm record. Let's pass
'sleep 1' directly and see it doesn't fail.

$ sudo perf test -vv kvm
96: perf kvm tests:
---- start ----
test child forked, pid 3686726
Starting qemu-system-x86_64...
Testing perf kvm stat
Recording kvm events for pid 3686746 (duration 1s)...
perf kvm stat test [Success]
Testing perf kvm record/report
Recording kvm profile for pid 3686746 (duration 1s)...
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.576 MB /tmp/__perf_kvm_test.perf.data.0HgX6 (4009 samples) ]
perf kvm record/report test [Success]
Testing perf kvm buildid-list
perf kvm buildid-list test [Success]
Testing perf kvm stat live
perf kvm stat live test [Success]
Testing perf kvm record default event with command line
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.000 MB /dev/null ]
perf kvm record default event [Success]
---- end(0) ----
96: perf kvm tests : Ok

=== Test Summary ===
Passed main tests : 1
Passed subtests : 0
Skipped tests : 0
Failed tests : 0

Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
---
tools/perf/tests/shell/kvm.sh | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/tools/perf/tests/shell/kvm.sh b/tools/perf/tests/shell/kvm.sh
index a5396f8e6fe5ca82..7b26368051ffdbad 100755
--- a/tools/perf/tests/shell/kvm.sh
+++ b/tools/perf/tests/shell/kvm.sh
@@ -138,6 +138,15 @@ test_kvm_stat_live() {
echo "perf kvm stat live test [Success]"
}

+test_kvm_default_event() {
+ echo "Testing perf kvm record default event with command line"
+
+ # Check if kvm record with default events handle command line arguments
+ perf kvm record -p "${qemu_pid}" -o /dev/null sleep 1
+
+ echo "perf kvm record default event [Success]"
+}
+
setup_qemu() {
# Find qemu
if [ "$(uname -m)" = "x86_64" ]; then
@@ -191,6 +200,7 @@ if [ $err -eq 0 ]; then
test_kvm_record_report
test_kvm_buildid_list
test_kvm_stat_live
+ test_kvm_default_event
fi

cleanup
--
2.55.0.rc0.799.gd6f94ed593-goog