X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=debug%2Ftestlib.py;h=3339e9b49a88afaf22538f7029ce5e87c48577aa;hb=78991b2a1d8e48b7280101d3a69128ff24dc4305;hp=53e670ec51c006fa96cbb0ea2f201e5f77fb7f7c;hpb=440f54715a4a4335a371c61bc79079ead8c3c6fe;p=riscv-tests.git diff --git a/debug/testlib.py b/debug/testlib.py index 53e670e..3339e9b 100644 --- a/debug/testlib.py +++ b/debug/testlib.py @@ -79,7 +79,7 @@ class Spike(object): return self.process.wait(*args, **kwargs) class Openocd(object): - def __init__(self, cmd=None, config=None, debug=True): + def __init__(self, cmd=None, config=None, debug=False): if cmd: cmd = shlex.split(cmd) else: @@ -89,6 +89,7 @@ class Openocd(object): if debug: cmd.append("-d") logfile = open("openocd.log", "w") + logfile.write("+ %s\n" % " ".join(cmd)) self.process = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=logfile, stderr=logfile) # TODO: Pick a random port @@ -102,10 +103,11 @@ class Openocd(object): pass class Gdb(object): - def __init__(self): - path = os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gdb") + def __init__(self, + path=os.path.expandvars("$RISCV/bin/riscv64-unknown-elf-gdb")): self.child = pexpect.spawn(path) self.child.logfile = file("gdb.log", "w") + self.child.logfile.write("+ %s\n" % path) self.wait() self.command("set confirm off") self.command("set width 0") @@ -153,7 +155,7 @@ class Gdb(object): return output def load(self): - output = self.command("load") + output = self.command("load", timeout=60) assert "failed" not in output assert "Transfer rate" in output