Adding ability to log output when starting xmlrpc server.
The ability to see the output when xmlrpc servers are started was
broken recently and if the command errors out, there is no debugging
information that we can see.
BUG=chromium:320184
TEST=Manually ran against DUT at desk
Change-Id: I20a98927b0866a7e2a724941ee7988d177007c39
Reviewed-on: https://chromium-review.googlesource.com/177281
Reviewed-by: Christopher Wiley <wiley@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Yusuf Mohsinally <mohsinally@chromium.org>
Tested-by: Yusuf Mohsinally <mohsinally@chromium.org>
diff --git a/server/cros/faft/rpc_proxy.py b/server/cros/faft/rpc_proxy.py
index f7d8353..d5c9925 100644
--- a/server/cros/faft/rpc_proxy.py
+++ b/server/cros/faft/rpc_proxy.py
@@ -84,7 +84,8 @@
self._client_config.rpc_port,
command_name=self._client_config.rpc_command_short,
ready_test_name=self._client_config.rpc_ready_call,
- timeout_seconds=self._client_config.rpc_timeout)
+ timeout_seconds=self._client_config.rpc_timeout,
+ logfile=self._client_config.rpc_logfile)
def disconnect(self):
"""Disconnect the RPC server."""
diff --git a/server/hosts/cros_host.py b/server/hosts/cros_host.py
index d55ff71..12d0589 100644
--- a/server/hosts/cros_host.py
+++ b/server/hosts/cros_host.py
@@ -1228,7 +1228,8 @@
def xmlrpc_connect(self, command, port, command_name=None,
- ready_test_name=None, timeout_seconds=10):
+ ready_test_name=None, timeout_seconds=10,
+ logfile='/dev/null'):
"""Connect to an XMLRPC server on the host.
The `command` argument should be a simple shell command that
@@ -1266,7 +1267,8 @@
@param timeout_seconds Number of seconds to wait
for the server to become 'ready.' Will throw a
TestFail error if server is not ready in time.
-
+ @param logfile Logfile to send output when running
+ 'command' argument.
"""
# Clean up any existing state. If the caller is willing
# to believe their server is down, we ought to clean up
@@ -1276,7 +1278,7 @@
# below is necessary, because 'ssh' won't terminate until
# background child processes close stdin, stdout, and
# stderr.
- remote_cmd = '%s </dev/null >/dev/null 2>&1 & echo $!' % command
+ remote_cmd = '%s </dev/null >%s 2>&1 & echo $!' % (command, logfile)
remote_pid = self.run(remote_cmd).stdout.rstrip('\n')
logging.debug('Started XMLRPC server on host %s, pid = %s',
self.hostname, remote_pid)