From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by sourceware.org (Postfix) with ESMTP id 7268D385842B for ; Thu, 5 Aug 2021 19:03:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7268D385842B Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-579-v49N_tdIPXqN-MX799aMGA-1; Thu, 05 Aug 2021 15:03:36 -0400 X-MC-Unique: v49N_tdIPXqN-MX799aMGA-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AA8B81006C80 for ; Thu, 5 Aug 2021 19:03:34 +0000 (UTC) Received: from guittard.uglyboxes.com (ovpn-115-36.phx2.redhat.com [10.3.115.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65ABF100164C for ; Thu, 5 Aug 2021 19:03:34 +0000 (UTC) From: Keith Seitz To: bunsen@sourceware.org Subject: [PATCH] When importing results from a full GDB test run, bunsen will throw a TypeError: Date: Thu, 5 Aug 2021 12:03:33 -0700 Message-Id: <20210805190333.11594-1-keiths@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" X-Spam-Status: No, score=-13.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: bunsen@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bunsen mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Aug 2021 19:03:39 -0000 $ ./bunsen-add.py bunsen-upload received a payload: * gdb.log.xz (1177912 bytes, file) * gdb.sum.xz (287264 bytes, file) * README.txt (96 bytes, file) will decompress /tmp/tmp72zejz8o/gdb.log.xz will decompress /tmp/tmp72zejz8o/gdb.sum.xz Traceback (most recent call last): File "/home/keiths/work/bunsen/virgin/bunsen/./bunsen-add.py", line 80, in commit_id = _commit_logs.commit_logs(b, wd, tar, tarfile=tar, File "/home/keiths/work/bunsen/virgin/bunsen/scripts-main/gdb/commit_logs.py", line 224, in commit_logs testrun = annotate_dejagnu_log(testrun, gdb_log, all_cases, verbose=False) File "/home/keiths/work/bunsen/virgin/bunsen/scripts-main/gdb/parse_dejagnu.py", line 221, in annotate_dejagnu_log outcome, expname, subtest = get_expname_subtest(outcome_lines[j]) TypeError: cannot unpack non-iterable NoneType object This happens in annotate_dejagnu_log, where the code attempts to map outcome lines: for j in range(len(outcome_lines)): outcome, expname, subtest = get_expname_subtest(outcome_lines[j]) if expname not in testcase_line_start: testcase_line_start[expname] = j The problem is that get_expname_subtest can return None whenever it encounters a line that doesn't fit the "OUTCOME: TESTFILE: TESTNAME" pattern. In log files, this happens all the time, e.g., "Running TESTFILE..." This patch simply checks the return result of get_expname_subtest, skipping any None result. --- scripts-main/gdb/parse_dejagnu.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts-main/gdb/parse_dejagnu.py b/scripts-main/gdb/parse_dejagnu.py index b56ed3c..1c4596a 100755 --- a/scripts-main/gdb/parse_dejagnu.py +++ b/scripts-main/gdb/parse_dejagnu.py @@ -218,7 +218,10 @@ def annotate_dejagnu_log(testrun, logfile, outcome_lines=[], # (1b) Build a map of outcome_lines: testcase_line_start = {} # .exp name -> index of first outcome_line with this name for j in range(len(outcome_lines)): - outcome, expname, subtest = get_expname_subtest(outcome_lines[j]) + result = get_expname_subtest(outcome_lines[j]) + if result is None: + continue + outcome, expname, subtest = result if expname not in testcase_line_start: testcase_line_start[expname] = j -- 2.31.1