From 79b3a4f57f269f6243177a1bf0073646fef61413 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Sun, 24 Sep 2023 23:40:33 -0600 Subject: sim: fix silent fopen() fail --- sim/gdbstub.py | 5 ++++- sim/sim.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'sim') diff --git a/sim/gdbstub.py b/sim/gdbstub.py index ccddab9..e7791bc 100644 --- a/sim/gdbstub.py +++ b/sim/gdbstub.py @@ -23,7 +23,10 @@ def fatal(): def do_output(text): if text is None: return not is_halted() - elif not client: + + print(text, file=sys.stderr, end='') + + if not client: return False reply(b'O' + hexout(text.encode('ascii'))) diff --git a/sim/sim.py b/sim/sim.py index b45ca7e..5f64d43 100755 --- a/sim/sim.py +++ b/sim/sim.py @@ -222,6 +222,7 @@ def exit(*, success): f'{color}Test \'{COLOR_YELLOW}{test_name}{COLOR_RESET}{color}\' ' + f'{status}{COLOR_RESET}') + flush_out() sys.exit(0 if success else 1) def dump_regs(): @@ -393,7 +394,7 @@ exec_args.append(f'+verilator+seed+{seed}') if not os.getenv('SIM_PULLX', 0): exec_args.append('+verilator+rand+reset+2') -process = subprocess.Popen(exec_args, pass_fds=(target_fd,)) +process = subprocess.Popen(exec_args, pass_fds=(target_fd,), stderr=subprocess.PIPE) target_end.close() in_regs = False @@ -462,6 +463,7 @@ while not done: process.wait(timeout=1) if process.returncode != 0: + out(f'{COLOR_RED}{verilated} exited with status {process.returncode}{COLOR_RESET}') exit(success=False) if final := module_get('final'): -- cgit v1.2.3