From 89bb81076839217d89c392b90fda89871bd64812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciro=20Santilli=20=E5=85=AD=E5=9B=9B=E4=BA=8B=E4=BB=B6=20?= =?UTF-8?q?=E6=B3=95=E8=BD=AE=E5=8A=9F?= Date: Sat, 13 Jul 2019 00:00:02 +0000 Subject: [PATCH] gem5: exit with error status on simulate() limit reached --- run | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/run b/run index 26e5eb8..8b33987 100755 --- a/run +++ b/run @@ -784,14 +784,18 @@ Extra options to append at the end of the emulator command line. gem5_panic_re = re.compile(b'--- BEGIN LIBC BACKTRACE ---$') line = None for line in logfile: + line = line.rstrip() if gem5_panic_re.search(line): exit_status = 1 - if self.env['userland']: - if line is not None: - last_line = line.rstrip() + last_line = line + if last_line is not None: + if self.env['userland']: match = re.search(b'Simulated exit code not 0! Exit code is (\d+)', last_line) - if match: + if match is not None: exit_status = int(match.group(1)) + print(repr(last_line)) + if re.search(b'Exiting @ tick \d+ because simulate\(\) limit reached', last_line) is not None: + exit_status = 1 if not self.env['userland']: if os.path.exists(self.env['guest_terminal_file']): with open(self.env['guest_terminal_file'], 'br') as logfile: