[PATCH 4/6] genirq/test: Skip managed-affinity tests with !SPARSE_IRQ

Brian Norris posted 6 patches 1 month, 2 weeks ago
There is a newer version of this series
[PATCH 4/6] genirq/test: Skip managed-affinity tests with !SPARSE_IRQ
Posted by Brian Norris 1 month, 2 weeks ago
Managed-affinity is only supported with CONFIG_SPARSE_IRQ=y, so
irq_shutdown_depth_test() would fail with !irqd_affinity_is_managed().
Skip such tests if they're run without support.

Many architectures 'select SPARSE_IRQ', so this is easy to miss.

Fixes: 66067c3c8a1e ("genirq: Add kunit tests for depth counts")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Brian Norris <briannorris@chromium.org>
---

 kernel/irq/irq_test.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/irq/irq_test.c b/kernel/irq/irq_test.c
index 56baeb5041d6..ba85e4eb5211 100644
--- a/kernel/irq/irq_test.c
+++ b/kernel/irq/irq_test.c
@@ -46,6 +46,9 @@ static int irq_test_setup_fake_irq(struct kunit *test, struct irq_affinity_desc
 	struct irq_desc *desc;
 	int virq;
 
+	if (affd && !IS_ENABLED(CONFIG_SPARSE_IRQ))
+		kunit_skip(test, "requires CONFIG_SPARSE_IRQ for managed affinity");
+
 	virq = irq_domain_alloc_descs(-1, 1, 0, NUMA_NO_NODE, affd);
 	KUNIT_ASSERT_GE(test, virq, 0);
 
-- 
2.51.0.rc1.167.g924127e9c0-goog