summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAlexis Lothoré <alexis.lothore@bootlin.com>2024-02-05 16:57:30 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2024-02-06 10:32:19 +0000
commit149f42b59ea18f2d04d8173642580dddadf3fdd0 (patch)
treee2420c2c5ea9a45db5378804ebf56558c8964087 /scripts
parentd0b817d946bac3c4862528fd41a194f506020e41 (diff)
downloadpoky-149f42b59ea18f2d04d8173642580dddadf3fdd0.tar.gz
patchtest-send-results: properly parse test status
patchtest-send-results currently search the word "FAIL" in the whole testresults file to decide whether it should send a report to patch submitter or not. This global search can lead to false positives, for example if the commit subject contains the word "FAIL" (as observed in [1]) Prevent those false positives by explicitely parsing the test status from each line. Each test result line, generated by the patchtest script, is expected to have the following format: <STATUS>: <some info, depending on the status> [1] https://lore.kernel.org/openembedded-core/0101018d79bfe020-06f2ce89-ea19-456b-92e7-66ee1c710fd1-000000@us-west-2.amazonses.com/ (From OE-Core rev: 3567c21af8ed65448f9325ee3fe85b8be839e1b5) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/patchtest-send-results5
1 files changed, 4 insertions, 1 deletions
diff --git a/scripts/patchtest-send-results b/scripts/patchtest-send-results
index 024be003ce..075b60d8f7 100755
--- a/scripts/patchtest-send-results
+++ b/scripts/patchtest-send-results
@@ -33,6 +33,9 @@ under 'Yocto Project Subprojects'). For more information on specific
33failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank 33failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
34you!""" 34you!"""
35 35
36def has_a_failed_test(raw_results):
37 return any(raw_result.split(':')[0] == "FAIL" for raw_result in raw_results.splitlines())
38
36parser = argparse.ArgumentParser(description="Send patchtest results to a submitter for a given patch") 39parser = argparse.ArgumentParser(description="Send patchtest results to a submitter for a given patch")
37parser.add_argument("-p", "--patch", dest="patch", required=True, help="The patch file to summarize") 40parser.add_argument("-p", "--patch", dest="patch", required=True, help="The patch file to summarize")
38args = parser.parse_args() 41args = parser.parse_args()
@@ -69,7 +72,7 @@ from_address = "patchtest@automation.yoctoproject.org"
69# mailing list to CC 72# mailing list to CC
70cc_address = "openembedded-core@lists.openembedded.org" 73cc_address = "openembedded-core@lists.openembedded.org"
71 74
72if "FAIL" in testresult: 75if has_a_failed_test(testresult):
73 reply_contents = None 76 reply_contents = None
74 if len(max(open(result_file, 'r'), key=len)) > 220: 77 if len(max(open(result_file, 'r'), key=len)) > 220:
75 warning = "Tests failed for the patch, but the results log could not be processed due to excessive result line length." 78 warning = "Tests failed for the patch, but the results log could not be processed due to excessive result line length."