From patchwork Mon Feb 5 15:57:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alexis_Lothor=C3=A9?= X-Patchwork-Id: 38855 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6FE01C4828D for ; Mon, 5 Feb 2024 15:57:38 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by mx.groups.io with SMTP id smtpd.web10.66455.1707148655417918179 for ; Mon, 05 Feb 2024 07:57:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=oAZ5h28w; spf=pass (domain: bootlin.com, ip: 217.70.183.198, mailfrom: alexis.lothore@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id 6D0F4C0018; Mon, 5 Feb 2024 15:57:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1707148653; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=i2BmatOlVK5cJHKadWYIDbAXd9HY+Nij4DQAGUNlTKA=; b=oAZ5h28wfj26t66Krkr56tspJTQ+4QXaYBnyI2txpBsZMIYEMPl/0aWZdqtvuPW0Mcxyv4 hWjjHkNo2SfWJ8nhAwkfCBIWdULpEb6+fOhGA3vgeNzkzIk6pR7CfzUm7Fh5fN3GUJyn/9 /J64H0cImsBSjp5stdlHoEQ1kbVze/aLZs+R3+vvrh4vQ1n8wbVYBnL079l4MtESVznrfC K90wd5Eo7URc5jiitYZn164BuNiVxW8QQ2uuCWUJ1uH6pfOj+QqoO67FAr9xv1nijgEfSS aFNb/IvHNeLRPN1c6Nsv7xYx+RerbkhF1qLHqV+kWWIzamLoVOQ+OMossu1lYw== From: =?utf-8?q?Alexis_Lothor=C3=A9?= To: Cc: Thomas Petazzoni , Alexandre Belloni Subject: [OE-Core][PATCH 2/2] patchtest-send-results: properly parse test status Date: Mon, 5 Feb 2024 16:57:30 +0100 Message-ID: <20240205155730.115895-3-alexis.lothore@bootlin.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205155730.115895-1-alexis.lothore@bootlin.com> References: <20240205155730.115895-1-alexis.lothore@bootlin.com> MIME-Version: 1.0 X-GND-Sasl: alexis.lothore@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Mon, 05 Feb 2024 15:57:38 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/194954 From: Alexis Lothoré 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: : [1] https://lore.kernel.org/openembedded-core/0101018d79bfe020-06f2ce89-ea19-456b-92e7-66ee1c710fd1-000000@us-west-2.amazonses.com/ Signed-off-by: Alexis Lothoré --- scripts/patchtest-send-results | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/patchtest-send-results b/scripts/patchtest-send-results index 024be003ceb7..075b60d8f7d5 100755 --- a/scripts/patchtest-send-results +++ b/scripts/patchtest-send-results @@ -33,6 +33,9 @@ under 'Yocto Project Subprojects'). For more information on specific failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank you!""" +def has_a_failed_test(raw_results): + return any(raw_result.split(':')[0] == "FAIL" for raw_result in raw_results.splitlines()) + 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") args = parser.parse_args() @@ -69,7 +72,7 @@ from_address = "patchtest@automation.yoctoproject.org" # mailing list to CC cc_address = "openembedded-core@lists.openembedded.org" -if "FAIL" in testresult: +if has_a_failed_test(testresult): reply_contents = None if len(max(open(result_file, 'r'), key=len)) > 220: warning = "Tests failed for the patch, but the results log could not be processed due to excessive result line length."