tests: Always print stderr in gem5 Fixtures
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 16 Dec 2019 14:14:13 +0000 (14:14 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Mon, 23 Dec 2019 08:52:59 +0000 (08:52 +0000)
At the moment is impossible when observing an upstream kokoro failure
to understand what went wrong.
This is because the only thing that gets printed is the exception
traceback and the command line generating it.

Most of the time it will be something like

Traceback (most recent call last):
  File
"/tmpfs/src/git/jenkins-gem5-prod/tests/../ext/testlib/runner.py", line
195, in setup
    fixture.setup(testitem)
  File "/tmpfs/src/git/jenkins-gem5-prod/tests/gem5/fixture.py", line
115, in setup
    self._setup(testitem)
  File "/tmpfs/src/git/jenkins-gem5-prod/tests/gem5/fixture.py", line
160, in _setup
    log_call(log.test_log, command)
  File
"/tmpfs/src/git/jenkins-gem5-prod/tests/../ext/testlib/helper.py", line
103, in log_call
    raise subprocess.CalledProcessError(retval, cmdstr)

With this patch we dump the stderr so that the fail reason is exposed
to the viewer.

Change-Id: Ic3d0fe75ec4d0543d95e9624dc5287afb4af3b8b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/23843
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <jason@lowepower.com>

tests/gem5/fixture.py
tests/gem5/suite.py

index 21ea3d803e2651c7b1eb6cac5ef0caa583585c67..ddf43d17d3e2fa7595c7c7f47ec6bc610c2b0fd4 100644 (file)
@@ -42,6 +42,7 @@
 import os
 import tempfile
 import shutil
+import sys
 import threading
 import urllib
 import urllib2
@@ -157,7 +158,7 @@ class SConsFixture(UniqueFixture):
         command.extend(self.targets)
         if self.options:
             command.extend(self.options)
-        log_call(log.test_log, command)
+        log_call(log.test_log, command, stderr=sys.stderr)
 
 class Gem5Fixture(SConsFixture):
     def __new__(cls, isa, variant, protocol=None):
index 2db1668cd0dff52c61e62b11f88057b3dc46eb3b..8a8c76d53f782cede1375d2e27891f618ccf6e69 100644 (file)
@@ -29,6 +29,7 @@
 import os
 import copy
 import subprocess
+import sys
 
 from testlib.test import TestFunction
 from testlib.suite import TestSuite
@@ -161,6 +162,6 @@ def _create_test_run_gem5(config, config_args, gem5_args):
         command.append(config)
         # Config_args should set up the program args.
         command.extend(config_args)
-        returncode.value = log_call(params.log, command)
+        returncode.value = log_call(params.log, command, stderr=sys.stderr)
 
     return test_run_gem5