python: Flush the simulation stdout/stderr buffers
Occasionally gem5's stdout/stderr, when run within the TestLib framework, will be shuffled. This is resolved by flushing the stdout/stderr buffer before and after simulation. In addition to this, the verifier.py has been improved to remove boilerplate gem5 code from the stdout comparison. Change-Id: I04c8f9cee4475b8eab2f1ba9bb76bfa3cfcca6ec Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/34995 Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -175,7 +175,15 @@ def simulate(*args, **kwargs):
|
||||
if _drain_manager.isDrained():
|
||||
_drain_manager.resume()
|
||||
|
||||
return _m5.event.simulate(*args, **kwargs)
|
||||
# We flush stdout and stderr before and after the simulation to ensure the
|
||||
# output arrive in order.
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
sim_out = _m5.event.simulate(*args, **kwargs)
|
||||
sys.stdout.flush()
|
||||
sys.stderr.flush()
|
||||
|
||||
return sim_out
|
||||
|
||||
def drain():
|
||||
"""Drain the simulator in preparation of a checkpoint or memory mode
|
||||
|
||||
Reference in New Issue
Block a user