diff options
author | Tim Newsome <tim@sifive.com> | 2016-10-14 12:41:41 -0700 |
---|---|---|
committer | Tim Newsome <tim@sifive.com> | 2016-10-14 12:41:41 -0700 |
commit | f59770c98f8f3a7762e8a1751cca922ba8afe870 (patch) | |
tree | ccd865da70a8b0fcc0b22a9e160eed9eb4ca7898 /debug | |
parent | 801ef9108dacda662435d193ca7477244475e531 (diff) | |
download | riscv-tests-f59770c98f8f3a7762e8a1751cca922ba8afe870.zip riscv-tests-f59770c98f8f3a7762e8a1751cca922ba8afe870.tar.gz riscv-tests-f59770c98f8f3a7762e8a1751cca922ba8afe870.tar.bz2 |
Wait for OpenOCD to start fully before connecting.
Requires OpenOCD change 4eba841bfee4b6c347423ac28851ab7ee7e75532
Diffstat (limited to 'debug')
-rw-r--r-- | debug/testlib.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/debug/testlib.py b/debug/testlib.py index 8b799e7..0da09a1 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -137,6 +137,21 @@ class Openocd(object): # TODO: Pick a random port self.port = 3333 + # Wait for OpenOCD to have made it through riscv_examine(). When using + # OpenOCD to communicate with a simulator this may take a long time, + # and gdb will time out when trying to connect if we attempt too early. + start = time.time() + messaged = False + while True: + log = open(Openocd.logname).read() + if "Examined RISCV core" in log: + break + if not self.process.poll() is None: + raise Exception("OpenOCD exited before completing riscv_examine()") + if not messaged and time.time() - start > 1: + messaged = True + print "Waiting for OpenOCD to examine RISCV core..." + def __del__(self): try: self.process.kill() |