[PATCH v2 3/6] genirq/test: Fail early if we can't request an IRQ

Brian Norris posted 6 patches 1 month, 1 week ago
[PATCH v2 3/6] genirq/test: Fail early if we can't request an IRQ
Posted by Brian Norris 1 month, 1 week ago
Requesting the IRQ is part of basic setup of the test. 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>
Reviewed-by: David Gow <davidgow@google.com>
---

(no changes since v1)

 kernel/irq/irq_test.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/irq/irq_test.c b/kernel/irq/irq_test.c
index f8f4532c2805..56baeb5041d6 100644
--- a/kernel/irq/irq_test.c
+++ b/kernel/irq/irq_test.c
@@ -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));
-- 
2.51.0.rc2.233.g662b1ed5c5-goog
Re: [PATCH v2 3/6] genirq/test: Fail early if we can't request an IRQ
Posted by Guenter Roeck 1 month, 1 week ago
On Fri, Aug 22, 2025 at 11:59:04AM -0700, Brian Norris wrote:
> Requesting the IRQ is part of basic setup of the test. 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>
> Reviewed-by: David Gow <davidgow@google.com>

Tested-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 
> (no changes since v1)
> 
>  kernel/irq/irq_test.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/irq/irq_test.c b/kernel/irq/irq_test.c
> index f8f4532c2805..56baeb5041d6 100644
> --- a/kernel/irq/irq_test.c
> +++ b/kernel/irq/irq_test.c
> @@ -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));
> -- 
> 2.51.0.rc2.233.g662b1ed5c5-goog
>
[tip: irq/core] genirq/test: Fail early if interrupt request fails
Posted by tip-bot2 for Brian Norris 1 month ago
The following commit has been merged into the irq/core branch of tip:

Commit-ID:     988f45467f13c038f73a91f5154b66f278f495d4
Gitweb:        https://git.kernel.org/tip/988f45467f13c038f73a91f5154b66f278f495d4
Author:        Brian Norris <briannorris@chromium.org>
AuthorDate:    Fri, 22 Aug 2025 11:59:04 -07:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 03 Sep 2025 17:04:52 +02:00

genirq/test: Fail early if interrupt request fails

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 | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/kernel/irq/irq_test.c b/kernel/irq/irq_test.c
index f8f4532..56baeb5 100644
--- a/kernel/irq/irq_test.c
+++ b/kernel/irq/irq_test.c
@@ -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));