summaryrefslogtreecommitdiffstats
path: root/testrunner
diff options
context:
space:
mode:
authorBrett Chabot <brettchabot@android.com>2010-07-29 15:27:30 -0700
committerBrett Chabot <brettchabot@android.com>2010-07-29 16:00:53 -0700
commit12c6d3fb6819bef13bbccd33ab46090b416a0cd4 (patch)
treea9b0c07a22b30a840a97832ffb8cfae961e13eab /testrunner
parent32553f5291b1e0c5363db8bd7f280037f4f600e2 (diff)
downloadandroid_development-12c6d3fb6819bef13bbccd33ab46090b416a0cd4.tar.gz
android_development-12c6d3fb6819bef13bbccd33ab46090b416a0cd4.tar.bz2
android_development-12c6d3fb6819bef13bbccd33ab46090b416a0cd4.zip
Make runtest --path smarter when choosing path to build.
The command 'runtest --path <path to parent folder>' is intended to find and build all tests contained within that parent folder. However, the runtest logic was flawed in that it assumed building a parent folder's Android.mk file would build all sub-directories. This commit changes runtest to explictly look for the rule to build sub-dir makefiles when creating the set of dirs to build. Change-Id: Ia7f2172c1be79be8589be5f435fc4fb32569c994
Diffstat (limited to 'testrunner')
-rwxr-xr-xtestrunner/test_defs/test_walker.py31
1 files changed, 23 insertions, 8 deletions
diff --git a/testrunner/test_defs/test_walker.py b/testrunner/test_defs/test_walker.py
index 06c4e6d5a..4ef6923a7 100755
--- a/testrunner/test_defs/test_walker.py
+++ b/testrunner/test_defs/test_walker.py
@@ -116,7 +116,8 @@ class TestWalker(object):
Args:
path: absolute file system path to check
tests: current list of found tests
- build_path: the parent directory where Android.mk was found
+ build_path: the parent directory where Android.mk that builds sub-folders
+ was found
Returns:
updated list of tests
@@ -124,17 +125,31 @@ class TestWalker(object):
if not os.path.isdir(path):
return tests
filenames = os.listdir(path)
+ if filenames.count(android_manifest.AndroidManifest.FILENAME):
+ # found a manifest! now parse it to find the test definition(s)
+ manifest = android_manifest.AndroidManifest(app_path=path)
+ if not build_path:
+ # haven't found a parent makefile which builds this dir. Use current
+ # dir as build path
+ tests.extend(self._CreateSuitesFromManifest(
+ manifest, self._MakePathRelativeToBuild(path)))
+ else:
+ tests.extend(self._CreateSuitesFromManifest(manifest, build_path))
# Try to build as much of original path as possible, so
- # keep track of upper-most parent directory where Android.mk was found
+ # keep track of upper-most parent directory where Android.mk was found that
+ # has rule to build sub-directory makefiles
# this is also necessary in case of overlapping tests
# ie if a test exists at 'foo' directory and 'foo/sub', attempting to
# build both 'foo' and 'foo/sub' will fail.
- if not build_path and filenames.count(android_mk.AndroidMK.FILENAME):
- build_path = self._MakePathRelativeToBuild(path)
- if filenames.count(android_manifest.AndroidManifest.FILENAME):
- # found a manifest! now parse it to find the test definition(s)
- manifest = android_manifest.AndroidManifest(app_path=path)
- tests.extend(self._CreateSuitesFromManifest(manifest, build_path))
+ if filenames.count(android_mk.AndroidMK.FILENAME):
+ android_mk_parser = android_mk.AndroidMK(app_path=path)
+ if android_mk_parser.HasInclude('call all-makefiles-under,$(LOCAL_PATH)'):
+ # found rule to build sub-directories. The parent path can be used,
+ # or if not set, use current path
+ if not build_path:
+ build_path = self._MakePathRelativeToBuild(path)
+ else:
+ build_path = None
for filename in filenames:
self._FindSubTests(os.path.join(path, filename), tests, build_path)
return tests