Skip to content

Commit a1b2559

Browse files
committed
Put coverage report production code in a script file
Recently, GDB has started printing one ">" prompt per line in the "python" command. For instance, when the input is: python pass pass pass end GDB prints: >>>(gdb) [plus a trailing space, i.e. the main prompt] Since this breaks the current regexp that matches GDB prompts ("^(gdb) ", so the pexpect machinery hangs), switch to using a script file instead to workaround this problem. TN: U622-042 Change-Id: I0e6d6cc23a6b8ed350c1bc695bbd79913a8adecf
1 parent 261f784 commit a1b2559

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

testsuite/run.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,29 @@ def tear_down(self) -> None:
6262
load_gnatdbg=False
6363
)
6464
gdb.import_coverage()
65-
gdb.execute("python import glob")
6665

6766
# Consolidate coverage data for each testcase and generate both a
6867
# sumary textual report on the standard output and a detailed HTML
6968
# report.
70-
gdb.execute("""python
69+
script = os.path.join(self.working_dir, "coverage_script.py")
70+
with open(script, "w") as f:
71+
f.write("""
72+
import glob
73+
7174
c = coverage.Coverage(data_file={data_file!r}, config_file={config_file!r})
7275
c.combine(glob.glob({data_files_glob!r}))
7376
c.html_report(directory={coverage_dir!r}, title="gnatdbg coverage report")
7477
end""".format(
75-
data_file=os.path.join(ts_config.coverage_dir, ".coverage"),
76-
data_files_glob=os.path.join(
77-
ts_config.coverage_dir, "*.coverage"
78-
),
79-
config_file=ts_config.coverage_rcfile,
80-
coverage_dir=ts_config.coverage_dir
81-
))
78+
data_file=os.path.join(
79+
ts_config.coverage_dir, ".coverage"
80+
),
81+
data_files_glob=os.path.join(
82+
ts_config.coverage_dir, "*.coverage"
83+
),
84+
config_file=ts_config.coverage_rcfile,
85+
coverage_dir=ts_config.coverage_dir
86+
))
87+
gdb.execute(f"source {script}")
8288

8389
html_index = os.path.join(ts_config.coverage_dir, "index.html")
8490
assert os.path.exists(html_index)

0 commit comments

Comments
 (0)