[2/2] KVM: selftests: Report enable_pmu module value when test is skipped

Message ID 20230214084920.59787-3-likexu@tencent.com
State New
Headers
Series KVM: selftests: Report enable_pmu module value when test is skipped |

Commit Message

Like Xu Feb. 14, 2023, 8:49 a.m. UTC
  From: Like Xu <likexu@tencent.com>

Running x86_64/pmu_event_filter_test with enable_pmu globally disabled
will report the following skipping prompt:
	1..0 # SKIP - Requirement not met: use_intel_pmu() || use_amd_pmu()
this can be confusing, so add a check on enable_pmu.

Signed-off-by: Like Xu <likexu@tencent.com>
---
 tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 1 +
 1 file changed, 1 insertion(+)
  

Comments

Sean Christopherson Feb. 14, 2023, 6:03 p.m. UTC | #1
On Tue, Feb 14, 2023, Like Xu wrote:
> From: Like Xu <likexu@tencent.com>
> 
> Running x86_64/pmu_event_filter_test with enable_pmu globally disabled
> will report the following skipping prompt:
> 	1..0 # SKIP - Requirement not met: use_intel_pmu() || use_amd_pmu()
> this can be confusing, so add a check on enable_pmu.
> 
> Signed-off-by: Like Xu <likexu@tencent.com>
> ---
>  tools/testing/selftests/kvm/x86_64/pmu_event_filter_test.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> 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 bad7ef8c5b92..070bc8a60a7f 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
> @@ -771,6 +771,7 @@ int main(int argc, char *argv[])
>  	TEST_REQUIRE(kvm_has_cap(KVM_CAP_PMU_EVENT_FILTER));
>  	TEST_REQUIRE(kvm_has_cap(KVM_CAP_PMU_EVENT_MASKED_EVENTS));
>  
> +	TEST_REQUIRE(get_kvm_param_bool("enable_pmu"));

I think it makes sense to put this at the very top, just in case more requirements
that depend on enable_pmu get added in the future.  I can do that when applying.

I'll plan on grabbing this for 6.4.

Thanks!
  

Patch

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 bad7ef8c5b92..070bc8a60a7f 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
@@ -771,6 +771,7 @@  int main(int argc, char *argv[])
 	TEST_REQUIRE(kvm_has_cap(KVM_CAP_PMU_EVENT_FILTER));
 	TEST_REQUIRE(kvm_has_cap(KVM_CAP_PMU_EVENT_MASKED_EVENTS));
 
+	TEST_REQUIRE(get_kvm_param_bool("enable_pmu"));
 	TEST_REQUIRE(use_intel_pmu() || use_amd_pmu());
 	guest_code = use_intel_pmu() ? intel_guest_code : amd_guest_code;