Lines Matching refs:self
83 def __init__(self): argument
85 self._root_path = android_build.GetTop()
90 self._re_make_install_path = re.compile(pattern)
92 self._adb = None
93 self._known_tests = None
94 self._options = None
95 self._test_args = None
96 self._tests_to_run = None
98 def _ProcessOptions(self): argument
102 self._TEST_FILE_NAME)
104 parser = optparse.OptionParser(usage=self._RUNTEST_USAGE)
112 metavar="X", default=self._DEFAULT_JOBS,
196 self._options, self._test_args = parser.parse_args()
198 if (not self._options.only_list_tests
199 and not self._options.all_tests
200 and not self._options.continuous_tests
201 and not self._options.suite
202 and not self._options.test_path
203 and len(self._test_args) < 1):
208 self._adb = adb_interface.AdbInterface()
209 if self._options.emulator:
210 self._adb.SetEmulatorTarget()
211 elif self._options.device:
212 self._adb.SetDeviceTarget()
213 elif self._options.serial is not None:
214 self._adb.SetTargetSerial(self._options.serial)
215 if self._options.verbose:
218 if self._options.coverage_target_path:
219 self._options.coverage = True
221 self._known_tests = self._ReadTests()
223 self._options.host_lib_path = android_build.GetHostLibraryPath()
224 self._options.test_data_path = android_build.GetTestAppPath()
226 def _ReadTests(self): argument
237 if not self._options.test_path:
238 core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH)
242 vendor_tests_pattern = os.path.join(self._root_path,
243 self._VENDOR_TEST_PATH)
247 if os.path.isfile(self._options.user_tests_file):
248 known_tests.Parse(self._options.user_tests_file)
253 def _DumpTests(self): argument
258 for test in self._known_tests:
261 print "\nSee %s for more information" % self._TEST_FILE_NAME
263 def _DoBuild(self): argument
265 tests = self._GetTestsToRun()
268 self._DoPermissionAwareBuild(tests, False)
271 self._DoPermissionAwareBuild(tests, True)
273 def _DoPermissionAwareBuild(self, tests, test_requires_permissions): argument
278 self._DoFullBuild(tests, test_requires_permissions)
285 self._AddBuildTarget(test_suite, target_tree, extra_args_set)
287 if not self._options.preview:
288 self._adb.EnableAdbRoot()
293 if self._options.coverage:
315 target_build_string, self._options.make_jobs, self._root_path,
319 self._options.make_jobs, self._root_path, extra_args_string, " ".join(mmma_goals))
322 if not self._options.preview:
329 logger.Log("mmma -j%s %s" %(self._options.make_jobs, target_dir_build_string))
336 filter_re = re.compile(self._options.filter_re) if self._options.filter_re else None
338 self._DoInstall(output, test_requires_permissions, filter_re=filter_re)
340 def _DoInstall(self, make_output, test_requires_permissions, filter_re=None): argument
352 m = self._RE_MAKE_INSTALL.match(line)
361 abs_install_path = os.path.join(self._root_path, install_path)
363 if test_requires_permissions and not self._options.skip_permissions:
365 if self._options.user:
366 extra_flags += " --user " + self._options.user
368 logger.Log(self._adb.Install(abs_install_path, extra_flags))
370 self._PushInstallFileToDevice(install_path)
372 def _PushInstallFileToDevice(self, install_path): argument
373 m = self._re_make_install_path.match(install_path)
378 self._adb.SendShellCommand("mkdir -p %s" % remote_dir)
379 abs_install_path = os.path.join(self._root_path, install_path)
381 self._adb.Push(abs_install_path, remote_path)
385 def _DoFullBuild(self, tests, test_requires_permissions): argument
400 cmd = ('make -j%s %s' % (self._options.make_jobs,
403 if not self._options.preview:
405 os.chdir(self._root_path)
409 self._DoInstall(output, test_requires_permissions)
411 def _AddBuildTarget(self, test_suite, target_tree, extra_args_set): argument
414 if self._AddBuildTargetPath(build_dir, target_tree):
416 for path in test_suite.GetBuildDependencies(self._options):
417 self._AddBuildTargetPath(path, target_tree)
419 def _AddBuildTargetPath(self, build_dir, target_tree): argument
425 def _GetTestsToRun(self): argument
427 if self._tests_to_run:
428 return self._tests_to_run
430 self._tests_to_run = []
431 if self._options.all_tests:
432 self._tests_to_run = self._known_tests.GetTests()
433 elif self._options.continuous_tests:
434 self._tests_to_run = self._known_tests.GetContinuousTests()
435 elif self._options.suite:
436 self._tests_to_run = \
437 self._known_tests.GetTestsInSuite(self._options.suite)
438 elif self._options.test_path:
440 self._tests_to_run = walker.FindTests(self._options.test_path)
442 for name in self._test_args:
443 test = self._known_tests.GetTest(name)
446 self._DumpTests()
448 self._tests_to_run.append(test)
449 return self._tests_to_run
451 def _TurnOffVerifier(self, test_list): argument
466 output = self._adb.SendShellCommand("cat /data/local.prop")
467 if not self._DALVIK_VERIFIER_OFF_PROP in output:
470 old_prop_value = self._adb.SendShellCommand("getprop %s" \
471 %(self._DALVIK_VERIFIER_PROP))
475 new_prop_value = "%s %s" %(self._DALVIK_VERIFIER_OFF_VALUE, old_prop_value)
479 %(self._DALVIK_VERIFIER_PROP, new_prop_value))
480 if not self._options.preview:
481 self._adb.SendShellCommand("setprop %s '%s'" \
482 %(self._DALVIK_VERIFIER_PROP, new_prop_value))
486 new_prop_assignment = "%s = %s" %(self._DALVIK_VERIFIER_PROP, new_prop_value)
487 if self._options.preview:
493 self._adb.SendShellCommand("\"echo %s >> /data/local.prop\""
497 self._ChmodRuntimeReset()
498 elif not self._options.preview:
500 permout = self._adb.SendShellCommand("ls -l /data/local.prop")
503 self._ChmodRuntimeReset()
505 def _ChmodRuntimeReset(self): argument
509 if not self._options.preview:
510 self._adb.SendShellCommand("chmod 644 /data/local.prop")
512 self._adb.RuntimeReset(preview_only=self._options.preview)
514 if not self._options.preview:
515 self._adb.EnableAdbRoot()
518 def RunTests(self): argument
522 self._ProcessOptions()
523 if self._options.only_list_tests:
524 self._DumpTests()
527 if not self._options.skip_build:
528 self._DoBuild()
530 if self._options.build_install_only:
534 for test_suite in self._GetTestsToRun():
536 test_suite.Run(self._options, self._adb)