public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
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	[thread overview]
Message-ID: <20210805190333.11594-1-keiths@redhat.com> (raw)

$ ./bunsen-add.py <!-- arguments -->
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 <module>
    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


             reply	other threads:[~2021-08-05 19:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05 19:03 Keith Seitz [this message]
2021-08-05 19:39 ` Serhei Makarov
2021-08-05 19:45   ` Keith Seitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210805190333.11594-1-keiths@redhat.com \
    --to=keiths@redhat.com \
    --cc=bunsen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).