From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-98276e2a4bbso95249066b.0 for ; Fri, 16 Jun 2023 05:04:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686917097; x=1689509097; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=3ccJ++bL7KVTlOdQVLwZ69Ga+7mZTC4g2h/tBsaHj0Y=; b=joHpe8nmhhwCE+bEfVd6lt4pLuAph0oA3mEi3mymo2WJfQVC9NhgnmpOaGwL/sEBuS ErvjICYZe8WFAHdnGVALdjbKLP4W8mLED1sy+S03p0pujlKw7xjkY78ptosWYdvEcK4M j1gO6opjPft7UUpsHR1XA36eWHMj4K21cuZkM0S16WkblTsh7oSecccZNuOwUoJcqTH9 Zk91WUWA5IJZyWEqhAz8yitg6dBCI2/WcUo2uy+NiILf41OBWds/nDLRzu4tgREwPDx0 +oV0kmT3Rb97psr6AYZCXx+z73j/JjZK+JeWVSS9Pxt20mYr6JIUJ+gVdyGqo87CZBz/ Ay/w== 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-Google-Smtp-Source: ACHHUZ7KK4pbysZw9egr0suE4Kw7AbMdd8ZA/uQmyhG1eYq5sICufDRIl53WAh0yJWmTmu8vpOi4OQ== 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) From: Thiago Jung Bauermann 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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():