perf test: Extend perf kvm tests to check default event

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

Tested-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
Namhyung Kim
2026-07-01 12:41:53 -07:00
parent ab42c7b943
commit 3ec1248747

View File

@@ -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