[PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()

Pierrick Bouvier posted 39 patches 2 months, 2 weeks ago
There is a newer version of this series
[PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()
Posted by Pierrick Bouvier 2 months, 2 weeks ago
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
 tests/qtest/ipmi-bt-test.c  | 2 +-
 tests/qtest/ipmi-kcs-test.c | 4 ++--
 tests/qtest/rtl8139-test.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
index 383239bcd48..13f7c841f59 100644
--- a/tests/qtest/ipmi-bt-test.c
+++ b/tests/qtest/ipmi-bt-test.c
@@ -251,7 +251,7 @@ static void emu_msg_handler(void)
         msg[msg_len++] = 0xa0;
         write_emu_msg(msg, msg_len);
     } else {
-        g_assert(0);
+        g_assert_not_reached();
     }
 }
 
diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c
index afc24dd3e46..3186c6ad64b 100644
--- a/tests/qtest/ipmi-kcs-test.c
+++ b/tests/qtest/ipmi-kcs-test.c
@@ -145,7 +145,7 @@ static void kcs_cmd(uint8_t *cmd, unsigned int cmd_len,
         break;
 
     default:
-        g_assert(0);
+        g_assert_not_reached();
     }
     *rsp_len = j;
 }
@@ -184,7 +184,7 @@ static void kcs_abort(uint8_t *cmd, unsigned int cmd_len,
         break;
 
     default:
-        g_assert(0);
+        g_assert_not_reached();
     }
 
     /* Start the abort here */
diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c
index eedf90f65af..55f671f2f59 100644
--- a/tests/qtest/rtl8139-test.c
+++ b/tests/qtest/rtl8139-test.c
@@ -65,7 +65,7 @@ PORT(IntrMask, w, 0x3c)
 PORT(IntrStatus, w, 0x3E)
 PORT(TimerInt, l, 0x54)
 
-#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert(0); } while (0)
+#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert_not_reached(); } while (0)
 
 static void test_timer(void)
 {
-- 
2.39.2
Re: [PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()
Posted by Thomas Huth 2 months, 2 weeks ago
On 11/09/2024 00.15, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   tests/qtest/ipmi-bt-test.c  | 2 +-
>   tests/qtest/ipmi-kcs-test.c | 4 ++--
>   tests/qtest/rtl8139-test.c  | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
> index 383239bcd48..13f7c841f59 100644
> --- a/tests/qtest/ipmi-bt-test.c
> +++ b/tests/qtest/ipmi-bt-test.c
> @@ -251,7 +251,7 @@ static void emu_msg_handler(void)
>           msg[msg_len++] = 0xa0;
>           write_emu_msg(msg, msg_len);
>       } else {
> -        g_assert(0);
> +        g_assert_not_reached();
>       }
>   }
>   
> diff --git a/tests/qtest/ipmi-kcs-test.c b/tests/qtest/ipmi-kcs-test.c
> index afc24dd3e46..3186c6ad64b 100644
> --- a/tests/qtest/ipmi-kcs-test.c
> +++ b/tests/qtest/ipmi-kcs-test.c
> @@ -145,7 +145,7 @@ static void kcs_cmd(uint8_t *cmd, unsigned int cmd_len,
>           break;
>   
>       default:
> -        g_assert(0);
> +        g_assert_not_reached();
>       }
>       *rsp_len = j;
>   }
> @@ -184,7 +184,7 @@ static void kcs_abort(uint8_t *cmd, unsigned int cmd_len,
>           break;
>   
>       default:
> -        g_assert(0);
> +        g_assert_not_reached();
>       }
>   
>       /* Start the abort here */
> diff --git a/tests/qtest/rtl8139-test.c b/tests/qtest/rtl8139-test.c
> index eedf90f65af..55f671f2f59 100644
> --- a/tests/qtest/rtl8139-test.c
> +++ b/tests/qtest/rtl8139-test.c
> @@ -65,7 +65,7 @@ PORT(IntrMask, w, 0x3c)
>   PORT(IntrStatus, w, 0x3E)
>   PORT(TimerInt, l, 0x54)
>   
> -#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert(0); } while (0)
> +#define fatal(...) do { g_test_message(__VA_ARGS__); g_assert_not_reached(); } while (0)
>   
>   static void test_timer(void)
>   {

Reviewed-by: Thomas Huth <thuth@redhat.com>
Re: [PATCH 12/39] tests/qtest: replace assert(0) with g_assert_not_reached()
Posted by Richard Henderson 2 months, 2 weeks ago
On 9/10/24 15:15, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
>   tests/qtest/ipmi-bt-test.c  | 2 +-
>   tests/qtest/ipmi-kcs-test.c | 4 ++--
>   tests/qtest/rtl8139-test.c  | 2 +-
>   3 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~