Bobby R. Bruce has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/34995 )
Change subject: python: Flush the simulation stdout/stderr buffers
......................................................................
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 <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/m5/simulate.py
M tests/gem5/cpu_tests/ref/Bubblesort
M tests/gem5/cpu_tests/ref/FloatMM
M tests/gem5/dram-lowp/ref/simout
M tests/gem5/hello_se/ref/simout
M tests/gem5/insttest_se/ref/sparc/linux/insttest/simout
M tests/gem5/learning_gem5/ref/hello
M tests/gem5/learning_gem5/ref/hello_goodbye
M tests/gem5/learning_gem5/ref/simple
M tests/gem5/learning_gem5/ref/test
M tests/gem5/learning_gem5/ref/threads
M tests/gem5/m5threads_test_atomic/ref/sparc64/simout
M tests/gem5/verifier.py
13 files changed, 12 insertions(+), 45 deletions(-)
Approvals:
Jason Lowe-Power: Looks good to me, approved; Looks good to me, approved
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py
index 698dfbc..080d725 100644
--- a/src/python/m5/simulate.py
+++ b/src/python/m5/simulate.py
@@ -175,7 +175,15 @@
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
diff --git a/tests/gem5/cpu_tests/ref/Bubblesort
b/tests/gem5/cpu_tests/ref/Bubblesort
index 79d2ae3..76f4de0 100644
--- a/tests/gem5/cpu_tests/ref/Bubblesort
+++ b/tests/gem5/cpu_tests/ref/Bubblesort
@@ -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
diff --git a/tests/gem5/cpu_tests/ref/FloatMM
b/tests/gem5/cpu_tests/ref/FloatMM
index 6539627..0f1d582 100644
--- a/tests/gem5/cpu_tests/ref/FloatMM
+++ b/tests/gem5/cpu_tests/ref/FloatMM
@@ -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
diff --git a/tests/gem5/dram-lowp/ref/simout
b/tests/gem5/dram-lowp/ref/simout
index 5128ab4..6fdcf85 100644
--- a/tests/gem5/dram-lowp/ref/simout
+++ b/tests/gem5/dram-lowp/ref/simout
@@ -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 -
diff --git a/tests/gem5/hello_se/ref/simout b/tests/gem5/hello_se/ref/simout
index a38e288..9e8cf27 100644
--- a/tests/gem5/hello_se/ref/simout
+++ b/tests/gem5/hello_se/ref/simout
@@ -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!
diff --git a/tests/gem5/insttest_se/ref/sparc/linux/insttest/simout
b/tests/gem5/insttest_se/ref/sparc/linux/insttest/simout
index 4665746..81a0b92 100644
--- a/tests/gem5/insttest_se/ref/sparc/linux/insttest/simout
+++ b/tests/gem5/insttest_se/ref/sparc/linux/insttest/simout
@@ -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...
diff --git a/tests/gem5/learning_gem5/ref/hello
b/tests/gem5/learning_gem5/ref/hello
index 0f0a7d6..bcdd7b9 100644
--- a/tests/gem5/learning_gem5/ref/hello
+++ b/tests/gem5/learning_gem5/ref/hello
@@ -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!
diff --git a/tests/gem5/learning_gem5/ref/hello_goodbye
b/tests/gem5/learning_gem5/ref/hello_goodbye
index 8e80377..cdaace8 100644
--- a/tests/gem5/learning_gem5/ref/hello_goodbye
+++ b/tests/gem5/learning_gem5/ref/hello_goodbye
@@ -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
diff --git a/tests/gem5/learning_gem5/ref/simple
b/tests/gem5/learning_gem5/ref/simple
index b4c614a..71a3d62 100644
--- a/tests/gem5/learning_gem5/ref/simple
+++ b/tests/gem5/learning_gem5/ref/simple
@@ -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!
diff --git a/tests/gem5/learning_gem5/ref/test
b/tests/gem5/learning_gem5/ref/test
index 794ccdd..309ac2f 100644
--- a/tests/gem5/learning_gem5/ref/test
+++ b/tests/gem5/learning_gem5/ref/test
@@ -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
diff --git a/tests/gem5/learning_gem5/ref/threads
b/tests/gem5/learning_gem5/ref/threads
index 18a47fd..841ad73 100644
--- a/tests/gem5/learning_gem5/ref/threads
+++ b/tests/gem5/learning_gem5/ref/threads
@@ -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
diff --git a/tests/gem5/m5threads_test_atomic/ref/sparc64/simout
b/tests/gem5/m5threads_test_atomic/ref/sparc64/simout
index c6b51ca..dbe1405 100644
--- a/tests/gem5/m5threads_test_atomic/ref/sparc64/simout
+++ b/tests/gem5/m5threads_test_atomic/ref/sparc64/simout
@@ -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
diff --git a/tests/gem5/verifier.py b/tests/gem5/verifier.py
index ba4bd4f..60d44f3 100644
--- a/tests/gem5/verifier.py
+++ b/tests/gem5/verifier.py
@@ -115,6 +115,9 @@
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 '),
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/34995
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: release-staging-v20.1.0.0
Gerrit-Change-Id: I04c8f9cee4475b8eab2f1ba9bb76bfa3cfcca6ec
Gerrit-Change-Number: 34995
Gerrit-PatchSet: 3
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Gabe Black <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s