Add a -d/--debug option to patchtest-send-results so that the contents
of the constructed raw email can be checked without actually sending
anything to the list or patch author.

Signed-off-by: Trevor Gamblin <tgamb...@baylibre.com>
---
 scripts/patchtest-send-results | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/scripts/patchtest-send-results b/scripts/patchtest-send-results
index 9fd24c9b959..8190fe86c32 100755
--- a/scripts/patchtest-send-results
+++ b/scripts/patchtest-send-results
@@ -38,6 +38,7 @@ def has_a_failed_test(raw_results):
 
 parser = argparse.ArgumentParser(description="Send patchtest results to a 
submitter for a given patch")
 parser.add_argument("-p", "--patch", dest="patch", required=True, help="The 
patch file to summarize")
+parser.add_argument("-d", "--debug", dest="debug", required=False, 
action='store_true', help="Print raw email headers and content, but don't 
actually send it")
 args = parser.parse_args()
 
 if not os.path.exists(args.patch):
@@ -92,12 +93,16 @@ if has_a_failed_test(testresult):
         '\nMIME-Version: 1.0" + \
         "\nContent-type: 
Multipart/Mixed;boundary="NextPart"\n\n--NextPart\nContent-Type: 
text/plain\n\n' + \
         reply_contents + '\n\n--NextPart'
-    response = ses_client.send_raw_email(
-        Source="patcht...@automation.yoctoproject.org",
-        RawMessage={
-            "Data": raw_data,
-        },
-    )
+
+    if args.debug:
+        print(f"RawMessage: \n\n{raw_data}")
+    else:
+        response = ses_client.send_raw_email(
+            Source="patcht...@automation.yoctoproject.org",
+            RawMessage={
+                "Data": raw_data,
+            },
+        )
 
 else:
     print(f"No failures identified for {args.patch}.")
-- 
2.43.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#195698): 
https://lists.openembedded.org/g/openembedded-core/message/195698
Mute This Topic: https://lists.openembedded.org/mt/104381294/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to