public inbox for bunsen@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] When importing results from a full GDB test run, bunsen will throw a TypeError:
@ 2021-08-05 19:03 Keith Seitz
  2021-08-05 19:39 ` Serhei Makarov
  0 siblings, 1 reply; 3+ messages in thread
From: Keith Seitz @ 2021-08-05 19:03 UTC (permalink / raw)
  To: bunsen

$ ./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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-05 19:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 19:03 [PATCH] When importing results from a full GDB test run, bunsen will throw a TypeError: Keith Seitz
2021-08-05 19:39 ` Serhei Makarov
2021-08-05 19:45   ` Keith Seitz

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).