Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/50588 )

Change subject: python: Add a --silent-redirect option to gem5.
......................................................................

python: Add a --silent-redirect option to gem5.

This complements the --redirect-stdout and --redirect-stderr options and
supresses the message about where those streams are being redirected
which print to the original stdout.

Usually this is very helpful since it lets you know where to look for
simulator output. If you're running gem5 in an automated environment
like our testing framework however, the file name is a random temp file
which will be deleted as soon as the test is finished running.

The --silent-redirect option can be used in these particular scenarios
to, for example, avoid lots and lots of useless lines in the test output
naming files that no longer exist.

Change-Id: If56b61567b3d98abd9cc9d9e9d661ea561be46f8
---
M src/python/m5/main.py
1 file changed, 11 insertions(+), 8 deletions(-)



diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 92878af..f3be50f 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -87,6 +87,8 @@
         help="Redirect stdout (& stderr, without -e) to file")
     option('-e', "--redirect-stderr", action="store_true", default=False,
         help="Redirect stderr to file")
+    option("--silent-redirect", action="store_true", default=False,
+ help="Suppress printing a message when redirecting stdout or stderr")
     option("--stdout-file", metavar="FILE", default="simout",
         help="Filename for -r redirection [Default: %default]")
     option("--stderr-file", metavar="FILE", default="simerr",
@@ -247,14 +249,15 @@
     stdout_file = os.path.join(options.outdir, options.stdout_file)
     stderr_file = os.path.join(options.outdir, options.stderr_file)

-    # Print redirection notices here before doing any redirection
-    if options.redirect_stdout and not options.redirect_stderr:
-        print("Redirecting stdout and stderr to", stdout_file)
-    else:
-        if options.redirect_stdout:
-            print("Redirecting stdout to", stdout_file)
-        if options.redirect_stderr:
-            print("Redirecting stderr to", stderr_file)
+    if not options.silent_redirect:
+        # Print redirection notices here before doing any redirection
+        if options.redirect_stdout and not options.redirect_stderr:
+            print("Redirecting stdout and stderr to", stdout_file)
+        else:
+            if options.redirect_stdout:
+                print("Redirecting stdout to", stdout_file)
+            if options.redirect_stderr:
+                print("Redirecting stderr to", stderr_file)

     # Now redirect stdout/stderr as desired
     if options.redirect_stdout:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/50588
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: If56b61567b3d98abd9cc9d9e9d661ea561be46f8
Gerrit-Change-Number: 50588
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to