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

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

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
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/40475
Tested-by: kokoro <noreply+kok...@google.com>
Reviewed-by: Gabe Black <gabe.bl...@gmail.com>
Maintainer: Earl Ou <shunhsin...@google.com>
---
M src/arch/arm/fastmodel/SConscript
1 file changed, 20 insertions(+), 7 deletions(-)

Approvals:
  Gabe Black: Looks good to me, approved
  Earl Ou: Looks good to me, approved
  kokoro: Regressions pass



diff --git a/src/arch/arm/fastmodel/SConscript b/src/arch/arm/fastmodel/SConscript
index 21b3d3c..c659434 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 shlex

 Import('*')

@@ -306,16 +307,18 @@
         self.libs = static_lib_nodes + shared_libs
         self.libpaths = [simgen_dir]
         self.rpaths = [simgen_dir]
+        self.log = gen_dir.File('build_%s.log' % tlc)
+ self.simgen_cmd = env.subst('${SIMGEN} -p %s --configuration %s -b ' +
+            '--verbose off --num-build-cpus 100 --build-dir %s >%s') % \
+            (shlex.quote(project_file.srcnode().abspath),
+             shlex.quote(config_name),
+             shlex.quote(simgen_dir.abspath),
+             shlex.quote(self.log.abspath))

-        simgen_cmd = env.subst('${SIMGEN} -p %s --configuration %s -b ' +
-            '--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'
-        simgen_action = MakeAction(simgen_cmd, Transform('SIMGEN'))
         sources = [project_file]
         sources.extend(extra_deps)
-        env.Command(lib_nodes + self.headers, sources, simgen_action)
+        env.Command(lib_nodes + self.headers + [self.log], sources,
+                    Action(self.simgen_builder, Transform('SIMGEN')))
# Distribute simgen actions among ARM license slots. All actions which # have a given license as a "side effect" will be serialized relative # to each other, meaning the number of licenses being used concurrently
@@ -331,6 +334,16 @@
         env.Append(CPPPATH=self.headerpaths)
         env.Prepend(LIBS=self.libs)

+    def simgen_builder(self, target, source, env):
+        cmd = self.simgen_cmd
+        if not GetOption('verbose'):
+            cmd = "@" + cmd
+        res = env.Execute(cmd)
+        # Print output when execution return non-zero or in verbose mode.
+        if res or GetOption('verbose'):
+            env.Execute('@cat %s' % self.log.abspath)
+        return res
+

 class ArmFastModelBin(Executable):
     def __init__(self, target, *components_and_sources):

--
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: 5
Gerrit-Owner: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Earl Ou <shunhsin...@google.com>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Gabe Black <gabebl...@google.com>
Gerrit-Reviewer: Yu-hsin Wang <yuhsi...@google.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
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