public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [OE-core][PATCH 1/3] patchtest: add --error-on-failure option
@ 2026-03-18 16:12 naftaly.ralamboarivony
  2026-03-18 16:12 ` [OE-core][PATCH 2/3] patchtest/selftest: allow passing extra arguments to patchtest naftaly.ralamboarivony
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: naftaly.ralamboarivony @ 2026-03-18 16:12 UTC (permalink / raw)
  To: openembedded-core; +Cc: Naftaly RALAMBOARIVONY

From: Naftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>

Add a command line option to make patchtest return a non-zero exit
status when a test fails.

This keeps the current default behavior unchanged while allowing calling
scripts and shells to detect test failures through the process exit
status when explicitly requested.

Signed-off-by: Naftaly RALAMBOARIVONY <naftaly.ralamboarivony@smile.fr>
---
 meta/lib/patchtest/patchtest_parser.py | 3 +++
 scripts/patchtest                      | 8 ++++++--
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/meta/lib/patchtest/patchtest_parser.py b/meta/lib/patchtest/patchtest_parser.py
index 2a11cb76c2..ba5a171e27 100644
--- a/meta/lib/patchtest/patchtest_parser.py
+++ b/meta/lib/patchtest/patchtest_parser.py
@@ -73,6 +73,9 @@ class PatchtestParser(object):
                             action='store_true', 
                             help='Enable logging to a file matching the target patch name with ".testresult" appended')
 
+        parser.add_argument('--error-on-failure',
+                            action='store_true',
+                            help='Return non-zero exit status if a test fails')
 
         return parser
 
diff --git a/scripts/patchtest b/scripts/patchtest
index 9218db232a..653f2b217a 100755
--- a/scripts/patchtest
+++ b/scripts/patchtest
@@ -183,6 +183,7 @@ def print_result_message(preresult, postresult):
     print("----------------------------------------------------------------------\n")
 
 def main():
+    ret = 0
     tmp_patch = False
     patch_path = PatchtestParser.patch_path
     log_results = PatchtestParser.log_results
@@ -214,13 +215,16 @@ def main():
 
         try:
             if log_path:
-                run(patch, log_path)
+                ret = run(patch, log_path)
             else:
-                run(patch)
+                ret = run(patch)
         finally:
             if tmp_patch:
                 os.remove(patch)
 
+        if PatchtestParser.error_on_failure and ret != 0:
+            return ret
+
 if __name__ == '__main__':
     ret = 1
 


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-19 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 16:12 [OE-core][PATCH 1/3] patchtest: add --error-on-failure option naftaly.ralamboarivony
2026-03-18 16:12 ` [OE-core][PATCH 2/3] patchtest/selftest: allow passing extra arguments to patchtest naftaly.ralamboarivony
2026-03-18 16:12 ` [OE-core][PATCH 3/3] patchtest/selftest: add test case for --error-on-failure return code naftaly.ralamboarivony
2026-03-19 17:22 ` [OE-core][PATCH 1/3] patchtest: add --error-on-failure option Richard Purdie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox