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
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
-50000
|
||||
|
||||
@@ -1,6 +1,2 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
-776.000061
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
--- Done DRAM low power sweep ---
|
||||
Fixed params -
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
**** REAL SIMULATION ****
|
||||
Hello world!
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
**** REAL SIMULATION ****
|
||||
Begining test of difficult SPARC instructions...
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
Beginning simulation!
|
||||
Hello world!
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
Beginning simulation!
|
||||
Exiting @ tick 10944163 because Goodbye hello!! Goodbye hello!! Goodbye hello!! Goodbye hello!! Goodbye hello!! Goodbye hello!! Goo
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
Hello World! From a SimObject!
|
||||
Beginning simulation!
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000 ticks per second
|
||||
Beginning simulation!
|
||||
Exiting @ tick 9981 because Ruby Tester completed
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
Beginning simulation!
|
||||
Running on 2 cores. with 100 values
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
gem5 Simulator System. http://gem5.org
|
||||
gem5 is copyrighted software; use the --copyright option for details.
|
||||
|
||||
|
||||
Global frequency set at 1000000000000 ticks per second
|
||||
Init done
|
||||
[Iteration 1, Thread 1] Got lock
|
||||
|
||||
@@ -115,6 +115,9 @@ class DerivedGoldStandard(MatchGoldStandard):
|
||||
class MatchStdout(DerivedGoldStandard):
|
||||
_file = constants.gem5_simulation_stdout
|
||||
_default_ignore_regex = [
|
||||
re.compile('^\s+$'), # Remove blank lines.
|
||||
re.compile('^gem5 Simulator System'),
|
||||
re.compile('^gem5 is copyrighted software'),
|
||||
re.compile('^Redirecting (stdout|stderr) to'),
|
||||
re.compile('^gem5 version '),
|
||||
re.compile('^gem5 compiled '),
|
||||
|
||||
Reference in New Issue
Block a user