On Wed, Jan 26, 2022 at 02:52:42PM +0000, Mark Brown wrote:
The arch_timer and vgic_irq kselftests assume that they can create a vgic-v3, using the library function vgic_v3_setup() which aborts with a test failure if it is not possible to do so. Since vgic-v3 can only be instantiated on systems where the host has GICv3 this leads to false positives on older systems where that is not the case.
Fix this by changing vgic_v3_setup() to return an error if the vgic can't be instantiated and have the callers skip if this happens. We could also exit flagging a skip in vgic_v3_setup() but this would prevent future test cases conditionally deciding which GIC to use or generally doing more complex output.
Signed-off-by: Mark Brown broonie@kernel.org
v3:
- Use custom print_skip() helper.
- Use internal version of _kvm_create_device.
v2:
- The test for being able to create the GIC doesn't actually instantiate it, add a call doing so in that case.
tools/testing/selftests/kvm/aarch64/arch_timer.c | 7 ++++++- tools/testing/selftests/kvm/aarch64/vgic_irq.c | 4 ++++ tools/testing/selftests/kvm/lib/aarch64/vgic.c | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-)
Reviewed-by: Andrew Jones drjones@redhat.com