summaryrefslogtreecommitdiff
path: root/build
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2013-08-08 10:24:53 +0100
committerBen Murdoch <benm@google.com>2013-08-08 10:24:53 +0100
commitbb1529ce867d8845a77ec7cdf3e3003ef1771a40 (patch)
treef78d0de03cc8aed1a934d921636a0beb8d164378 /build
parentc95505573d864f17cabf515e32f5b8e0831ae237 (diff)
downloadchromium_org-bb1529ce867d8845a77ec7cdf3e3003ef1771a40.tar.gz
Merge from Chromium at DEPS revision r216370
This commit was generated by merge_to_master.py. Change-Id: I739228187a6f1df6c28c5761160e593a49891113
Diffstat (limited to 'build')
-rwxr-xr-xbuild/android/bb_run_sharded_steps.py13
-rwxr-xr-xbuild/android/buildbot/bb_device_status_check.py13
-rw-r--r--build/android/pylib/android_commands.py146
-rw-r--r--build/android/pylib/instrumentation/test_options.py1
-rw-r--r--build/android/pylib/instrumentation/test_runner.py3
-rw-r--r--build/android/pylib/monkey/__init__.py0
-rw-r--r--build/android/pylib/monkey/setup.py27
-rw-r--r--build/android/pylib/monkey/test_options.py18
-rw-r--r--build/android/pylib/monkey/test_runner.py77
-rw-r--r--build/android/pylib/uiautomator/test_options.py1
-rw-r--r--build/android/pylib/uiautomator/test_runner.py1
-rwxr-xr-xbuild/android/run_monkey_test.py170
-rwxr-xr-xbuild/android/test_runner.py103
-rw-r--r--build/common.gypi25
-rw-r--r--build/util/LASTCHANGE2
-rw-r--r--build/util/LASTCHANGE.blink2
-rw-r--r--build/whitespace_file.txt2
17 files changed, 349 insertions, 255 deletions
diff --git a/build/android/bb_run_sharded_steps.py b/build/android/bb_run_sharded_steps.py
index 9b768a9f7e..086a3a13e3 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/build/android/buildbot/bb_device_status_check.py b/build/android/buildbot/bb_device_status_check.py
index 1df95a31c7..ae0bb4a7b1 100755
--- a/build/android/buildbot/bb_device_status_check.py
+++ b/build/android/buildbot/bb_device_status_check.py
@@ -11,6 +11,7 @@ import os
import smtplib
import sys
import re
+import urllib
import bb_annotations
@@ -148,9 +149,19 @@ def CheckForMissingDevices(options, adb_online_devs):
# TODO(navabi): Debug by printing both output from GetCmdOutput and
# GetAttachedDevices to compare results.
+ crbug_link = ('https://code.google.com/p/chromium/issues/entry?summary='
+ '%s&comment=%s&labels=Restrict-View-Google,OS-Android,Infra' %
+ (urllib.quote('Device Offline'),
+ urllib.quote('Buildbot: %s %s\n'
+ 'Build: %s\n'
+ '(please don\'t change any labels)' %
+ (os.environ.get('BUILDBOT_BUILDERNAME'),
+ os.environ.get('BUILDBOT_SLAVENAME'),
+ os.environ.get('BUILDBOT_BUILDNUMBER')))))
return ['Current online devices: %s' % adb_online_devs,
'%s are no longer visible. Were they removed?\n' % missing_devs,
- 'SHERIFF: See go/chrome_device_monitor',
+ 'SHERIFF:\n',
+ '@@@STEP_LINK@Click here to file a bug@%s@@@\n' % crbug_link,
'Cache file: %s\n\n' % last_devices_path,
'adb devices: %s' % GetCmdOutput(['adb', 'devices']),
'adb devices(GetAttachedDevices): %s' %
diff --git a/build/android/pylib/android_commands.py b/build/android/pylib/android_commands.py
index 4cf070d071..cb72fffba5 100644
--- a/build/android/pylib/android_commands.py
+++ b/build/android/pylib/android_commands.py
@@ -184,14 +184,15 @@ def _GetFilesFromRecursiveLsOutput(path, ls_output, re_file, utc_offset=None):
return files
-def _ComputeFileListHash(md5sum_output):
+def _ParseMd5SumOutput(md5sum_output):
"""Returns a list of tuples from the provided md5sum output.
Args:
md5sum_output: output directly from md5sum binary.
Returns:
- List of namedtuples (hash, path).
+ List of namedtuples with attributes |hash| and |path|, where |path| is the
+ absolute path to the file with an Md5Sum of |hash|.
"""
HashAndPath = collections.namedtuple('HashAndPath', ['hash', 'path'])
split_lines = [line.split(' ') for line in md5sum_output]
@@ -418,7 +419,8 @@ class AndroidCommands(object):
# Check if package is already installed and up to date.
if package_name:
installed_apk_path = self.GetApplicationPath(package_name)
- if installed_apk_path and self.CheckMd5Sum(apk_path, installed_apk_path):
+ if (installed_apk_path and
+ not self.GetFilesChanged(apk_path, installed_apk_path)):
logging.info('Skipped install: identical %s APK already installed' %
package_name)
return
@@ -738,15 +740,16 @@ class AndroidCommands(object):
"""
self.RunShellCommand('input keyevent %d' % keycode)
- def CheckMd5Sum(self, local_path, device_path):
- """Compares the md5sum of a local path against a device path.
+ def _RunMd5Sum(self, host_path, device_path):
+ """Gets the md5sum of a host path and device path.
Args:
- local_path: Path (file or directory) on the host.
+ host_path: Path (file or directory) on the host.
device_path: Path on the device.
Returns:
- True if the md5sums match.
+ A tuple containing lists of the host and device md5sum results as
+ created by _ParseMd5SumOutput().
"""
if not self._md5sum_build_dir:
default_build_type = os.environ.get('BUILD_TYPE', 'Debug')
@@ -763,73 +766,112 @@ class AndroidCommands(object):
cmd = (MD5SUM_LD_LIBRARY_PATH + ' ' + self._util_wrapper + ' ' +
MD5SUM_DEVICE_PATH + ' ' + device_path)
- device_hash_tuples = _ComputeFileListHash(
+ device_hash_tuples = _ParseMd5SumOutput(
self.RunShellCommand(cmd, timeout_time=2 * 60))
- assert os.path.exists(local_path), 'Local path not found %s' % local_path
+ assert os.path.exists(host_path), 'Local path not found %s' % host_path
md5sum_output = cmd_helper.GetCmdOutput(
- ['%s/md5sum_bin_host' % self._md5sum_build_dir, local_path])
- host_hash_tuples = _ComputeFileListHash(md5sum_output.splitlines())
+ ['%s/md5sum_bin_host' % self._md5sum_build_dir, host_path])
+ host_hash_tuples = _ParseMd5SumOutput(md5sum_output.splitlines())
+ return (host_hash_tuples, device_hash_tuples)
+
+ def GetFilesChanged(self, host_path, device_path):
+ """Compares the md5sum of a host path against a device path.
+
+ Note: Ignores extra files on the device.
+
+ Args:
+ host_path: Path (file or directory) on the host.
+ device_path: Path on the device.
+
+ Returns:
+ A list of tuples of the form (host_path, device_path) for files whose
+ md5sums do not match.
+ """
+ host_hash_tuples, device_hash_tuples = self._RunMd5Sum(
+ host_path, device_path)
# Ignore extra files on the device.
if len(device_hash_tuples) > len(host_hash_tuples):
host_files = [os.path.relpath(os.path.normpath(p.path),
- os.path.normpath(local_path)) for p in host_hash_tuples]
+ os.path.normpath(host_path)) for p in host_hash_tuples]
- def _host_has(fname):
+ def HostHas(fname):
return any(path in fname for path in host_files)
- hashes_on_device = [h.hash for h in device_hash_tuples if
- _host_has(h.path)]
- else:
- hashes_on_device = [h.hash for h in device_hash_tuples]
+ device_hash_tuples = [h for h in device_hash_tuples if HostHas(h.path)]
+
+ # Constructs the target device path from a given host path. Don't use when
+ # only a single file is given as the base name given in device_path may
+ # differ from that in host_path.
+ def HostToDevicePath(host_file_path):
+ return os.path.join(os.path.dirname(device_path), os.path.relpath(
+ host_file_path, os.path.dirname(os.path.normpath(host_path))))
- # Compare md5sums between host and device files.
- hashes_on_host = [h.hash for h in host_hash_tuples]
- hashes_on_device.sort()
- hashes_on_host.sort()
- return hashes_on_device == hashes_on_host
+ device_hashes = [h.hash for h in device_hash_tuples]
+ return [(t.path, HostToDevicePath(t.path) if os.path.isdir(host_path) else
+ device_path)
+ for t in host_hash_tuples if t.hash not in device_hashes]
- def PushIfNeeded(self, local_path, device_path):
- """Pushes |local_path| to |device_path|.
+ def PushIfNeeded(self, host_path, device_path):
+ """Pushes |host_path| to |device_path|.
Works for files and directories. This method skips copying any paths in
|test_data_paths| that already exist on the device with the same hash.
All pushed files can be removed by calling RemovePushedFiles().
"""
- assert os.path.exists(local_path), 'Local path not found %s' % local_path
- size = int(cmd_helper.GetCmdOutput(['du', '-sb', local_path]).split()[0])
+ MAX_INDIVIDUAL_PUSHES = 50
+ assert os.path.exists(host_path), 'Local path not found %s' % host_path
+
+ def GetHostSize(path):
+ return int(cmd_helper.GetCmdOutput(['du', '-sb', path]).split()[0])
+
+ size = GetHostSize(host_path)
self._pushed_files.append(device_path)
self._potential_push_size += size
- if self.CheckMd5Sum(local_path, device_path):
+ changed_files = self.GetFilesChanged(host_path, device_path)
+ if not changed_files:
return
- self._actual_push_size += size
- # They don't match, so remove everything first and then create it.
- if os.path.isdir(local_path):
- self.RunShellCommand('rm -r %s' % device_path, timeout_time=2 * 60)
- self.RunShellCommand('mkdir -p %s' % device_path)
-
- # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout of
- # 60 seconds which isn't sufficient for a lot of users of this method.
- push_command = 'push %s %s' % (local_path, device_path)
- self._LogShell(push_command)
-
- # Retry push with increasing backoff if the device is busy.
- retry = 0
- while True:
- output = self._adb.SendCommand(push_command, timeout_time=30 * 60)
- if _HasAdbPushSucceeded(output):
- return
- if 'resource busy' in output and retry < 3:
- retry += 1
- wait_time = 5 * retry
- logging.error('Push failed, retrying in %d seconds: %s' %
- (wait_time, output))
- time.sleep(wait_time)
- else:
- raise Exception('Push failed: %s' % output)
+ def Push(host, device):
+ # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout
+ # of 60 seconds which isn't sufficient for a lot of users of this method.
+ push_command = 'push %s %s' % (host, device)
+ self._LogShell(push_command)
+
+ # Retry push with increasing backoff if the device is busy.
+ retry = 0
+ while True:
+ output = self._adb.SendCommand(push_command, timeout_time=30 * 60)
+ if _HasAdbPushSucceeded(output):
+ return
+ if retry < 3:
+ retry += 1
+ wait_time = 5 * retry
+ logging.error('Push failed, retrying in %d seconds: %s' %
+ (wait_time, output))
+ time.sleep(wait_time)
+ else:
+ raise Exception('Push failed: %s' % output)
+
+ diff_size = 0
+ if len(changed_files) <= MAX_INDIVIDUAL_PUSHES:
+ diff_size = sum(GetHostSize(f[0]) for f in changed_files)
+
+ # TODO(craigdh): Replace this educated guess with a heuristic that
+ # approximates the push time for each method.
+ if len(changed_files) > MAX_INDIVIDUAL_PUSHES or diff_size > 0.5 * size:
+ # We're pushing everything, remove everything first and then create it.
+ self._actual_push_size += size
+ if os.path.isdir(host_path):
+ self.RunShellCommand('rm -r %s' % device_path, timeout_time=2 * 60)
+ self.RunShellCommand('mkdir -p %s' % device_path)
+ Push(host_path, device_path)
+ else:
+ for f in changed_files:
+ Push(f[0], f[1])
+ self._actual_push_size += diff_size
def GetPushSizeInfo(self):
"""Get total size of pushes to the device done via PushIfNeeded()
diff --git a/build/android/pylib/instrumentation/test_options.py b/build/android/pylib/instrumentation/test_options.py
index fec3d9c832..0c9ac005ba 100644
--- a/build/android/pylib/instrumentation/test_options.py
+++ b/build/android/pylib/instrumentation/test_options.py
@@ -17,7 +17,6 @@ InstrumentationOptions = collections.namedtuple('InstrumentationOptions', [
'test_data',
'save_perf_json',
'screenshot_failures',
- 'disable_assertions',
'wait_for_debugger',
'test_apk',
'test_apk_path',
diff --git a/build/android/pylib/instrumentation/test_runner.py b/build/android/pylib/instrumentation/test_runner.py
index 4464d72d3d..5e2b67ece8 100644
--- a/build/android/pylib/instrumentation/test_runner.py
+++ b/build/android/pylib/instrumentation/test_runner.py
@@ -126,8 +126,7 @@ class TestRunner(base_test_runner.BaseTestRunner):
logging.warning('Unable to enable java asserts for %s, non rooted device',
self.device)
else:
- if self.adb.SetJavaAssertsEnabled(
- enable=not self.options.disable_assertions):
+ if self.adb.SetJavaAssertsEnabled(True):
self.adb.Reboot(full_reboot=False)
# We give different default value to launch HTTP server based on shard index
diff --git a/build/android/pylib/monkey/__init__.py b/build/android/pylib/monkey/__init__.py
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/build/android/pylib/monkey/__init__.py
diff --git a/build/android/pylib/monkey/setup.py b/build/android/pylib/monkey/setup.py
new file mode 100644
index 0000000000..5735d2e957
--- /dev/null
+++ b/build/android/pylib/monkey/setup.py
@@ -0,0 +1,27 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Generates test runner factory and tests for monkey tests."""
+
+import test_runner
+
+
+def Setup(test_options):
+ """Create and return the test runner factory and tests.
+
+ Args:
+ test_options: A MonkeyOptions object.
+
+ Returns:
+ A tuple of (TestRunnerFactory, tests).
+ """
+ # Token to replicate across devices as the "test". The TestRunner does all of
+ # the work to run the test.
+ tests = ['MonkeyTest']
+
+ def TestRunnerFactory(device, shard_index):
+ return test_runner.TestRunner(
+ test_options, device, shard_index)
+
+ return (TestRunnerFactory, tests)
diff --git a/build/android/pylib/monkey/test_options.py b/build/android/pylib/monkey/test_options.py
new file mode 100644
index 0000000000..6b095f3ec6
--- /dev/null
+++ b/build/android/pylib/monkey/test_options.py
@@ -0,0 +1,18 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Defines the MonkeyOptions named tuple."""
+
+import collections
+
+MonkeyOptions = collections.namedtuple('MonkeyOptions', [
+ 'build_type',
+ 'verbose_count',
+ 'package_name',
+ 'activity_name',
+ 'event_count',
+ 'category',
+ 'throttle',
+ 'seed',
+ 'extra_args'])
diff --git a/build/android/pylib/monkey/test_runner.py b/build/android/pylib/monkey/test_runner.py
new file mode 100644
index 0000000000..99bc2e681b
--- /dev/null
+++ b/build/android/pylib/monkey/test_runner.py
@@ -0,0 +1,77 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Runs a monkey test on a single device."""
+
+import random
+
+from pylib.base import base_test_result
+from pylib.base import base_test_runner
+
+
+class TestRunner(base_test_runner.BaseTestRunner):
+ """A TestRunner instance runs a monkey test on a single device."""
+
+ def __init__(self, test_options, device, shard_index):
+ super(TestRunner, self).__init__(device, None, test_options.build_type)
+ self.options = test_options
+
+ def _LaunchMonkeyTest(self):
+ """Runs monkey test for a given package.
+
+ Returns:
+ Output from the monkey command on the device.
+ """
+
+ timeout_ms = self.options.event_count * self.options.throttle * 1.5
+
+ cmd = ['monkey',
+ '-p %s' % self.options.package_name,
+ ' '.join(['-c %s' % c for c in self.options.category]),
+ '--throttle %d' % self.options.throttle,
+ '-s %d' % (self.options.seed or random.randint(1, 100)),
+ '-v ' * self.options.verbose_count,
+ '--monitor-native-crashes',
+ '--kill-process-after-error',
+ self.options.extra_args,
+ '%d' % self.options.event_count]
+ return self.adb.RunShellCommand(' '.join(cmd), timeout_time=timeout_ms)
+
+ def RunTest(self, test_name):
+ """Run a Monkey test on the device.
+
+ Args:
+ test_name: String to use for logging the test result.
+
+ Returns:
+ A tuple of (TestRunResults, retry).
+ """
+ self.adb.StartActivity(self.options.package_name,
+ self.options.activity_name,
+ wait_for_completion=True,
+ action='android.intent.action.MAIN',
+ force_stop=True)
+
+ # Chrome crashes are not always caught by Monkey test runner.
+ # Verify Chrome has the same PID before and after the test.
+ before_pids = self.adb.ExtractPid(self.options.package_name)
+
+ # Run the test.
+ output = ''
+ if before_pids:
+ output = '\n'.join(self._LaunchMonkeyTest())
+ after_pids = self.adb.ExtractPid(self.options.package_name)
+
+ crashed = (not before_pids or not after_pids
+ or after_pids[0] != before_pids[0])
+
+ results = base_test_result.TestRunResults()
+ if 'Monkey finished' in output and not crashed:
+ result = base_test_result.BaseTestResult(
+ test_name, base_test_result.ResultType.PASS, log=output)
+ else:
+ result = base_test_result.BaseTestResult(
+ test_name, base_test_result.ResultType.FAIL, log=output)
+ results.AddResult(result)
+ return results, False
diff --git a/build/android/pylib/uiautomator/test_options.py b/build/android/pylib/uiautomator/test_options.py
index ddc2ae0fa3..2ce5eb0080 100644
--- a/build/android/pylib/uiautomator/test_options.py
+++ b/build/android/pylib/uiautomator/test_options.py
@@ -17,7 +17,6 @@ UIAutomatorOptions = collections.namedtuple('UIAutomatorOptions', [
'test_data',
'save_perf_json',
'screenshot_failures',
- 'disable_assertions',
'uiautomator_jar',
'uiautomator_info_jar',
'package_name'])
diff --git a/build/android/pylib/uiautomator/test_runner.py b/build/android/pylib/uiautomator/test_runner.py
index 74e887dead..58cdd45dd0 100644
--- a/build/android/pylib/uiautomator/test_runner.py
+++ b/build/android/pylib/uiautomator/test_runner.py
@@ -35,7 +35,6 @@ class TestRunner(instr_test_runner.TestRunner):
test_options.test_data,
test_options.save_perf_json,
test_options.screenshot_failures,
- test_options.disable_assertions,
wait_for_debugger=False,
test_apk=None,
test_apk_path=None,
diff --git a/build/android/run_monkey_test.py b/build/android/run_monkey_test.py
deleted file mode 100755
index 4957ac6ec7..0000000000
--- a/build/android/run_monkey_test.py
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Runs the Monkey tests on one or more devices."""
-import logging
-import optparse
-import random
-import sys
-
-from pylib.base import base_test_result
-from pylib.base import test_dispatcher
-from pylib.host_driven import test_case
-from pylib.host_driven import test_runner
-from pylib.utils import report_results
-from pylib.utils import test_options_parser
-
-
-class MonkeyTest(test_case.HostDrivenTestCase):
- def __init__(self, test_name, package_name, activity_name, category, seed,
- throttle, event_count, verbosity, extra_args):
- """Create a MonkeyTest object.
-
- Args:
- test_name: Name of the method to run for this test object.
- package_name: Allowed package.
- activity_name: Name of the activity to start.
- category: A list of allowed categories.
- seed: Seed value for pseduo-random generator. Same seed value
- generates the same sequence of events. Seed is randomized by default.
- throttle: Delay between events (ms).
- event_count: Number of events to generate.
- verbosity: Verbosity level [0-3].
- extra_args: A string of other args to pass to the command verbatim.
- """
- super(MonkeyTest, self).__init__(test_name)
- self.package_name = package_name
- self.activity_name = activity_name
- self.category = category
- self.seed = seed or random.randint(1, 100)
- self.throttle = throttle
- self.event_count = event_count
- self.verbosity = verbosity
- self.extra_args = extra_args
-
- def testMonkey(self):
- # Launch and wait for Chrome to launch.
- self.adb.StartActivity(self.package_name,
- self.activity_name,
- wait_for_completion=True,
- action='android.intent.action.MAIN',
- force_stop=True)
-
- # Chrome crashes are not always caught by Monkey test runner.
- # Verify Chrome has the same PID before and after the test.
- before_pids = self.adb.ExtractPid(self.package_name)
-
- # Run the test.
- output = ''
- if before_pids:
- output = '\n'.join(self._LaunchMonkeyTest())
- after_pids = self.adb.ExtractPid(self.package_name)
-
- crashed = (not before_pids or not after_pids
- or after_pids[0] != before_pids[0])
-
- results = base_test_result.TestRunResults()
- if 'Monkey finished' in output and not crashed:
- result = base_test_result.BaseTestResult(
- self.tagged_name, base_test_result.ResultType.PASS, log=output)
- else:
- result = base_test_result.BaseTestResult(
- self.tagged_name, base_test_result.ResultType.FAIL, log=output)
- results.AddResult(result)
- return results
-
- def _LaunchMonkeyTest(self):
- """Runs monkey test for a given package.
-
- Returns:
- Output from the monkey command on the device.
- """
-
- timeout_ms = self.event_count * self.throttle * 1.5
-
- cmd = ['monkey',
- '-p %s' % self.package_name,
- ' '.join(['-c %s' % c for c in self.category]),
- '--throttle %d' % self.throttle,
- '-s %d' % self.seed,
- '-v ' * self.verbosity,
- '--monitor-native-crashes',
- '--kill-process-after-error',
- self.extra_args,
- '%d' % self.event_count]
- return self.adb.RunShellCommand(' '.join(cmd), timeout_time=timeout_ms)
-
-
-def RunMonkeyTests(options):
- """Runs the Monkey tests, replicating it if there multiple devices."""
- logger = logging.getLogger()
- logger.setLevel(logging.DEBUG)
-
- # Actually run the tests.
- logging.debug('Running monkey tests.')
- available_tests = [
- MonkeyTest('testMonkey', options.package_name, options.activity_name,
- category=options.category, seed=options.seed,
- throttle=options.throttle, event_count=options.event_count,
- verbosity=options.verbosity, extra_args=options.extra_args)]
-
- def TestRunnerFactory(device, shard_index):
- return test_runner.HostDrivenTestRunner(
- device, shard_index, '', options.build_type, False, False)
-
- results, exit_code = test_dispatcher.RunTests(
- available_tests, TestRunnerFactory, False, None, shard=False,
- build_type=options.build_type, num_retries=0)
-
- report_results.LogFull(
- results=results,
- test_type='Monkey',
- test_package='Monkey',
- build_type=options.build_type)
-
- return exit_code
-
-
-def main():
- desc = 'Run the Monkey tests on 1 or more devices.'
- parser = optparse.OptionParser(description=desc)
- test_options_parser.AddBuildTypeOption(parser)
- parser.add_option('--package-name', help='Allowed package.')
- parser.add_option('--activity-name',
- default='com.google.android.apps.chrome.Main',
- help='Name of the activity to start [default: %default].')
- parser.add_option('--category', default='',
- help='A list of allowed categories [default: %default].')
- parser.add_option('--throttle', default=100, type='int',
- help='Delay between events (ms) [default: %default]. ')
- parser.add_option('--seed', type='int',
- help=('Seed value for pseudo-random generator. Same seed '
- 'value generates the same sequence of events. Seed '
- 'is randomized by default.'))
- parser.add_option('--event-count', default=10000, type='int',
- help='Number of events to generate [default: %default].')
- parser.add_option('--verbosity', default=1, type='int',
- help='Verbosity level [0-3] [default: %default].')
- parser.add_option('--extra-args', default='',
- help=('String of other args to pass to the command verbatim'
- ' [default: "%default"].'))
- (options, args) = parser.parse_args()
-
- if args:
- parser.print_help(sys.stderr)
- parser.error('Unknown arguments: %s' % args)
-
- if not options.package_name:
- parser.print_help(sys.stderr)
- parser.error('Missing package name')
-
- if options.category:
- options.category = options.category.split(',')
-
- RunMonkeyTests(options)
-
-
-if __name__ == '__main__':
- main()
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index 4113158fd3..8655720810 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -26,6 +26,8 @@ from pylib.gtest import test_options as gtest_test_options
from pylib.host_driven import setup as host_driven_setup
from pylib.instrumentation import setup as instrumentation_setup
from pylib.instrumentation import test_options as instrumentation_test_options
+from pylib.monkey import setup as monkey_setup
+from pylib.monkey import test_options as monkey_test_options
from pylib.uiautomator import setup as uiautomator_setup
from pylib.uiautomator import test_options as uiautomator_test_options
from pylib.utils import report_results
@@ -68,13 +70,6 @@ def AddCommonOptions(option_parser):
default=0,
action='count',
help='Verbose level (multiple times for more)')
- profilers = ['devicestatsmonitor', 'chrometrace', 'dumpheap', 'smaps',
- 'traceview']
- option_parser.add_option('--profiler', dest='profilers', action='append',
- choices=profilers,
- help=('Profiling tool to run during test. Pass '
- 'multiple times to run multiple profilers. '
- 'Available profilers: %s' % profilers))
option_parser.add_option('--tool',
dest='tool',
help=('Run the test under a tool '
@@ -172,10 +167,6 @@ def AddJavaTestOptions(option_parser):
'kept. When this is run via a sharder '
'the test server ports should be kept and '
'should not be reset.'))
- # TODO(gkanwar): This option is deprecated. Remove it in the future.
- option_parser.add_option('--disable_assertions', action='store_true',
- help=('(DEPRECATED) Run with java assertions '
- 'disabled.'))
option_parser.add_option('--test_data', action='append', default=[],
help=('Each instance defines a directory of test '
'data that should be copied to the target(s) '
@@ -228,9 +219,6 @@ def AddInstrumentationTestOptions(option_parser):
option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger',
action='store_true',
help='Wait for debugger.')
- #TODO(craigdh): Remove option once -I is no longer passed downstream.
- option_parser.add_option('-I', dest='install_apk', action='store_true',
- help='(DEPRECATED) Install the test apk.')
option_parser.add_option(
'--test-apk', dest='test_apk',
help=('The name of the apk containing the tests '
@@ -293,7 +281,6 @@ def ProcessInstrumentationOptions(options, error_func):
options.test_data,
options.save_perf_json,
options.screenshot_failures,
- options.disable_assertions,
options.wait_for_debugger,
options.test_apk,
options.test_apk_path,
@@ -330,7 +317,7 @@ def ProcessUIAutomatorOptions(options, error_func):
Returns:
A UIAutomatorOptions named tuple which contains all options relevant to
- instrumentation tests.
+ uiautomator tests.
"""
ProcessJavaTestOptions(options, error_func)
@@ -363,12 +350,68 @@ def ProcessUIAutomatorOptions(options, error_func):
options.test_data,
options.save_perf_json,
options.screenshot_failures,
- options.disable_assertions,
options.uiautomator_jar,
options.uiautomator_info_jar,
options.package_name)
+def AddMonkeyTestOptions(option_parser):
+ """Adds monkey test options to |option_parser|."""
+ option_parser.add_option('--package-name', help='Allowed package.')
+ option_parser.add_option(
+ '--activity-name', default='com.google.android.apps.chrome.Main',
+ help='Name of the activity to start [default: %default].')
+ option_parser.add_option(
+ '--event-count', default=10000, type='int',
+ help='Number of events to generate [default: %default].')
+ option_parser.add_option(
+ '--category', default='',
+ help='A list of allowed categories [default: %default].')
+ option_parser.add_option(
+ '--throttle', default=100, type='int',
+ help='Delay between events (ms) [default: %default]. ')
+ option_parser.add_option(
+ '--seed', type='int',
+ help=('Seed value for pseudo-random generator. Same seed value generates '
+ 'the same sequence of events. Seed is randomized by default.'))
+ option_parser.add_option(
+ '--extra-args', default='',
+ help=('String of other args to pass to the command verbatim '
+ '[default: "%default"].'))
+
+ AddCommonOptions(option_parser)
+
+
+def ProcessMonkeyTestOptions(options, error_func):
+ """Processes all monkey test options.
+
+ Args:
+ options: optparse.Options object.
+ error_func: Function to call with the error message in case of an error.
+
+ Returns:
+ A MonkeyOptions named tuple which contains all options relevant to
+ monkey tests.
+ """
+ if not options.package_name:
+ error_func('Package name is required.')
+
+ category = options.category
+ if category:
+ category = options.category.split(',')
+
+ return monkey_test_options.MonkeyOptions(
+ options.build_type,
+ options.verbose_count,
+ options.package_name,
+ options.activity_name,
+ options.event_count,
+ category,
+ options.throttle,
+ options.seed,
+ options.extra_args)
+
+
def _RunGTests(options, error_func):
"""Subcommand of RunTestsCommands which runs gtests."""
ProcessGTestOptions(options)
@@ -466,9 +509,6 @@ def _RunUIAutomatorTests(options, error_func):
"""Subcommand of RunTestsCommands which runs uiautomator tests."""
uiautomator_options = ProcessUIAutomatorOptions(options, error_func)
- results = base_test_result.TestRunResults()
- exit_code = 0
-
runner_factory, tests = uiautomator_setup.Setup(uiautomator_options)
results, exit_code = test_dispatcher.RunTests(
@@ -489,6 +529,25 @@ def _RunUIAutomatorTests(options, error_func):
return exit_code
+def _RunMonkeyTests(options, error_func):
+ """Subcommand of RunTestsCommands which runs monkey tests."""
+ monkey_options = ProcessMonkeyTestOptions(options, error_func)
+
+ runner_factory, tests = monkey_setup.Setup(monkey_options)
+
+ results, exit_code = test_dispatcher.RunTests(
+ tests, runner_factory, False, None, shard=False)
+
+ report_results.LogFull(
+ results=results,
+ test_type='Monkey',
+ test_package='Monkey',
+ build_type=options.build_type)
+
+ return exit_code
+
+
+
def RunTestsCommand(command, options, args, option_parser):
"""Checks test type and dispatches to the appropriate function.
@@ -520,6 +579,8 @@ def RunTestsCommand(command, options, args, option_parser):
return _RunInstrumentationTests(options, option_parser.error)
elif command == 'uiautomator':
return _RunUIAutomatorTests(options, option_parser.error)
+ elif command == 'monkey':
+ return _RunMonkeyTests(options, option_parser.error)
else:
raise Exception('Unknown test type.')
@@ -576,6 +637,8 @@ VALID_COMMANDS = {
AddInstrumentationTestOptions, RunTestsCommand),
'uiautomator': CommandFunctionTuple(
AddUIAutomatorTestOptions, RunTestsCommand),
+ 'monkey': CommandFunctionTuple(
+ AddMonkeyTestOptions, RunTestsCommand),
'help': CommandFunctionTuple(lambda option_parser: None, HelpCommand)
}
diff --git a/build/common.gypi b/build/common.gypi
index 29f1278044..72e9ecb7de 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -27,6 +27,9 @@
# Whether or not we are building the Ash shell.
'use_ash%': 0,
+ # Whether or not we are using CRAS, the ChromeOS Audio Server.
+ 'use_cras%': 0,
+
# Use a raw surface abstraction.
'use_ozone%': 0,
},
@@ -34,6 +37,7 @@
'chromeos%': '<(chromeos)',
'use_aura%': '<(use_aura)',
'use_ash%': '<(use_ash)',
+ 'use_cras%': '<(use_cras)',
'use_ozone%': '<(use_ozone)',
# Whether we are using Views Toolkit
@@ -98,6 +102,7 @@
'chromeos%': '<(chromeos)',
'use_aura%': '<(use_aura)',
'use_ash%': '<(use_ash)',
+ 'use_cras%': '<(use_cras)',
'use_ozone%': '<(use_ozone)',
'use_openssl%': '<(use_openssl)',
'enable_viewport%': '<(enable_viewport)',
@@ -179,6 +184,7 @@
'toolkit_uses_gtk%': '<(toolkit_uses_gtk)',
'use_aura%': '<(use_aura)',
'use_ash%': '<(use_ash)',
+ 'use_cras%': '<(use_cras)',
'use_ozone%': '<(use_ozone)',
'use_openssl%': '<(use_openssl)',
'enable_viewport%': '<(enable_viewport)',
@@ -693,7 +699,16 @@
}],
['OS=="win" or OS=="linux"', {
'enable_mdns%' : 1,
- }]
+ }],
+
+ # Turns on compiler optimizations in V8 in Debug build, except
+ # on android_clang, where we're hitting a weird linker error.
+ # TODO(dpranke): http://crbug.com/266155 .
+ ['OS=="android"', {
+ 'v8_optimized_debug': 1,
+ }, {
+ 'v8_optimized_debug': 2,
+ }],
],
# Set this to 1 to enable use of concatenated impulse responses
@@ -755,6 +770,7 @@
'ui_compositor_image_transport%': '<(ui_compositor_image_transport)',
'use_aura%': '<(use_aura)',
'use_ash%': '<(use_ash)',
+ 'use_cras%': '<(use_cras)',
'use_openssl%': '<(use_openssl)',
'use_nss%': '<(use_nss)',
'os_bsd%': '<(os_bsd)',
@@ -847,6 +863,7 @@
'spdy_proxy_auth_property%': '<(spdy_proxy_auth_property)',
'spdy_proxy_auth_value%': '<(spdy_proxy_auth_value)',
'enable_mdns%' : '<(enable_mdns)',
+ 'v8_optimized_debug': '<(v8_optimized_debug)',
# Use system nspr instead of the bundled one.
'use_system_nspr%': 0,
@@ -1104,9 +1121,6 @@
# rlz codes for searches but do not use the library.
'enable_rlz%': 0,
- # Turns on compiler optimizations in V8 in Debug build.
- 'v8_optimized_debug': 1,
-
# Turns on the i18n support in V8.
'v8_enable_i18n_support': 1,
@@ -1928,6 +1942,9 @@
['use_ash==1', {
'defines': ['USE_ASH=1'],
}],
+ ['use_cras==1', {
+ 'defines': ['USE_CRAS=1'],
+ }],
['use_ozone==1', {
'defines': ['USE_OZONE=1'],
}],
diff --git a/build/util/LASTCHANGE b/build/util/LASTCHANGE
index 16f4b00dff..aae86680ee 100644
--- a/build/util/LASTCHANGE
+++ b/build/util/LASTCHANGE
@@ -1 +1 @@
-LASTCHANGE=216133
+LASTCHANGE=216370
diff --git a/build/util/LASTCHANGE.blink b/build/util/LASTCHANGE.blink
index 3a4250bd4c..03e4ec2d8b 100644
--- a/build/util/LASTCHANGE.blink
+++ b/build/util/LASTCHANGE.blink
@@ -1 +1 @@
-LASTCHANGE=155634
+LASTCHANGE=155688
diff --git a/build/whitespace_file.txt b/build/whitespace_file.txt
index e894ecf9a8..4d8ced405a 100644
--- a/build/whitespace_file.txt
+++ b/build/whitespace_file.txt
@@ -44,7 +44,7 @@ There was a poignant pause.
CHAPTER 3:
Mr. Usagi felt that something wasn't right. Shortly after the Domo-Kun left he
began feeling sick. He thought out loud to himself, "No, he wouldn't have done
-that to me." He considered that perhaps he shouldn't have pushed him so far.
+that to me." He considered that perhaps he shouldn't have pushed so hard.
Perhaps he shouldn't have been so cold and sarcastic, after the unimaginable
horror that had occurred just the week before.