am 1cd61741: Add support to run only tests in a given java package.

Merge commit '1cd617413095758758beef03e3f45d26e9ad7751' into eclair-mr2

* commit '1cd617413095758758beef03e3f45d26e9ad7751':
  Add support to run only tests in a given java package.
This commit is contained in:
Brett Chabot
2009-10-22 10:48:14 -07:00
committed by Android Git Automerger

View File

@@ -41,6 +41,7 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
self._runner_name = self.DEFAULT_RUNNER self._runner_name = self.DEFAULT_RUNNER
self._class_name = None self._class_name = None
self._target_name = None self._target_name = None
self._java_package = None
def GetPackageName(self): def GetPackageName(self):
return self._package_name return self._package_name
@@ -63,6 +64,14 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
self._class_name = class_name self._class_name = class_name
return self return self
def GetJavaPackageFilter(self):
return self._java_package
def SetJavaPackageFilter(self, java_package_name):
"""Configure the suite to only run tests in given java package."""
self._java_package = java_package_name
return self
def GetTargetName(self): def GetTargetName(self):
"""Retrieve module that this test is targeting. """Retrieve module that this test is targeting.
@@ -102,11 +111,18 @@ class InstrumentationTestSuite(test_suite.AbstractTestSuite):
if options.test_method is not None: if options.test_method is not None:
test_class = "%s#%s" % (test_class, options.test_method) test_class = "%s#%s" % (test_class, options.test_method)
test_package = self.GetJavaPackageFilter()
if options.test_package:
test_package = options.test_package
if test_class and test_package:
logger.Log('Error: both class and java package options are specified')
instrumentation_args = {} instrumentation_args = {}
if test_class is not None: if test_class is not None:
instrumentation_args["class"] = test_class instrumentation_args["class"] = test_class
if options.test_package: if test_package:
instrumentation_args["package"] = options.test_package instrumentation_args["package"] = test_package
if options.test_size: if options.test_size:
instrumentation_args["size"] = options.test_size instrumentation_args["size"] = options.test_size
if options.wait_for_debugger: if options.wait_for_debugger: