diff options
author | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 01:26:26 +0000 |
---|---|---|
committer | wangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-21 01:26:26 +0000 |
commit | e383a5623447ee16f28d5240a6013bb685adfe7d (patch) | |
tree | 5d80b49a39624330607e997f83994ae44754d1f9 | |
parent | 9a9f4a1ead7af556c88e04ed19b35fa0a3566112 (diff) | |
download | chromium_src-e383a5623447ee16f28d5240a6013bb685adfe7d.zip chromium_src-e383a5623447ee16f28d5240a6013bb685adfe7d.tar.gz chromium_src-e383a5623447ee16f28d5240a6013bb685adfe7d.tar.bz2 |
Change Android build configurations (step 2).
Step 1 is https://chromiumcodereview.appspot.com/10827273/ which changed
Debug build to build size-optimized code with DCHECK.
Step 2: update developer scripts and buildbot scripts to support to new
configurations.
BUG=none
Review URL: https://chromiumcodereview.appspot.com/10836323
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152468 0039d316-1c4b-4281-b951-d872f2087c98
-rwxr-xr-x | build/android/adb_install_content_shell | 14 | ||||
-rwxr-xr-x | build/android/device_stats_monitor.py | 4 | ||||
-rwxr-xr-x | build/android/gdb_apk | 3 | ||||
-rwxr-xr-x | build/android/gdb_content_shell | 2 | ||||
-rw-r--r-- | build/android/pylib/base_test_runner.py | 8 | ||||
-rw-r--r-- | build/android/pylib/device_stats_monitor.py | 9 | ||||
-rw-r--r-- | build/android/pylib/fake_dns.py | 6 | ||||
-rw-r--r-- | build/android/pylib/forwarder.py | 9 | ||||
-rw-r--r-- | build/android/pylib/run_java_tests.py | 9 | ||||
-rw-r--r-- | build/android/pylib/single_test_runner.py | 6 | ||||
-rw-r--r-- | build/android/pylib/test_options_parser.py | 31 | ||||
-rwxr-xr-x | build/android/run_tests.py | 33 | ||||
-rw-r--r-- | build/common.gypi | 1 |
13 files changed, 91 insertions, 44 deletions
diff --git a/build/android/adb_install_content_shell b/build/android/adb_install_content_shell index a7cc218..fd883cc 100755 --- a/build/android/adb_install_content_shell +++ b/build/android/adb_install_content_shell @@ -5,27 +5,35 @@ # found in the LICENSE file. from multiprocessing import Process +import optparse import os +import sys from pylib import android_commands +from pylib import test_options_parser -def InstallContentShell(device): +def InstallContentShell(device, build_type): apk_path = os.path.join(os.environ['CHROME_SRC'], - 'out/Release/content_shell/ContentShell-debug.apk') + 'out', build_type, + 'content_shell', 'ContentShell-debug.apk') result = android_commands.AndroidCommands(device=device).ManagedInstall( apk_path, False, 'org.chromium.content_shell') print '----- Installed on %s -----' % device print result +parser = optparse.OptionParser() +test_options_parser.AddBuildTypeOption(parser) +options, args = parser.parse_args(sys.argv) + devices = android_commands.GetAttachedDevices() if not devices: raise Exception('Error: no connected devices') procs = [] for device in devices: - p = Process(target=InstallContentShell, args=(device,)) + p = Process(target=InstallContentShell, args=(device, options.build_type)) p.start() procs += [p] diff --git a/build/android/device_stats_monitor.py b/build/android/device_stats_monitor.py index 1d4fba2..181c3db 100755 --- a/build/android/device_stats_monitor.py +++ b/build/android/device_stats_monitor.py @@ -17,6 +17,7 @@ import time from pylib import android_commands from pylib import device_stats_monitor +from pylib import test_options_parser def main(argv): @@ -27,10 +28,11 @@ def main(argv): help='Seconds to monitor.') option_parser.add_option('--outfile', default='/tmp/devicestatsmonitor', help='Location to start output file.') + test_options_parser.AddBuildTypeOption(option_parser) options, args = option_parser.parse_args(argv) monitor = device_stats_monitor.DeviceStatsMonitor( - android_commands.AndroidCommands(), options.hz) + android_commands.AndroidCommands(), options.hz, options.build_type) monitor.Start() print 'Waiting for %d seconds while profiling.' % options.duration time.sleep(options.duration) diff --git a/build/android/gdb_apk b/build/android/gdb_apk index 63f084d..44c4572 100755 --- a/build/android/gdb_apk +++ b/build/android/gdb_apk @@ -97,12 +97,13 @@ rooted_phone=0 root=$(dirname $0)/../.. package_name=org.chromium.content_shell -shared_lib_dir=$root/out/Release/lib.target +shared_lib_dir=$root/out/${BUILDTYPE:-Release}/lib.target gdb_args='' #process options process_options "$@" echo "Debug package $package_name" +echo "Assume native shared library is under $shared_lib_dir" data_dir=/data/data/$package_name gdb_server_on_device=$data_dir/lib/gdbserver diff --git a/build/android/gdb_content_shell b/build/android/gdb_content_shell index ae67722..ee55c93 100755 --- a/build/android/gdb_content_shell +++ b/build/android/gdb_content_shell @@ -11,5 +11,5 @@ ROOT=$(cd "$(dirname $0)"; pwd) if [ $# -gt 0 ]; then exec ${ROOT}/gdb_apk -r -g "$*" else - exec ${ROOT}/gdb_apk -r -p org.chromium.content_shell -l ${ROOT}/../../out/Release/lib.target/ + exec ${ROOT}/gdb_apk -r -p org.chromium.content_shell fi diff --git a/build/android/pylib/base_test_runner.py b/build/android/pylib/base_test_runner.py index 523ed66..efed534 100644 --- a/build/android/pylib/base_test_runner.py +++ b/build/android/pylib/base_test_runner.py @@ -31,11 +31,12 @@ class BaseTestRunner(object): the Run() method will set up tests, run them and tear them down. """ - def __init__(self, device, tool, shard_index): + def __init__(self, device, tool, shard_index, build_type): """ Args: device: Tests will run on the device of this ID. shard_index: Index number of the shard on which the test suite will run. + build_type: 'Release' or 'Debug'. """ self.device = device self.adb = android_commands.AndroidCommands(device=device) @@ -60,6 +61,7 @@ class BaseTestRunner(object): # starting it in TestServerThread. self.test_server_spawner_port = 0 self.test_server_port = 0 + self.build_type = build_type def _PushTestServerPortInfoToDevice(self): """Pushes the latest port information to device.""" @@ -165,7 +167,7 @@ class BaseTestRunner(object): if self._forwarder: self._forwarder.Close() self._forwarder = Forwarder( - self.adb, port_pairs, self.tool, '127.0.0.1') + self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type) def StartForwarderForHttpServer(self): """Starts a forwarder for the HTTP server. @@ -232,4 +234,4 @@ class BaseTestRunner(object): self._spawner_forwarder = Forwarder( self.adb, [(self.test_server_spawner_port, self.test_server_spawner_port)], - self.tool, '127.0.0.1') + self.tool, '127.0.0.1', self.build_type) diff --git a/build/android/pylib/device_stats_monitor.py b/build/android/pylib/device_stats_monitor.py index 7922502..54ac61a 100644 --- a/build/android/pylib/device_stats_monitor.py +++ b/build/android/pylib/device_stats_monitor.py @@ -24,16 +24,15 @@ class DeviceStatsMonitor(object): """ DEVICE_PATH = '/data/local/tmp/device_stats_monitor' - HOST_PATH = os.path.abspath(os.path.join( - constants.CHROME_DIR, 'out', 'Release', 'device_stats_monitor')) PROFILE_PATH = '/sdcard/Download/device_stats_monitor.profile' RESULT_VIEWER_PATH = os.path.abspath(os.path.join( os.path.dirname(os.path.realpath(__file__)), 'device_stats_monitor.html')) - def __init__(self, adb, hz): + def __init__(self, adb, hz, build_type): self._adb = adb - self._adb.PushIfNeeded(DeviceStatsMonitor.HOST_PATH, - DeviceStatsMonitor.DEVICE_PATH) + host_path = os.path.abspath(os.path.join( + constants.CHROME_DIR, 'out', build_type, 'device_stats_monitor')) + self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH) self._hz = hz def Start(self): diff --git a/build/android/pylib/fake_dns.py b/build/android/pylib/fake_dns.py index 4079c31..171df05 100644 --- a/build/android/pylib/fake_dns.py +++ b/build/android/pylib/fake_dns.py @@ -14,12 +14,14 @@ class FakeDns(object): """Wrapper class for the fake_dns tool.""" _FAKE_DNS_PATH = '/data/local/tmp/fake_dns' - def __init__(self, adb): + def __init__(self, adb, build_type): """ Args: adb: the AndroidCommands to use. + build_type: 'Release' or 'Debug'. """ self._adb = adb + self._build_type = build_type self._fake_dns = None self._original_dns = None @@ -30,7 +32,7 @@ class FakeDns(object): subprocess instance connected to the fake_dns process on the device. """ self._adb.PushIfNeeded( - os.path.join(constants.CHROME_DIR, 'out', 'Release', 'fake_dns'), + os.path.join(constants.CHROME_DIR, 'out', self._build_type, 'fake_dns'), FakeDns._FAKE_DNS_PATH) return subprocess.Popen( ['adb', '-s', self._adb._adb.GetSerialNumber(), diff --git a/build/android/pylib/forwarder.py b/build/android/pylib/forwarder.py index 15d4c46..34c3f1e 100644 --- a/build/android/pylib/forwarder.py +++ b/build/android/pylib/forwarder.py @@ -17,7 +17,7 @@ class Forwarder(object): _FORWARDER_PATH = '/data/local/tmp/forwarder' _TIMEOUT_SECS = 30 - def __init__(self, adb, port_pairs, tool, host_name): + def __init__(self, adb, port_pairs, tool, host_name, build_type): """Forwards TCP ports on the device back to the host. Works like adb forward, but in reverse. @@ -31,8 +31,9 @@ class Forwarder(object): DevicePortForHostPort method. tool: Tool class to use to get wrapper, if necessary, for executing the forwarder (see valgrind_tools.py). - host_name: Optional. Address to forward to, must be addressable from the - host machine. Usually this is omitted and loopback is used. + host_name: Address to forward to, must be addressable from the + host machine. Usually use loopback '127.0.0.1'. + build_type: 'Release' or 'Debug'. Raises: Exception on failure to forward the port. @@ -41,7 +42,7 @@ class Forwarder(object): self._host_to_device_port_map = dict() self._process = None adb.PushIfNeeded( - os.path.join(CHROME_DIR, 'out', 'Release', 'forwarder'), + os.path.join(CHROME_DIR, 'out', build_type, 'forwarder'), Forwarder._FORWARDER_PATH) forward_string = ['%d:%d:%s' % (device, host, host_name) for device, host in port_pairs] diff --git a/build/android/pylib/run_java_tests.py b/build/android/pylib/run_java_tests.py index ddf38fe..4b313e7 100644 --- a/build/android/pylib/run_java_tests.py +++ b/build/android/pylib/run_java_tests.py @@ -89,6 +89,7 @@ class TestRunner(BaseTestRunner): Args: options: An options object with the following required attributes: + - build_type: 'Release' or 'Debug'. - install_apk: Re-installs the apk if opted. - save_perf_json: Whether or not to save the JSON file from UI perf tests. @@ -108,12 +109,14 @@ class TestRunner(BaseTestRunner): Raises: FatalTestException: if coverage metadata is not available. """ - BaseTestRunner.__init__(self, device, options.tool, shard_index) + BaseTestRunner.__init__( + self, device, options.tool, shard_index, options.build_type) if not apks: apks = [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)] + self.build_type = options.build_type self.install_apk = options.install_apk self.save_perf_json = options.save_perf_json self.screenshot_failures = options.screenshot_failures @@ -268,8 +271,8 @@ class TestRunner(BaseTestRunner): if self.ports_to_forward: for port in self.ports_to_forward: - self.forwarders.append( - Forwarder(self.adb, [(port, port)], self.tool, '127.0.0.1')) + self.forwarders.append(Forwarder( + self.adb, [(port, port)], self.tool, '127.0.0.1', self.build_type)) self.CopyTestFilesOnce() self.flags.AddFlags(['--enable-test-intents']) diff --git a/build/android/pylib/single_test_runner.py b/build/android/pylib/single_test_runner.py index e243705..c4de68c 100644 --- a/build/android/pylib/single_test_runner.py +++ b/build/android/pylib/single_test_runner.py @@ -31,12 +31,13 @@ class SingleTestRunner(BaseTestRunner): tool: Name of the Valgrind tool. shard_index: index number of the shard on which the test suite will run. dump_debug_info: Whether or not to dump debug information. + build_type: 'Release' or 'Debug'. """ def __init__(self, device, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool_name, - shard_index, dump_debug_info, fast_and_loose): - BaseTestRunner.__init__(self, device, tool_name, shard_index) + shard_index, dump_debug_info, fast_and_loose, build_type): + BaseTestRunner.__init__(self, device, tool_name, shard_index, build_type) self._running_on_emulator = self.device.startswith('emulator') self._gtest_filter = gtest_filter self._test_arguments = test_arguments @@ -48,6 +49,7 @@ class SingleTestRunner(BaseTestRunner): self.dump_debug_info = None self.fast_and_loose = fast_and_loose + logging.warning('Test suite: ' + test_suite) if os.path.splitext(test_suite)[1] == '.apk': self.test_package = TestPackageApk(self.adb, device, test_suite, timeout, rebaseline, performance_test, cleanup_test_files, diff --git a/build/android/pylib/test_options_parser.py b/build/android/pylib/test_options_parser.py index 635e171..43900a7 100644 --- a/build/android/pylib/test_options_parser.py +++ b/build/android/pylib/test_options_parser.py @@ -8,6 +8,20 @@ import constants import optparse import os +_SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out') + + +def AddBuildTypeOption(option_parser): + # TODO(wangxianzhu): Change to Debug when we build Debug by default. + default_build_type = 'Release' + if 'BUILDTYPE' in os.environ: + default_build_type = os.environ['BUILDTYPE'] + option_parser.add_option('--debug', action='store_const', const='Debug', + dest='build_type', default=default_build_type, + help='If set, run test suites under out/Debug.') + option_parser.add_option('--release', action='store_const', const='Release', + dest='build_type', + help='If set, run test suites under out/Release.') def CreateTestRunnerOptionParser(usage=None, default_timeout=60): @@ -37,6 +51,7 @@ def CreateTestRunnerOptionParser(usage=None, default_timeout=60): dest='tool', help='Run the test under a tool ' '(use --tool help to list them)') + AddBuildTypeOption(option_parser) return option_parser @@ -68,7 +83,10 @@ def ParseInstrumentationArgs(args): 'of the result. (Default is 1)')) option_parser.add_option('--test-apk', dest='test_apk', help=('The name of the apk containing the tests ' - '(without the .apk extension).')) + '(without the .apk extension) or for SDK ' + 'builds, the path to the APK from ' + 'out/(Debug|Release) (for example, ' + 'content_shell_test/ContentShellTest-debug).')) option_parser.add_option('--screenshot', dest='screenshot_failures', action='store_true', help='Capture screenshots of test failures') @@ -97,12 +115,13 @@ def ParseInstrumentationArgs(args): elif options.python_only: options.run_java_tests = False - options.test_apk_path = os.path.join(constants.CHROME_DIR, - 'out', 'Release', + options.test_apk_path = os.path.join(_SDK_OUT_DIR, + options.build_type, '%s.apk' % options.test_apk) - options.test_apk_jar_path = os.path.join(constants.CHROME_DIR, - 'out', 'Release', - '%s.jar' % options.test_apk) + options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR, + options.build_type, + '%s.jar' + % options.test_apk) if options.annotation_str: options.annotation = options.annotation_str.split() elif options.test_filter: diff --git a/build/android/run_tests.py b/build/android/run_tests.py index cf0d3cb..a6ffdb1 100755 --- a/build/android/run_tests.py +++ b/build/android/run_tests.py @@ -82,16 +82,19 @@ _TEST_SUITES = ['base_unittests', ] -def FullyQualifiedTestSuites(exe, option_test_suite): +def TestSuiteDir(build_type): + """Return the base directory of test suites.""" + return os.path.abspath(os.path.join(constants.CHROME_DIR, 'out', build_type)) + +def FullyQualifiedTestSuites(exe, option_test_suite, build_type): """Return a fully qualified list Args: exe: if True, use the executable-based test runner. option_test_suite: the test_suite specified as an option. + build_type: 'Release' or 'Debug'. """ - # Assume the test suites are in out/Release. - test_suite_dir = os.path.abspath(os.path.join(constants.CHROME_DIR, - 'out', 'Release')) + test_suite_dir = TestSuiteDir(build_type) if option_test_suite: all_test_suites = [option_test_suite] else: @@ -101,7 +104,7 @@ def FullyQualifiedTestSuites(exe, option_test_suite): qualified_test_suites = [os.path.join(test_suite_dir, t) for t in all_test_suites] else: - # out/Release/$SUITE_apk/$SUITE-debug.apk + # out/(Debug|Release)/$SUITE_apk/$SUITE-debug.apk qualified_test_suites = [os.path.join(test_suite_dir, t + '_apk', t + '-debug.apk') @@ -195,7 +198,8 @@ class TestSharder(BaseTestSharder): def __init__(self, attached_devices, test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, - cleanup_test_files, tool, log_dump_name, fast_and_loose): + cleanup_test_files, tool, log_dump_name, fast_and_loose, + build_type): BaseTestSharder.__init__(self, attached_devices) self.test_suite = test_suite self.test_suite_basename = os.path.basename(test_suite) @@ -208,10 +212,12 @@ class TestSharder(BaseTestSharder): self.tool = tool self.log_dump_name = log_dump_name self.fast_and_loose = fast_and_loose + self.build_type = build_type test = SingleTestRunner(self.attached_devices[0], test_suite, gtest_filter, test_arguments, timeout, rebaseline, performance_test, cleanup_test_files, tool, 0, - not not self.log_dump_name, fast_and_loose) + not not self.log_dump_name, fast_and_loose, + build_type) self.tests = [] if not self.gtest_filter: # No filter has been specified, let's add all tests then. @@ -245,7 +251,8 @@ class TestSharder(BaseTestSharder): test_filter, self.test_arguments, self.timeout, self.rebaseline, self.performance_test, self.cleanup_test_files, self.tool, index, - not not self.log_dump_name, self.fast_and_loose) + not not self.log_dump_name, self.fast_and_loose, + self.build_type) def OnTestsCompleted(self, test_runners, test_results): """Notifies that we completed the tests.""" @@ -256,8 +263,7 @@ class TestSharder(BaseTestSharder): if self.log_dump_name: # Zip all debug info outputs into a file named by log_dump_name. debug_info.GTestDebugInfo.ZipAndCleanResults( - os.path.join(constants.CHROME_DIR, 'out', 'Release', - 'debug_info_dumps'), + os.path.join(TestSuiteDir(self.build_type), 'debug_info_dumps'), self.log_dump_name) @@ -317,7 +323,8 @@ def _RunATestSuite(options): options.timeout, options.rebaseline, options.performance_test, options.cleanup_test_files, options.tool, - options.log_dump, options.fast_and_loose) + options.log_dump, options.fast_and_loose, + options.build_type) test_results = sharder.RunShardedTests() for buildbot_emulator in buildbot_emulators: @@ -355,7 +362,8 @@ def Dispatch(options): xvfb = Xvfb() xvfb.Start() - all_test_suites = FullyQualifiedTestSuites(options.exe, options.test_suite) + all_test_suites = FullyQualifiedTestSuites(options.exe, options.test_suite, + options.build_type) failures = 0 for suite in all_test_suites: options.test_suite = suite @@ -422,6 +430,7 @@ def main(argv): option_parser.add_option('--exe', action='store_true', help='If set, use the exe test runner instead of ' 'the APK.') + options, args = option_parser.parse_args(argv) if len(args) > 1: print 'Unknown argument:', args[1:] diff --git a/build/common.gypi b/build/common.gypi index 3a66b5c..2c4f2c1 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -2048,7 +2048,6 @@ 'debug_optimize%': 's', }, 'cflags': [ - '-fno-ident', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections', |