diff options
author | Aaron Lewis <aaronlewis@google.com> | 2023-04-07 16:32:51 -0700 |
---|---|---|
committer | Sean Christopherson <seanjc@google.com> | 2023-04-14 13:20:53 -0700 |
commit | c140e93a0c11ac5a56834ac11ddb0f777307b2c1 (patch) | |
tree | ae8a5b1b704b3fe29659aca5ec83ae34ede45ee5 /tools | |
parent | fa32233d51b9d26369b8371e986c1030c4201fae (diff) | |
download | linux-stable-c140e93a0c11ac5a56834ac11ddb0f777307b2c1.tar.gz linux-stable-c140e93a0c11ac5a56834ac11ddb0f777307b2c1.tar.bz2 linux-stable-c140e93a0c11ac5a56834ac11ddb0f777307b2c1.zip |
KVM: selftests: Print detailed info in PMU event filter asserts
Provide the actual vs. expected count in the PMU event filter test's
asserts instead of relying on pr_info() to provide the context, e.g. so
that all information needed to triage a failure is readily available even
if the environment in which the test is run captures only the assert
itself.
Signed-off-by: Aaron Lewis <aaronlewis@google.com>
[sean: rewrite changelog]
Link: https://lore.kernel.org/r/20230407233254.957013-4-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c index 20a1f4fc2f48..79feec24ae73 100644 --- a/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c +++ b/tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c @@ -246,18 +246,17 @@ static struct kvm_pmu_event_filter *remove_event(struct kvm_pmu_event_filter *f, #define ASSERT_PMC_COUNTING_INSTRUCTIONS(count) \ do { \ - if (count != NUM_BRANCHES) \ + if (count && count != NUM_BRANCHES) \ pr_info("%s: Branch instructions retired = %lu (expected %u)\n", \ __func__, count, NUM_BRANCHES); \ - TEST_ASSERT(count, "Allowed PMU event is not counting."); \ + TEST_ASSERT(count, "%s: Branch instructions retired = %lu (expected > 0)", \ + __func__, count); \ } while (0) #define ASSERT_PMC_NOT_COUNTING_INSTRUCTIONS(count) \ do { \ - if (count) \ - pr_info("%s: Branch instructions retired = %lu (expected 0)\n", \ - __func__, count); \ - TEST_ASSERT(!count, "Disallowed PMU Event is counting"); \ + TEST_ASSERT(!count, "%s: Branch instructions retired = %lu (expected 0)", \ + __func__, count); \ } while (0) static void test_without_filter(struct kvm_vcpu *vcpu) |