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 /build/android/pylib | |
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
Diffstat (limited to 'build/android/pylib')
-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 |
7 files changed, 53 insertions, 25 deletions
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: |