diff mbox series

[2/3] kunit: Fix reporting of the skipped parameterized tests

Message ID 20230411160056.1586-3-michal.wajdeczko@intel.com (mailing list archive)
State Accepted
Commit b08f75b9bb0196a626a804e76970733f0a05de94
Delegated to: Brendan Higgins
Headers show
Series kunit: Fix reporting of the skipped parameterized tests | expand

Commit Message

Michal Wajdeczko April 11, 2023, 4 p.m. UTC
Logs from the parameterized tests that were skipped don't include
SKIP directive thus they are displayed as PASSED. Fix that.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: David Gow <davidgow@google.com>
---
 lib/kunit/test.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Rae Moar April 12, 2023, 7:42 p.m. UTC | #1
On Tue, Apr 11, 2023 at 12:01 PM Michal Wajdeczko
<michal.wajdeczko@intel.com> wrote:
>
> Logs from the parameterized tests that were skipped don't include
> SKIP directive thus they are displayed as PASSED. Fix that.

Hi Michal!

This fix looks good to me. Thanks for fixing this!

The only comment I would have for this patch is if we should consider
using an altered version of kunit_print_ok_not_ok() here instead.
However, it seems you address this in the next patch.

Thanks again,
Rae

Reviewed-by: Rae Moar <rmoar@google.com>

>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: David Gow <davidgow@google.com>
> ---
>  lib/kunit/test.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index c9e15bb60058..5679197b5f8a 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -556,9 +556,11 @@ int kunit_run_tests(struct kunit_suite *suite)
>
>                                 kunit_log(KERN_INFO, &test,
>                                           KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
> -                                         "%s %d %s",
> +                                         "%s %d %s%s%s",
>                                           kunit_status_to_ok_not_ok(test.status),
> -                                         test.param_index + 1, param_desc);
> +                                         test.param_index + 1, param_desc,
> +                                         test.status == KUNIT_SKIPPED ? " # SKIP " : "",
> +                                         test.status == KUNIT_SKIPPED ? test.status_comment : "");
>
>                                 /* Get next param. */
>                                 param_desc[0] = '\0';
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20230411160056.1586-3-michal.wajdeczko%40intel.com.
David Gow April 13, 2023, 6:27 a.m. UTC | #2
On Wed, 12 Apr 2023 at 00:01, Michal Wajdeczko
<michal.wajdeczko@intel.com> wrote:
>
> Logs from the parameterized tests that were skipped don't include
> SKIP directive thus they are displayed as PASSED. Fix that.
>
> Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: David Gow <davidgow@google.com>
> ---

Nice catch, thanks!

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David

>  lib/kunit/test.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index c9e15bb60058..5679197b5f8a 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -556,9 +556,11 @@ int kunit_run_tests(struct kunit_suite *suite)
>
>                                 kunit_log(KERN_INFO, &test,
>                                           KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
> -                                         "%s %d %s",
> +                                         "%s %d %s%s%s",
>                                           kunit_status_to_ok_not_ok(test.status),
> -                                         test.param_index + 1, param_desc);
> +                                         test.param_index + 1, param_desc,
> +                                         test.status == KUNIT_SKIPPED ? " # SKIP " : "",
> +                                         test.status == KUNIT_SKIPPED ? test.status_comment : "");
>
>                                 /* Get next param. */
>                                 param_desc[0] = '\0';
> --
> 2.25.1
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+unsubscribe@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20230411160056.1586-3-michal.wajdeczko%40intel.com.
diff mbox series

Patch

diff --git a/lib/kunit/test.c b/lib/kunit/test.c
index c9e15bb60058..5679197b5f8a 100644
--- a/lib/kunit/test.c
+++ b/lib/kunit/test.c
@@ -556,9 +556,11 @@  int kunit_run_tests(struct kunit_suite *suite)
 
 				kunit_log(KERN_INFO, &test,
 					  KUNIT_SUBTEST_INDENT KUNIT_SUBTEST_INDENT
-					  "%s %d %s",
+					  "%s %d %s%s%s",
 					  kunit_status_to_ok_not_ok(test.status),
-					  test.param_index + 1, param_desc);
+					  test.param_index + 1, param_desc,
+					  test.status == KUNIT_SKIPPED ? " # SKIP " : "",
+					  test.status == KUNIT_SKIPPED ? test.status_comment : "");
 
 				/* Get next param. */
 				param_desc[0] = '\0';