From patchwork Fri Jun 16 12:02:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thiago Jung Bauermann X-Patchwork-Id: 109081 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1289610vqr; Fri, 16 Jun 2023 05:05:41 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4yfAocolEa6BolgZOLmjE2EDYuJCfyuHu6egBqpZPnEIPvSeW/fSOocjVcmD/zwYp2XXir X-Received: by 2002:a17:906:378f:b0:974:1f8f:89d7 with SMTP id n15-20020a170906378f00b009741f8f89d7mr1454332ejc.31.1686917141548; Fri, 16 Jun 2023 05:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686917141; cv=none; d=google.com; s=arc-20160816; b=ihKIPpwv7/O3QJku2nKazosdtDdozZFFPchz/QTmJx7PXHh9JM47UavtLVSX/iLCii X7lLY6/VhmKIART+qUFk/ZPdueRmCNIe0f/ff2YoW2WUeVYBPxD6v35Y5IlvGaaJWQYF xqYsMutJBEJM5LtUv5qjxZv6VPhGnXWiDicwCh6S60JAGdLuNmmicV/xMj0JRZ7nQnqw 1/Afhr0uD01Hpdt4P6IrCG7nXS+lLZevlH3jJtygn4ZdyRezecb0YFNnxOTEYV/z7vVj AKTDd9eoRhK6zt5xkCRdLFCudhf2OjaOU48kiHyKzJxWQszuaM/tsOASoiyve3I6tzUk M8vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=3ccJ++bL7KVTlOdQVLwZ69Ga+7mZTC4g2h/tBsaHj0Y=; b=JRFfw2hnBkaL5ubtDS1II51USn762lH09BbrcwOg1ifbyY0YjhutCL4T0dMTEBoa51 ZeMfWmCYCvOGQOHfVZbDoKeKFfOZcHZGxw/qy3WPxkW7gYm1kofhobRRb/oPXelz33z4 4nIWYIplrcIx0ozxgd7V0PEbb1AQ+hBe+ognUYgPK/ps1qW6xH9aWu+stESPL3s9Pzmm vHvPNDYPbSQ6++Wg2rO8Zvow4fheOUkH3jXsfwsARK840699TzC/mlKMBAOSOzlu1psr g+AkANzdtcl9UrscNw66SY1LL7DTcNk0YgpXgbMfrgxnjOl7G22AZrHtl0SaCVvg43j1 +NGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O6EuVVgT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id b3-20020a170906038300b0098236e5735esi5034221eja.928.2023.06.16.05.05.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 05:05:41 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=O6EuVVgT; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 770DF3858C2D for ; Fri, 16 Jun 2023 12:05:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 770DF3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686917140; bh=3ccJ++bL7KVTlOdQVLwZ69Ga+7mZTC4g2h/tBsaHj0Y=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=O6EuVVgT3q1/3XBxact6yc10fzPjDCGoVbXysqQpZCLEp/j7znPERP1dF0woV8ho0 KpxYv5EfGKMDWS+vGQa9uy6it0Ejz0G70jquDOfEAw8aYI56ZMt9aLNMyWf204bueh Q7Ltd0CeqWTGFGTjBVL8JsOU/NWvLNFINW9kRqz4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 2B0F43858D35 for ; Fri, 16 Jun 2023 12:04:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 2B0F43858D35 Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-98276e2a4bbso95249066b.0 for ; Fri, 16 Jun 2023 05:04:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686917097; x=1689509097; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=3ccJ++bL7KVTlOdQVLwZ69Ga+7mZTC4g2h/tBsaHj0Y=; b=lxEL/9xXw8OfROnxQd/wH7YQpWpefbebsbBB9TjxDv+/kslBmZXkfq8J5VDQ2lq1jJ wKW8+b2sC0c7ktkMqS+TSXHSdcTRZi/mRPWTCekFBAa4m4NZ5SWmbnHG1hEJeA8P594V Os9S4i1Ejd8sS80Lr8fGrLmjY9VbH3YZOMPlFYkSBauvIrcBZyMLZBEKJbo3O6TwYLiu OdW8kmqqN9LlbeC9XVIzzo6w3MOdh0++EcuBEwEnx3NflwWqCTNAdS6Xu59QENvQx8x+ QDW/y/qFXA9eTS+fIrU36No7oL/hpW0CcG4ZzviruAMZPsLWmAK4DPNAubbZ0m+X0w/7 6DMw== X-Gm-Message-State: AC+VfDwJMLNh6ZxHa/N0SObsZhS/dNNNZ22vEdWIvmgGYQSQjhifRCG2 paG5SNq9EcK5JwEHA1FFSxuxulJYoQ/ObZWemMY= X-Received: by 2002:a17:906:c156:b0:978:9223:661b with SMTP id dp22-20020a170906c15600b009789223661bmr1669694ejc.46.1686917096787; Fri, 16 Jun 2023 05:04:56 -0700 (PDT) Received: from localhost (ip-088-152-011-013.um26.pools.vodafone-ip.de. [88.152.11.13]) by smtp.gmail.com with ESMTPSA id le10-20020a170907170a00b009865c9e8f47sm418049ejc.179.2023.06.16.05.04.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 05:04:56 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Thiago Jung Bauermann Subject: [PATCH] [contrib] validate_failures.py: Don't consider summary line in wrong place Date: Fri, 16 Jun 2023 14:02:14 +0200 Message-Id: <20230616120214.114098-1-thiago.bauermann@linaro.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thiago Jung Bauermann via Gcc-patches From: Thiago Jung Bauermann Reply-To: Thiago Jung Bauermann Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768860828955784820?= X-GMAIL-MSGID: =?utf-8?q?1768860828955784820?= When parsing a summary or manifest file, if we're not either after a tool line (e.g. "=== gdb tests ===") or before a summary line (e.g., "=== gdb Summary ===") then the current line can't be a valid result line so ignore it. This addresses a problem we're seeing when running the GDB testsuite in our CI environment where it produces a valid summary file, but then after the "=== gdb Summary ===" section it outputs a series of Tcl errors that match _VALID_TEST_RESULTS_REX and thus confuse the parsing logic: 05: 14:32 .sum file seems to be broken: tool="None", exp="None", summary_line="ERROR: -------------------------------------------" 05: 14:32 Traceback (most recent call last): 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 706, in 05: 14:32 retval = Main(sys.argv) 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 697, in Main 05: 14:32 retval = CheckExpectedResults() 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 572, in CheckExpectedResults 05: 14:32 actual = GetResults(sum_files) 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 447, in GetResults 05: 14:32 build_results.update(ParseSummary(sum_fname)) 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 389, in ParseSummary 05: 14:32 result = result_set.MakeTestResult(line, ordinal) 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 236, in MakeTestResult 05: 14:32 return TestResult(summary_line, ordinal, 05: 14:32 File "/path/to/gcc/contrib/testsuite-management/validate_failures.py", line 148, in __init__ 05: 14:32 raise contrib/ChangeLog: * testsuite-management/validate_failures.py (IsInterestingResult): Add result_set argument and use it. Adjust callers. --- .../testsuite-management/validate_failures.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/contrib/testsuite-management/validate_failures.py b/contrib/testsuite-management/validate_failures.py index 4dfd9cda4e24..11bb6f7e9c7c 100755 --- a/contrib/testsuite-management/validate_failures.py +++ b/contrib/testsuite-management/validate_failures.py @@ -295,10 +295,20 @@ def SplitAttributesFromSummaryLine(line): return (attrs, line) -def IsInterestingResult(line): +def IsInterestingResult(result_set, line): """Return True if line is one of the summary lines we care about.""" (_, line) = SplitAttributesFromSummaryLine(line) - return bool(_VALID_TEST_RESULTS_REX.match(line)) + valid_result = bool(_VALID_TEST_RESULTS_REX.match(line)) + + # If there's no tool defined it means that either the results section hasn't + # started yet, or it is already over. + if valid_result and result_set.current_tool is None: + if _OPTIONS.verbosity >= 3: + print(f'WARNING: Result "{line}" found outside sum file boundaries.', + file=sys.stderr) + return False + + return valid_result def IsToolLine(line): @@ -354,7 +364,7 @@ def ParseManifestWorker(result_set, manifest_path): result_set.remove(result_set.MakeTestResult(GetNegativeResult(line))) elif IsInclude(line): ParseManifestWorker(result_set, GetIncludeFile(line, manifest_path)) - elif IsInterestingResult(line): + elif IsInterestingResult(result_set, line): result = result_set.MakeTestResult(line) if result.HasExpired(): # Ignore expired manifest entries. @@ -391,7 +401,7 @@ def ParseSummary(sum_fname): ordinal=0 sum_file = open(sum_fname, encoding='latin-1', mode='r') for line in sum_file: - if IsInterestingResult(line): + if IsInterestingResult(result_set, line): result = result_set.MakeTestResult(line, ordinal) ordinal += 1 if result.HasExpired():