genirq/test: Fail early if interrupt request fails
authorBrian Norris <briannorris@chromium.org>
Fri, 22 Aug 2025 18:59:04 +0000 (11:59 -0700)
committerThomas Gleixner <tglx@linutronix.de>
Wed, 3 Sep 2025 15:04:52 +0000 (17:04 +0200)
Requesting an interrupt is part of the basic test setup. If it fails, most
of the subsequent tests are likely to fail, and the output gets noisy.

Use "assert" to fail early.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: David Gow <davidgow@google.com>
Link: https://lore.kernel.org/all/20250822190140.2154646-4-briannorris@chromium.org
kernel/irq/irq_test.c

index f8f4532..56baeb5 100644 (file)
@@ -71,7 +71,7 @@ static void irq_disable_depth_test(struct kunit *test)
        KUNIT_ASSERT_PTR_NE(test, desc, NULL);
 
        ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
-       KUNIT_EXPECT_EQ(test, ret, 0);
+       KUNIT_ASSERT_EQ(test, ret, 0);
 
        KUNIT_EXPECT_EQ(test, desc->depth, 0);
 
@@ -95,7 +95,7 @@ static void irq_free_disabled_test(struct kunit *test)
        KUNIT_ASSERT_PTR_NE(test, desc, NULL);
 
        ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
-       KUNIT_EXPECT_EQ(test, ret, 0);
+       KUNIT_ASSERT_EQ(test, ret, 0);
 
        KUNIT_EXPECT_EQ(test, desc->depth, 0);
 
@@ -106,7 +106,7 @@ static void irq_free_disabled_test(struct kunit *test)
        KUNIT_EXPECT_GE(test, desc->depth, 1);
 
        ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
-       KUNIT_EXPECT_EQ(test, ret, 0);
+       KUNIT_ASSERT_EQ(test, ret, 0);
        KUNIT_EXPECT_EQ(test, desc->depth, 0);
 
        free_irq(virq, NULL);
@@ -134,7 +134,7 @@ static void irq_shutdown_depth_test(struct kunit *test)
        KUNIT_ASSERT_PTR_NE(test, data, NULL);
 
        ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
-       KUNIT_EXPECT_EQ(test, ret, 0);
+       KUNIT_ASSERT_EQ(test, ret, 0);
 
        KUNIT_EXPECT_TRUE(test, irqd_is_activated(data));
        KUNIT_EXPECT_TRUE(test, irqd_is_started(data));
@@ -191,7 +191,7 @@ static void irq_cpuhotplug_test(struct kunit *test)
        KUNIT_ASSERT_PTR_NE(test, data, NULL);
 
        ret = request_irq(virq, noop_handler, 0, "test_irq", NULL);
-       KUNIT_EXPECT_EQ(test, ret, 0);
+       KUNIT_ASSERT_EQ(test, ret, 0);
 
        KUNIT_EXPECT_TRUE(test, irqd_is_activated(data));
        KUNIT_EXPECT_TRUE(test, irqd_is_started(data));