[gem5-dev] Change in gem5/gem5[develop]: scons: Add a mechanism to accumulate warnings to reprint at the end.

2020-03-27 Thread Gabe Black (Gerrit)
Gabe Black has submitted this change. (  
https://gem5-review.googlesource.com/c/public/gem5/+/27129 )


Change subject: scons: Add a mechanism to accumulate warnings to reprint at  
the end.

..

scons: Add a mechanism to accumulate warnings to reprint at the end.

When building gem5, it's possible for warnings printed early in the
build to be quickly wisked away in a see of compile lines, never to be
seen again (or driven off the end of the scrollback buffer).

To avoid those messages getting lost or ignored, this change adds a
mechanism to aggregate them into a list so that they can be summarized
at the end of the build, successful or not.

Change-Id: Ie13320717698fcbcd3a8f8d1c062467e8d6d2914
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/27129
Tested-by: Gem5 Cloud Project GCB service account  
<345032938...@cloudbuild.gserviceaccount.com>

Tested-by: kokoro 
Reviewed-by: Bobby R. Bruce 
Maintainer: Gabe Black 
---
M site_scons/gem5_scons/__init__.py
1 file changed, 16 insertions(+), 3 deletions(-)

Approvals:
  Bobby R. Bruce: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass
  Gem5 Cloud Project GCB service account: Regressions pass



diff --git a/site_scons/gem5_scons/__init__.py  
b/site_scons/gem5_scons/__init__.py

index e7e7a0a..169e0fe 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -169,12 +169,25 @@
 # Finally add the prefix and padding on extra lines, and glue it all  
back

 # together.
 message = prefix + ('\n' + padding).join(wrapped_lines)
-# Print the message in bold in the requested color.
-print(color + termcap.Bold + message + termcap.Normal, **kwargs)
+# Add in terminal escape sequences.
+message = color + termcap.Bold + message + termcap.Normal
+# Actually print the message.
+print(message, **kwargs)
+return message
+
+all_warnings = []
+def summarize_warnings():
+if not all_warnings:
+return
+print(termcap.Yellow + termcap.Bold +
+'*** Summary of Warnings ***' +
+termcap.Normal)
+list(map(print, all_warnings))

 def warning(*args, **kwargs):
 message = ' '.join(args)
-print_message('Warning: ', termcap.Yellow, message, **kwargs)
+printed = print_message('Warning: ', termcap.Yellow, message, **kwargs)
+all_warnings.append(printed)

 def error(*args, **kwargs):
 message = ' '.join(args)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27129
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: Ie13320717698fcbcd3a8f8d1c062467e8d6d2914
Gerrit-Change-Number: 27129
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Bobby R. Bruce 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-Reviewer: Gem5 Cloud Project GCB service account  
<345032938...@cloudbuild.gserviceaccount.com>

Gerrit-Reviewer: Jason Lowe-Power 
Gerrit-Reviewer: kokoro 
Gerrit-CC: Earl Ou 
Gerrit-CC: Jui-min Lee 
Gerrit-CC: Yu-hsin Wang 
Gerrit-MessageType: merged
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in gem5/gem5[develop]: scons: Add a mechanism to accumulate warnings to reprint at the end.

2020-03-26 Thread Gabe Black (Gerrit)

Hello Gabe Black,

I'd like you to do a code review. Please visit

https://gem5-review.googlesource.com/c/public/gem5/+/27129

to review the following change.


Change subject: scons: Add a mechanism to accumulate warnings to reprint at  
the end.

..

scons: Add a mechanism to accumulate warnings to reprint at the end.

When building gem5, it's possible for warnings printed early in the
build to be quickly wisked away in a see of compile lines, never to be
seen again (or driven off the end of the scrollback buffer).

To avoid those messages getting lost or ignored, this change adds a
mechanism to aggregate them into a list so that they can be summarized
at the end of the build, successful or not.

Change-Id: Ie13320717698fcbcd3a8f8d1c062467e8d6d2914
---
M site_scons/gem5_scons/__init__.py
1 file changed, 16 insertions(+), 3 deletions(-)



diff --git a/site_scons/gem5_scons/__init__.py  
b/site_scons/gem5_scons/__init__.py

index e7e7a0a..169e0fe 100644
--- a/site_scons/gem5_scons/__init__.py
+++ b/site_scons/gem5_scons/__init__.py
@@ -169,12 +169,25 @@
 # Finally add the prefix and padding on extra lines, and glue it all  
back

 # together.
 message = prefix + ('\n' + padding).join(wrapped_lines)
-# Print the message in bold in the requested color.
-print(color + termcap.Bold + message + termcap.Normal, **kwargs)
+# Add in terminal escape sequences.
+message = color + termcap.Bold + message + termcap.Normal
+# Actually print the message.
+print(message, **kwargs)
+return message
+
+all_warnings = []
+def summarize_warnings():
+if not all_warnings:
+return
+print(termcap.Yellow + termcap.Bold +
+'*** Summary of Warnings ***' +
+termcap.Normal)
+list(map(print, all_warnings))

 def warning(*args, **kwargs):
 message = ' '.join(args)
-print_message('Warning: ', termcap.Yellow, message, **kwargs)
+printed = print_message('Warning: ', termcap.Yellow, message, **kwargs)
+all_warnings.append(printed)

 def error(*args, **kwargs):
 message = ' '.join(args)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/27129
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: Ie13320717698fcbcd3a8f8d1c062467e8d6d2914
Gerrit-Change-Number: 27129
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black 
Gerrit-Reviewer: Gabe Black 
Gerrit-MessageType: newchange
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev