diff options
author | Jing Zhang | 2021-08-02 16:56:31 +0000 |
---|---|---|
committer | Paolo Bonzini | 2021-08-20 16:06:32 -0400 |
commit | d49b11f080b77f5bd66eec938e01b87a16ef201f (patch) | |
tree | 222f061c4ba72555f997ebed3a52e9405a5b2ea6 /tools | |
parent | 0176ec51290f8ef543a8c18a02e932d6ccedbbc5 (diff) |
KVM: selftests: Add checks for histogram stats bucket_size field
The bucket_size field should be non-zero for linear histogram stats and
should be zero for other stats types.
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Jing Zhang <jingzhangos@google.com>
Message-Id: <20210802165633.1866976-4-jingzhangos@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/kvm/kvm_binary_stats_test.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tools/testing/selftests/kvm/kvm_binary_stats_test.c b/tools/testing/selftests/kvm/kvm_binary_stats_test.c index 5906bbc08483..17f65d514915 100644 --- a/tools/testing/selftests/kvm/kvm_binary_stats_test.c +++ b/tools/testing/selftests/kvm/kvm_binary_stats_test.c @@ -109,6 +109,18 @@ static void stats_test(int stats_fd) /* Check size field, which should not be zero */ TEST_ASSERT(pdesc->size, "KVM descriptor(%s) with size of 0", pdesc->name); + /* Check bucket_size field */ + switch (pdesc->flags & KVM_STATS_TYPE_MASK) { + case KVM_STATS_TYPE_LINEAR_HIST: + TEST_ASSERT(pdesc->bucket_size, + "Bucket size of Linear Histogram stats (%s) is zero", + pdesc->name); + break; + default: + TEST_ASSERT(!pdesc->bucket_size, + "Bucket size of stats (%s) is not zero", + pdesc->name); + } size_data += pdesc->size * sizeof(*stats_data); } /* Check overlap */ |