diff options
| author | Brett Chabot <brettchabot@android.com> | 2011-08-01 16:11:43 -0700 |
|---|---|---|
| committer | Brett Chabot <brettchabot@android.com> | 2011-08-01 16:30:37 -0700 |
| commit | b0fd2cf9421122462eee3263d81580a21ef2ce22 (patch) | |
| tree | 987257b46d1b8ff3b7c1d2039fa9bd15704c9673 /testrunner | |
| parent | c77b8ff6ace4d3cfbb855979535966e78791ee90 (diff) | |
| download | android_development-b0fd2cf9421122462eee3263d81580a21ef2ce22.tar.gz android_development-b0fd2cf9421122462eee3263d81580a21ef2ce22.tar.bz2 android_development-b0fd2cf9421122462eee3263d81580a21ef2ce22.zip | |
Fix runtest --path for package-private frameworks tests.
A recent change to runtest resulted in absolute paths incorrectly
being used for a tests build path. This broke the special logic
for frameworks/base tests, since it assumed relative build paths.
Change build paths back to relative paths.
Bug 5105885
Change-Id: I83a26be25294d501cca73eb1b88a7364131b2caf
Diffstat (limited to 'testrunner')
| -rw-r--r-- | testrunner/test_defs/gtest.py | 4 | ||||
| -rw-r--r-- | testrunner/test_defs/instrumentation_test.py | 4 | ||||
| -rw-r--r-- | testrunner/test_defs/test_suite.py | 11 | ||||
| -rwxr-xr-x | testrunner/test_defs/test_walker.py | 18 |
4 files changed, 18 insertions, 19 deletions
diff --git a/testrunner/test_defs/gtest.py b/testrunner/test_defs/gtest.py index 7de674b61..094ceea1d 100644 --- a/testrunner/test_defs/gtest.py +++ b/testrunner/test_defs/gtest.py @@ -59,9 +59,9 @@ class GTestSuite(test_suite.AbstractTestSuite): class GTestFactory(test_suite.AbstractTestFactory): - def __init__(self, test_root_path, upstream_build_path=None): + def __init__(self, test_root_path, build_path): test_suite.AbstractTestFactory.__init__(self, test_root_path, - upstream_build_path=upstream_build_path) + build_path) def CreateTests(self, sub_tests_path=None): """Create tests found in sub_tests_path. diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py index 6f82456b3..ede7ceb26 100644 --- a/testrunner/test_defs/instrumentation_test.py +++ b/testrunner/test_defs/instrumentation_test.py @@ -213,9 +213,9 @@ def HasInstrumentationTest(path): class InstrumentationTestFactory(test_suite.AbstractTestFactory): """A factory for creating InstrumentationTestSuites""" - def __init__(self, test_root_path, upstream_build_path=None): + def __init__(self, test_root_path, build_path): test_suite.AbstractTestFactory.__init__(self, test_root_path, - upstream_build_path=upstream_build_path) + build_path) def CreateTests(self, sub_tests_path=None): """Create tests found in test_path. diff --git a/testrunner/test_defs/test_suite.py b/testrunner/test_defs/test_suite.py index 20f96297c..d0bd9eef7 100644 --- a/testrunner/test_defs/test_suite.py +++ b/testrunner/test_defs/test_suite.py @@ -109,19 +109,16 @@ class AbstractTestSuite(object): class AbstractTestFactory(object): """generic test suite factory.""" - def __init__(self, test_root_path, upstream_build_path=None): + def __init__(self, test_root_path, build_path): """Creates a test suite factory. Args: test_root_path: the filesystem path to the tests build directory - upstream_build_path: optional filesystem path for the directory - to build when running tests. If unspecified, will use test_root_path + upstream_build_path: filesystem path for the directory + to build when running tests, relative to the source tree root. """ self._test_root_path = test_root_path - if upstream_build_path: - self._build_path = upstream_build_path - else: - self._build_path = self._test_root_path + self._build_path = build_path def GetBuildPath(self): return self._build_path diff --git a/testrunner/test_defs/test_walker.py b/testrunner/test_defs/test_walker.py index 298912518..572f8b6a4 100755 --- a/testrunner/test_defs/test_walker.py +++ b/testrunner/test_defs/test_walker.py @@ -132,11 +132,12 @@ class TestWalker(object): return tests android_mk_parser = android_mk.CreateAndroidMK(path) if android_mk_parser: + build_rel_path = self._MakePathRelativeToBuild(path) if not upstream_build_path: # haven't found a parent makefile which builds this dir. Use current # dir as build path tests.extend(self._CreateSuites( - android_mk_parser, path, self._MakePathRelativeToBuild(path))) + android_mk_parser, path, build_rel_path)) else: tests.extend(self._CreateSuites(android_mk_parser, path, upstream_build_path)) @@ -174,7 +175,7 @@ class TestWalker(object): else: return [] - def _GetTestFactory(self, android_mk_parser, path, upstream_build_path=None): + def _GetTestFactory(self, android_mk_parser, path, build_path): """Get the test factory for given makefile. If given path is a valid tests build path, will return the TestFactory @@ -183,17 +184,17 @@ class TestWalker(object): Args: android_mk_parser: the android mk to evaluate path: the filesystem path of the makefile - upstream_build_path: optional filesystem path for the directory - to build when running tests. If unspecified, will use path + build_path: filesystem path for the directory + to build when running tests, relative to source root. Returns: the TestFactory or None if path is not a valid tests build path """ if android_mk_parser.HasGTest(): - return gtest.GTestFactory(path, upstream_build_path=upstream_build_path) + return gtest.GTestFactory(path, build_path) elif instrumentation_test.HasInstrumentationTest(path): return instrumentation_test.InstrumentationTestFactory(path, - upstream_build_path=upstream_build_path) + build_path) else: # somewhat unusual, but will continue searching logger.SilentLog('Found makefile at %s, but did not detect any tests.' @@ -215,7 +216,8 @@ class TestWalker(object): """ android_mk_parser = android_mk.CreateAndroidMK(path) if android_mk_parser: - return self._GetTestFactory(android_mk_parser, path) + build_path = self._MakePathRelativeToBuild(path) + return self._GetTestFactory(android_mk_parser, path, build_path) else: return None @@ -251,7 +253,7 @@ class TestWalker(object): the list of tests created """ factory = self._GetTestFactory(android_mk_parser, path, - upstream_build_path=upstream_build_path) + build_path=upstream_build_path) if factory: return factory.CreateTests(path) else: |
