gem5: exit with error status on simulate() limit reached

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2019-07-13 00:00:02 +00:00
parent 99180e6616
commit 89bb810768

12
run
View File

@@ -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 ---$') gem5_panic_re = re.compile(b'--- BEGIN LIBC BACKTRACE ---$')
line = None line = None
for line in logfile: for line in logfile:
line = line.rstrip()
if gem5_panic_re.search(line): if gem5_panic_re.search(line):
exit_status = 1 exit_status = 1
if self.env['userland']: last_line = line
if line is not None: if last_line is not None:
last_line = line.rstrip() if self.env['userland']:
match = re.search(b'Simulated exit code not 0! Exit code is (\d+)', last_line) 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)) 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 not self.env['userland']:
if os.path.exists(self.env['guest_terminal_file']): if os.path.exists(self.env['guest_terminal_file']):
with open(self.env['guest_terminal_file'], 'br') as logfile: with open(self.env['guest_terminal_file'], 'br') as logfile: