• Home
  • Raw
  • Download

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,
200 self._options, self._test_args = parser.parse_args()
202 if (not self._options.only_list_tests
203 and not self._options.all_tests
204 and not self._options.continuous_tests
205 and not self._options.suite
206 and not self._options.test_path
207 and len(self._test_args) < 1):
212 self._adb = adb_interface.AdbInterface()
213 if self._options.emulator:
214 self._adb.SetEmulatorTarget()
215 elif self._options.device:
216 self._adb.SetDeviceTarget()
217 elif self._options.serial is not None:
218 self._adb.SetTargetSerial(self._options.serial)
219 if self._options.verbose:
222 if self._options.coverage_target_path:
223 self._options.coverage = True
225 self._known_tests = self._ReadTests()
227 self._options.host_lib_path = android_build.GetHostLibraryPath()
228 self._options.test_data_path = android_build.GetTestAppPath()
230 def _ReadTests(self): argument
241 if not self._options.test_path:
242 core_test_path = os.path.join(self._root_path, self._CORE_TEST_PATH)
246 vendor_tests_pattern = os.path.join(self._root_path,
247 self._VENDOR_TEST_PATH)
251 if os.path.isfile(self._options.user_tests_file):
252 known_tests.Parse(self._options.user_tests_file)
257 def _DumpTests(self): argument
262 for test in self._known_tests:
265 print "\nSee %s for more information" % self._TEST_FILE_NAME
267 def _DoBuild(self): argument
269 tests = self._GetTestsToRun()
272 self._DoPermissionAwareBuild(tests, False)
275 self._DoPermissionAwareBuild(tests, True)
277 def _DoPermissionAwareBuild(self, tests, test_requires_permissions): argument
282 self._DoFullBuild(tests, test_requires_permissions)
289 self._AddBuildTarget(test_suite, target_tree, extra_args_set)
291 if not self._options.preview:
292 self._adb.EnableAdbRoot()
297 if self._options.coverage:
319 target_build_string, self._options.make_jobs, self._root_path,
323 self._options.make_jobs, self._root_path, extra_args_string, " ".join(mmma_goals))
326 if not self._options.preview:
333 logger.Log("mmma -j%s %s" %(self._options.make_jobs, target_dir_build_string))
340 filter_re = re.compile(self._options.filter_re) if self._options.filter_re else None
342 self._DoInstall(output, test_requires_permissions, filter_re=filter_re)
344 def _DoInstall(self, make_output, test_requires_permissions, filter_re=None): argument
356 m = self._RE_MAKE_INSTALL.match(line)
365 abs_install_path = os.path.join(self._root_path, install_path)
367 if test_requires_permissions and not self._options.skip_permissions:
369 if self._options.user:
370 extra_flags += " --user " + self._options.user
372 logger.Log(self._adb.Install(abs_install_path, extra_flags))
374 self._PushInstallFileToDevice(install_path)
376 def _PushInstallFileToDevice(self, install_path): argument
377 m = self._re_make_install_path.match(install_path)
382 self._adb.SendShellCommand("mkdir -p %s" % remote_dir)
383 abs_install_path = os.path.join(self._root_path, install_path)
385 self._adb.Push(abs_install_path, remote_path)
389 def _DoFullBuild(self, tests, test_requires_permissions): argument
404 cmd = ('make -j%s %s' % (self._options.make_jobs,
407 if not self._options.preview:
409 os.chdir(self._root_path)
413 self._DoInstall(output, test_requires_permissions)
415 def _AddBuildTarget(self, test_suite, target_tree, extra_args_set): argument
418 if self._AddBuildTargetPath(build_dir, target_tree):
420 for path in test_suite.GetBuildDependencies(self._options):
421 self._AddBuildTargetPath(path, target_tree)
423 def _AddBuildTargetPath(self, build_dir, target_tree): argument
429 def _GetTestsToRun(self): argument
431 if self._tests_to_run:
432 return self._tests_to_run
434 self._tests_to_run = []
435 if self._options.all_tests:
436 self._tests_to_run = self._known_tests.GetTests()
437 elif self._options.continuous_tests:
438 self._tests_to_run = self._known_tests.GetContinuousTests()
439 elif self._options.suite:
440 self._tests_to_run = \
441 self._known_tests.GetTestsInSuite(self._options.suite)
442 elif self._options.test_path:
444 self._tests_to_run = walker.FindTests(self._options.test_path)
446 for name in self._test_args:
447 test = self._known_tests.GetTest(name)
450 self._DumpTests()
452 self._tests_to_run.append(test)
453 return self._tests_to_run
455 def _TurnOffVerifier(self, test_list): argument
470 output = self._adb.SendShellCommand("cat /data/local.prop")
471 if not self._DALVIK_VERIFIER_OFF_PROP in output:
474 old_prop_value = self._adb.SendShellCommand("getprop %s" \
475 %(self._DALVIK_VERIFIER_PROP))
479 new_prop_value = "%s %s" %(self._DALVIK_VERIFIER_OFF_VALUE, old_prop_value)
483 %(self._DALVIK_VERIFIER_PROP, new_prop_value))
484 if not self._options.preview:
485 self._adb.SendShellCommand("setprop %s '%s'" \
486 %(self._DALVIK_VERIFIER_PROP, new_prop_value))
490 new_prop_assignment = "%s = %s" %(self._DALVIK_VERIFIER_PROP, new_prop_value)
491 if self._options.preview:
497 self._adb.SendShellCommand("\"echo %s >> /data/local.prop\""
501 self._ChmodRuntimeReset()
502 elif not self._options.preview:
504 permout = self._adb.SendShellCommand("ls -l /data/local.prop")
507 self._ChmodRuntimeReset()
509 def _ChmodRuntimeReset(self): argument
513 if not self._options.preview:
514 self._adb.SendShellCommand("chmod 644 /data/local.prop")
516 self._adb.RuntimeReset(preview_only=self._options.preview)
518 if not self._options.preview:
519 self._adb.EnableAdbRoot()
522 def RunTests(self): argument
526 self._ProcessOptions()
527 if self._options.only_list_tests:
528 self._DumpTests()
531 if not self._options.skip_build:
532 self._DoBuild()
534 if self._options.build_install_only:
538 for test_suite in self._GetTestsToRun():
540 test_suite.Run(self._options, self._adb)