KVM: selftests: Clean up stats fd in common stats_test() helper
authorSean Christopherson <seanjc@google.com>
Tue, 11 Jul 2023 23:01:27 +0000 (16:01 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 29 Jul 2023 15:05:29 +0000 (11:05 -0400)
commit87d53582bc8be30a11654a45fac0a257ed830ea8
tree5026f1ef3bdad858bcc740742f3e454584ea5e6e
parent625646aede90554fed8d46fd0e081238e071ac5e
KVM: selftests: Clean up stats fd in common stats_test() helper

Move the stats fd cleanup code into stats_test() and drop the
superfluous vm_stats_test() and vcpu_stats_test() helpers in order to
decouple creation of the stats file from consuming/testing the file
(deduping code is a bonus).  This will make it easier to test various
edge cases related to stats, e.g. that userspace can dup() a stats fd,
that userspace can have multiple stats files for a singleVM/vCPU, etc.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230711230131.648752-4-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/kvm_binary_stats_test.c