Merge change 856 into donut
* changes: Modified the command to run native test on the host: - when valgrind is used, the output is discarded, always. - otherwise, the output of the test is printed only when the test failed.
This commit is contained in:
@@ -120,8 +120,11 @@ def RunOnce(cmd, timeout_time=None, return_output=True):
|
|||||||
def RunHostCommand(binary, valgrind=False):
|
def RunHostCommand(binary, valgrind=False):
|
||||||
"""Run a command on the host (opt using valgrind).
|
"""Run a command on the host (opt using valgrind).
|
||||||
|
|
||||||
Runs the host binary. Does not capture any output but it
|
Runs the host binary and returns the exit code.
|
||||||
returns the exit code. The command can be run under valgrind.
|
If successfull, the output (stdout and stderr) are discarded,
|
||||||
|
but printed in case of error.
|
||||||
|
The command can be run under valgrind in which case all the
|
||||||
|
output are always discarded.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
binary: basename of the file to be run. It is expected to be under
|
binary: basename of the file to be run. It is expected to be under
|
||||||
@@ -133,6 +136,14 @@ def RunHostCommand(binary, valgrind=False):
|
|||||||
"""
|
"""
|
||||||
full_path = os.path.join("out", "host", "linux-x86", "bin", binary)
|
full_path = os.path.join("out", "host", "linux-x86", "bin", binary)
|
||||||
if not valgrind:
|
if not valgrind:
|
||||||
return subprocess.call(full_path)
|
subproc = subprocess.Popen(full_path, stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT)
|
||||||
|
subproc.wait()
|
||||||
|
if subproc.returncode != 0: # In case of error print the output
|
||||||
|
print subproc.communicate()[0]
|
||||||
|
return subproc.returncode
|
||||||
else:
|
else:
|
||||||
return subprocess.call(["/usr/bin/valgrind", "-q", full_path])
|
subproc = subprocess.Popen(["/usr/bin/valgrind", "-q", full_path],
|
||||||
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
subproc.wait()
|
||||||
|
return subproc.returncode
|
||||||
|
|||||||
Reference in New Issue
Block a user