diff mbox series

[v2] patchtest: log errors and failures at end

Message ID 20240214190302.8994-1-simone.p.weiss@posteo.com
State Accepted, archived
Commit 84ca5a5f5a44de6ed4551ab08e58087aaa7e1369
Headers show
Series [v2] patchtest: log errors and failures at end | expand

Commit Message

Simone Weiß Feb. 14, 2024, 7:03 p.m. UTC
From: Simone Weiß <simone.p.weiss@posteo.com>

At the moment, running patchtest locally will only print failures and errors
to the log when the not passing test case is executed. This might lead to
people overlooking issues with their patches, so print a log line at the
end if testcases showed issues. This should make it more easy to spot then
before.

Fixes [YOCTO #15389]

Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
---

Changes in v2:
- Adapt error message to not contail FAIL/PASS as this string is used to
  check for individual failed testcases.

 scripts/patchtest | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

Comments

Trevor Gamblin Feb. 14, 2024, 8:10 p.m. UTC | #1
On 2024-02-14 14:03, Simone Weiß wrote:
> From: Simone Weiß <simone.p.weiss@posteo.com>
>
> At the moment, running patchtest locally will only print failures and errors
> to the log when the not passing test case is executed. This might lead to
> people overlooking issues with their patches, so print a log line at the
> end if testcases showed issues. This should make it more easy to spot then
> before.
>
> Fixes [YOCTO #15389]
Thanks! LGTM.
>
> Signed-off-by: Simone Weiß <simone.p.weiss@posteo.com>
> ---
>
> Changes in v2:
> - Adapt error message to not contail FAIL/PASS as this string is used to
>    check for individual failed testcases.
>
>   scripts/patchtest | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/patchtest b/scripts/patchtest
> index a1c824f7b7..8c9a73e1db 100755
> --- a/scripts/patchtest
> +++ b/scripts/patchtest
> @@ -142,6 +142,8 @@ def _runner(resultklass, prefix=None):
>           logger.error(traceback.print_exc())
>           logger.error('patchtest: something went wrong')
>           return 1
> +    if result.test_failure or result.test_error:
> +        return 1
>   
>       return 0
>   
> @@ -158,9 +160,14 @@ def run(patch, logfile=None):
>       postmerge_resultklass = getResult(patch, True, logfile)
>       postmerge_result = _runner(postmerge_resultklass, 'test')
>   
> +    print('----------------------------------------------------------------------\n')
>       if premerge_result == 2 and postmerge_result == 2:
> -        logger.error('patchtest: any test cases found - did you specify the correct suite directory?')
> -
> +        logger.error('patchtest: Not any test cases found - did you specify the correct suite directory?')
> +    if premerge_result == 1 or postmerge_result == 1:
> +        logger.error('patchtest: At least one patchtest caused a failure or an error - please check')
> +    else:
> +        logger.error('patchtest: All patchtests passed')
> +    print('----------------------------------------------------------------------\n')
>       return premerge_result or postmerge_result
>   
>   def main():
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#195494): https://lists.openembedded.org/g/openembedded-core/message/195494
> Mute This Topic: https://lists.openembedded.org/mt/104359353/7611679
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [tgamblin@baylibre.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
diff mbox series

Patch

diff --git a/scripts/patchtest b/scripts/patchtest
index a1c824f7b7..8c9a73e1db 100755
--- a/scripts/patchtest
+++ b/scripts/patchtest
@@ -142,6 +142,8 @@  def _runner(resultklass, prefix=None):
         logger.error(traceback.print_exc())
         logger.error('patchtest: something went wrong')
         return 1
+    if result.test_failure or result.test_error:
+        return 1 
 
     return 0
 
@@ -158,9 +160,14 @@  def run(patch, logfile=None):
     postmerge_resultklass = getResult(patch, True, logfile)
     postmerge_result = _runner(postmerge_resultklass, 'test')
 
+    print('----------------------------------------------------------------------\n')
     if premerge_result == 2 and postmerge_result == 2:
-        logger.error('patchtest: any test cases found - did you specify the correct suite directory?')
-
+        logger.error('patchtest: Not any test cases found - did you specify the correct suite directory?')
+    if premerge_result == 1 or postmerge_result == 1:
+        logger.error('patchtest: At least one patchtest caused a failure or an error - please check')
+    else:
+        logger.error('patchtest: All patchtests passed')
+    print('----------------------------------------------------------------------\n')
     return premerge_result or postmerge_result
 
 def main():