Earl Ou has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/40475 )

Change subject: scons,fastmodel: print stdout when build command fail
......................................................................

scons,fastmodel: print stdout when build command fail

Originally we only print command stdout in verbose build. This leads
to misleading debug message when there is error happen in a non-verbose
build. This CL prints stdout when the step fails.

Change-Id: I8c34ac5576269177ae70fc5e01650193fd252b0b
---
M src/arch/arm/fastmodel/SConscript
1 file changed, 9 insertions(+), 1 deletion(-)



diff --git a/src/arch/arm/fastmodel/SConscript b/src/arch/arm/fastmodel/SConscript
index 21b3d3c..5cde27f 100644
--- a/src/arch/arm/fastmodel/SConscript
+++ b/src/arch/arm/fastmodel/SConscript
@@ -36,6 +36,7 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

 from itertools import cycle
+import tempfile

 Import('*')

@@ -311,7 +312,14 @@
             '--verbose off --num-build-cpus 100 --build-dir %s') % \
(project_file.srcnode().abspath, config_name, simgen_dir.abspath)
         if not GetOption('verbose'):
-            simgen_cmd += ' > /dev/null'
+            with tempfile.NamedTemporaryFile() as f:
+ # Run the build cmd, and only print stdout when there is build
+                # failure. We need to manually remove the tempfile because
+                # the actual command is run after this 'with' block exit.
+                simgen_cmd = (
+ '({cmd} >{log}) || (cat {log}; rm -f {log}; exit 1)'.format(
+                    cmd=simgen_cmd,
+                    log=f.name))
         simgen_action = MakeAction(simgen_cmd, Transform('SIMGEN'))
         sources = [project_file]
         sources.extend(extra_deps)

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/40475
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: I8c34ac5576269177ae70fc5e01650193fd252b0b
Gerrit-Change-Number: 40475
Gerrit-PatchSet: 1
Gerrit-Owner: Earl Ou <shunhsin...@google.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to