diff options
| author | Brett Chabot <brettchabot@google.com> | 2012-10-24 15:55:23 -0700 |
|---|---|---|
| committer | Brett Chabot <brettchabot@google.com> | 2012-10-24 15:58:21 -0700 |
| commit | f0afa30c7f77ae091887a9f567258c9f3f2bee9b (patch) | |
| tree | a308de9dbcd0261d92726b2c744688ad4e8d1548 /testrunner | |
| parent | d368fe3c104dcde2361a8d221d855ee65f7c3224 (diff) | |
Change runtest --path to only run first instrumentation found.
Bug 7311518
Change-Id: I208c78c73b821389d942700afe8ea7073c41e8d4
Diffstat (limited to 'testrunner')
| -rw-r--r-- | testrunner/test_defs/instrumentation_test.py | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py index 092a77322..d3c5c9fc9 100644 --- a/testrunner/test_defs/instrumentation_test.py +++ b/testrunner/test_defs/instrumentation_test.py @@ -252,25 +252,29 @@ class InstrumentationTestFactory(test_suite.AbstractTestFactory): (android_manifest.AndroidManifest.FILENAME, self.GetBuildPath())) return tests - - for instr_name in manifest_parser.GetInstrumentationNames(): - pkg_name = manifest_parser.GetPackageName() - if instr_name.find(".") < 0: - instr_name = "." + instr_name - logger.SilentLog('Found instrumentation %s/%s' % (pkg_name, instr_name)) - suite = InstrumentationTestSuite() - suite.SetPackageName(pkg_name) - suite.SetBuildPath(self.GetBuildPath()) - suite.SetRunnerName(instr_name) - suite.SetName(pkg_name) - suite.SetClassName(class_name_arg) - suite.SetJavaPackageFilter(java_package_name) - # this is a bit of a hack, assume if 'com.android.cts' is in - # package name, this is a cts test - # this logic can be removed altogether when cts tests no longer require - # custom build steps - if suite.GetPackageName().startswith('com.android.cts'): - suite.SetSuite('cts') + elif len(instrs) > 1: + logger.Log("Found multiple instrumentation declarations in %s/%s." + "Only using first declared." % + (self.GetBuildPath(), + android_manifest.AndroidManifest.FILENAME)) + instr_name = manifest_parser.GetInstrumentationNames()[0] + pkg_name = manifest_parser.GetPackageName() + if instr_name.find(".") < 0: + instr_name = "." + instr_name + logger.SilentLog('Found instrumentation %s/%s' % (pkg_name, instr_name)) + suite = InstrumentationTestSuite() + suite.SetPackageName(pkg_name) + suite.SetBuildPath(self.GetBuildPath()) + suite.SetRunnerName(instr_name) + suite.SetName(pkg_name) + suite.SetClassName(class_name_arg) + suite.SetJavaPackageFilter(java_package_name) + # this is a bit of a hack, assume if 'com.android.cts' is in + # package name, this is a cts test + # this logic can be removed altogether when cts tests no longer require + # custom build steps + if suite.GetPackageName().startswith('com.android.cts'): + suite.SetSuite('cts') tests.append(suite) return tests |
