summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-07 12:45:25 +0000
committerbulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-08-07 12:45:25 +0000
commite1e9d3e88f03c049f62e363724289809cff2cb02 (patch)
tree6ee3f6ed595f345bd4e4bf6a5048fff3c9f2bf25
parent4db297efe991cafcd5125aad8f21ef448b905c38 (diff)
downloadchromium_src-e1e9d3e88f03c049f62e363724289809cff2cb02.zip
chromium_src-e1e9d3e88f03c049f62e363724289809cff2cb02.tar.gz
chromium_src-e1e9d3e88f03c049f62e363724289809cff2cb02.tar.bz2
Enables (temporarily) adb trace for sharded perf tests.
This may help track down some issues with adb reliability: - sharder: sets the env var that will be inherited by the child shards. - run_command.py: redirect stderr (i.e., trace output) to stdout, otherwise higher up layers get confused with the extra data. It will be reverted soon after the data has been collected. BUG=268450 Review URL: https://chromiumcodereview.appspot.com/22430003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@216168 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-xbuild/android/bb_run_sharded_steps.py13
-rw-r--r--third_party/android_testrunner/run_command.py6
2 files changed, 18 insertions, 1 deletions
diff --git a/build/android/bb_run_sharded_steps.py b/build/android/bb_run_sharded_steps.py
index 9b768a9..086a3a1 100755
--- a/build/android/bb_run_sharded_steps.py
+++ b/build/android/bb_run_sharded_steps.py
@@ -54,6 +54,7 @@ import os
import signal
import shutil
import sys
+import time
from pylib import android_commands
from pylib import cmd_helper
@@ -174,6 +175,18 @@ def _KillPendingServers():
os.kill(int(pid), signal.SIGQUIT)
except Exception as e:
logging.warning('Failed killing %s %s %s', server, pid, e)
+ # Restart the adb server with full trace, and redirect stderr to stdout
+ # so the extra tracing won't confuse higher up layers.
+ os.environ['ADB_TRACE'] = 'all'
+ cmd_helper.RunCmd(['adb', 'kill-server'])
+ cmd_helper.RunCmd(['adb', 'start-server'])
+ cmd_helper.RunCmd(['adb', 'root'])
+ i = 1
+ while not android_commands.GetAttachedDevices():
+ time.sleep(i)
+ i *= 2
+ if i > 10:
+ break
def main(argv):
diff --git a/third_party/android_testrunner/run_command.py b/third_party/android_testrunner/run_command.py
index 6b84156..5c82c61 100644
--- a/third_party/android_testrunner/run_command.py
+++ b/third_party/android_testrunner/run_command.py
@@ -22,6 +22,7 @@ import subprocess
import tempfile
import threading
import time
+import sys
# local imports
import errors
@@ -93,12 +94,15 @@ def RunOnce(cmd, timeout_time=None, return_output=True, stdin_input=None):
stdin_dest = subprocess.PIPE
else:
stdin_dest = None
+ stderr_dest = subprocess.STDOUT
+ if os.environ.get('ADB_TRACE'):
+ stderr_dest = sys.stdout
pipe = subprocess.Popen(
cmd,
executable='/bin/bash',
stdin=stdin_dest,
stdout=output_dest,
- stderr=subprocess.STDOUT,
+ stderr=stderr_dest,
shell=True, close_fds=True,
preexec_fn=lambda: signal.signal(signal.SIGPIPE, signal.SIG_DFL))