Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(26)

Side by Side Diff: build/android/pylib/instrumentation/test_runner.py

Issue 107113006: [Android] Make cmdline_file argument to FlagChanger mandatory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/flag_changer.py ('k') | build/android/pylib/uiautomator/test_runner.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """Class for running instrumentation tests on a single device.""" 5 """Class for running instrumentation tests on a single device."""
6 6
7 import logging 7 import logging
8 import os 8 import os
9 import re 9 import re
10 import sys 10 import sys
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 75
76 self.options = test_options 76 self.options = test_options
77 self.test_pkg = test_pkg 77 self.test_pkg = test_pkg
78 self.coverage_dir = test_options.coverage_dir 78 self.coverage_dir = test_options.coverage_dir
79 # Use the correct command line file for the package under test. 79 # Use the correct command line file for the package under test.
80 cmdline_file = [a.cmdline_file for a in constants.PACKAGE_INFO.itervalues() 80 cmdline_file = [a.cmdline_file for a in constants.PACKAGE_INFO.itervalues()
81 if a.test_package == self.test_pkg.GetPackageName()] 81 if a.test_package == self.test_pkg.GetPackageName()]
82 assert len(cmdline_file) < 2, 'Multiple packages have the same test package' 82 assert len(cmdline_file) < 2, 'Multiple packages have the same test package'
83 if len(cmdline_file) and cmdline_file[0]: 83 if len(cmdline_file) and cmdline_file[0]:
84 self.flags = flag_changer.FlagChanger(self.adb, cmdline_file[0]) 84 self.flags = flag_changer.FlagChanger(self.adb, cmdline_file[0])
85 if additional_flags:
86 self.flags.AddFlags(additional_flags)
85 else: 87 else:
86 self.flags = flag_changer.FlagChanger(self.adb) 88 self.flags = None
navabi 2013/12/19 22:51:17 Is it ok that this is now None? Is there anywhere
frankf 2013/12/20 20:22:17 Yea, these are all the instances. On 2013/12/19 2
87 if additional_flags:
88 self.flags.AddFlags(additional_flags)
89 89
90 #override 90 #override
91 def InstallTestPackage(self): 91 def InstallTestPackage(self):
92 self.test_pkg.Install(self.adb) 92 self.test_pkg.Install(self.adb)
93 93
94 #override 94 #override
95 def PushDataDeps(self): 95 def PushDataDeps(self):
96 # TODO(frankf): Implement a general approach for copying/installing 96 # TODO(frankf): Implement a general approach for copying/installing
97 # once across test runners. 97 # once across test runners.
98 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False): 98 if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 self.device) 147 self.device)
148 else: 148 else:
149 if self.adb.SetJavaAssertsEnabled(True): 149 if self.adb.SetJavaAssertsEnabled(True):
150 self.adb.Reboot(full_reboot=False) 150 self.adb.Reboot(full_reboot=False)
151 151
152 # We give different default value to launch HTTP server based on shard index 152 # We give different default value to launch HTTP server based on shard index
153 # because it may have race condition when multiple processes are trying to 153 # because it may have race condition when multiple processes are trying to
154 # launch lighttpd with same port at same time. 154 # launch lighttpd with same port at same time.
155 http_server_ports = self.LaunchTestHttpServer( 155 http_server_ports = self.LaunchTestHttpServer(
156 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port) 156 os.path.join(constants.DIR_SOURCE_ROOT), self._lighttp_port)
157 self.flags.AddFlags(['--disable-fre', '--enable-test-intents']) 157 if self.flags:
158 self.flags.AddFlags(['--disable-fre', '--enable-test-intents'])
158 159
159 def TearDown(self): 160 def TearDown(self):
160 """Cleans up the test harness and saves outstanding data from test run.""" 161 """Cleans up the test harness and saves outstanding data from test run."""
161 self.flags.Restore() 162 if self.flags:
163 self.flags.Restore()
162 super(TestRunner, self).TearDown() 164 super(TestRunner, self).TearDown()
163 165
164 def TestSetup(self, test): 166 def TestSetup(self, test):
165 """Sets up the test harness for running a particular test. 167 """Sets up the test harness for running a particular test.
166 168
167 Args: 169 Args:
168 test: The name of the test that will be run. 170 test: The name of the test that will be run.
169 """ 171 """
170 self.SetupPerfMonitoringIfNeeded(test) 172 self.SetupPerfMonitoringIfNeeded(test)
171 self._SetupIndividualTestTimeoutScale(test) 173 self._SetupIndividualTestTimeoutScale(test)
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 duration_ms = 0 370 duration_ms = 0
369 message = str(e) 371 message = str(e)
370 if not message: 372 if not message:
371 message = 'No information.' 373 message = 'No information.'
372 results.AddResult(test_result.InstrumentationTestResult( 374 results.AddResult(test_result.InstrumentationTestResult(
373 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms, 375 test, base_test_result.ResultType.CRASH, start_date_ms, duration_ms,
374 log=message)) 376 log=message))
375 raw_result = None 377 raw_result = None
376 self.TestTeardown(test, raw_result) 378 self.TestTeardown(test, raw_result)
377 return (results, None if results.DidRunPass() else test) 379 return (results, None if results.DidRunPass() else test)
OLDNEW
« no previous file with comments | « build/android/pylib/flag_changer.py ('k') | build/android/pylib/uiautomator/test_runner.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698