Add workaround to runtest to build cts dependencies.
BUG 2141242
diff --git a/testrunner/run_command.py b/testrunner/run_command.py
index 79c7ea5..c522e00 100755
--- a/testrunner/run_command.py
+++ b/testrunner/run_command.py
@@ -84,7 +84,7 @@
so.append("ERROR")
error_occurred = True
if pipe.returncode != 0:
- logger.SilentLog("Error: %s returned %d error code" %(cmd,
+ logger.SilentLog("Error: %s returned %s error code" %(cmd,
pipe.returncode))
error_occurred = True
diff --git a/testrunner/runtest.py b/testrunner/runtest.py
index d76399d..e637b71 100755
--- a/testrunner/runtest.py
+++ b/testrunner/runtest.py
@@ -56,6 +56,9 @@
"The runtest script works in two ways. You can query it "
"for a list of tests, or you can launch one or more tests.")
+ # default value for make -jX
+ _DEFAULT_JOBS=4
+
def __init__(self):
# disable logging of timestamp
self._root_path = android_build.GetTop()
@@ -78,6 +81,9 @@
help="To view the list of tests")
parser.add_option("-b", "--skip-build", dest="skip_build", default=False,
action="store_true", help="Skip build - just launch")
+ parser.add_option("-j", "--jobs", dest="make_jobs",
+ metavar="X", default=self._DEFAULT_JOBS,
+ help="Number of make jobs to use when building")
parser.add_option("-n", "--skip_execute", dest="preview", default=False,
action="store_true",
help="Do not execute, just preview commands")
@@ -198,18 +204,31 @@
logger.SilentLog("Building tests...")
target_set = Set()
extra_args_set = Set()
- for test_suite in self._GetTestsToRun():
+ tests = self._GetTestsToRun()
+ for test_suite in tests:
self._AddBuildTarget(test_suite, target_set, extra_args_set)
if target_set:
if self._options.coverage:
coverage.EnableCoverageBuild()
+
+ # hack to build cts dependencies
+ # TODO: remove this when build dependency support added to runtest or
+ # cts dependencies are removed
+ if self._IsCtsTests(tests):
+ # need to use make since these fail building with ONE_SHOT_MAKEFILE
+ cmd=('make -j%s CtsTestStubs android.core.tests.runner' %
+ self._options.make_jobs)
+ logger.Log(cmd)
+ if not self._options.preview:
+ run_command.RunCommand(cmd, return_output=False)
target_build_string = " ".join(list(target_set))
extra_args_string = " ".join(list(extra_args_set))
# mmm cannot be used from python, so perform a similar operation using
# ONE_SHOT_MAKEFILE
- cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files %s' % (
- target_build_string, self._root_path, extra_args_string)
+ cmd = 'ONE_SHOT_MAKEFILE="%s" make -j%s -C "%s" files %s' % (
+ target_build_string, self._options.make_jobs, self._root_path,
+ extra_args_string)
logger.Log(cmd)
if self._options.preview:
@@ -254,6 +273,13 @@
tests.append(test)
return tests
+ def _IsCtsTests(self, test_list):
+ """Check if any cts tests are included in given list of tests to run."""
+ for test in test_list:
+ if test.IsCts():
+ return True
+ return False
+
def RunTests(self):
"""Main entry method - executes the tests according to command line args."""
try:
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index c1362d1..2c4801c 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -137,7 +137,7 @@
<!-- cts tests -->
<test name="cts-permission"
- build_path="cts/tests"
+ build_path="cts/tests/tests/permission"
package="com.android.cts.permission"
runner="android.test.InstrumentationTestRunner"
coverage_target="framework"
@@ -153,44 +153,44 @@
cts="true" />
<test name="cts-process"
- build_path="cts/tests"
+ build_path="cts/tests/tests/process"
package="com.android.cts.process"
coverage_target="framework"
cts="true" />
<test name="cts-api-signature"
- build_path="cts/tests"
+ build_path="cts/tests/SignatureTest"
package="android.tests.sigtest"
runner=".InstrumentationRunner"
cts="true" />
<test name="cts-api-signature-func"
- build_path="cts/tests"
+ build_path="cts/tests/SignatureTest"
package="android.tests.sigtest.tests"
cts="true" />
<test name="cts-apidemos"
- build_path="cts/tests"
+ build_path="cts/tests/ApiDemosReferenceTest"
package="android.apidemos.cts"
coverage_target="ApiDemos"
cts="true" />
<test name="cts-app"
- build_path="cts/tests"
+ build_path="cts/tests/tests/app"
package="com.android.cts.app"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-content"
- build_path="cts/tests"
+ build_path="cts/tests/tests/content"
package="com.android.cts.content"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-database"
- build_path="cts/tests"
+ build_path="cts/tests/tests/database"
package="com.android.cts.database"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
@@ -204,21 +204,21 @@
cts="true" />
<test name="cts-graphics"
- build_path="cts/tests"
+ build_path="cts/tests/tests/graphics"
package="com.android.cts.graphics"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-hardware"
- build_path="cts/tests"
+ build_path="cts/tests/tests/hardware"
package="com.android.cts.hardware"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-location"
- build_path="cts/tests"
+ build_path="cts/tests/tests/location"
package="com.android.cts.location"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
@@ -232,86 +232,86 @@
cts="true" />
<test name="cts-net"
- build_path="cts/tests"
+ build_path="cts/tests/tests/net"
package="com.android.cts.net"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-os"
- build_path="cts/tests"
+ build_path="cts/tests/tests/os"
package="com.android.cts.os"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-perf1"
- build_path="cts/tests"
+ build_path="cts/tests/tests/performance"
package="com.android.cts.performance"
runner="android.test.InstrumentationCtsTestRunner"
cts="true" />
<test name="cts-perf2"
- build_path="cts/tests"
+ build_path="cts/tests/tests/performance2"
package="com.android.cts.performance2"
runner="android.test.InstrumentationCtsTestRunner"
cts="true" />
<test name="cts-perf3"
- build_path="cts/tests"
+ build_path="cts/tests/tests/performance3"
package="com.android.cts.performance3"
runner="android.test.InstrumentationCtsTestRunner"
cts="true" />
<test name="cts-perf4"
- build_path="cts/tests"
+ build_path="cts/tests/tests/performance4"
package="com.android.cts.performance4"
runner="android.test.InstrumentationCtsTestRunner"
cts="true" />
<test name="cts-perf5"
- build_path="cts/tests"
+ build_path="cts/tests/tests/performance5"
package="com.android.cts.performance5"
runner="android.test.InstrumentationCtsTestRunner"
cts="true" />
<test name="cts-provider"
- build_path="cts/tests"
+ build_path="cts/tests/tests/provider"
package="com.android.cts.provider"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-text"
- build_path="cts/tests"
+ build_path="cts/tests/tests/text"
package="com.android.cts.text"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-telephony"
- build_path="cts/tests"
+ build_path="cts/tests/tests/telephony"
package="com.android.cts.telephony"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-util"
- build_path="cts/tests"
+ build_path="cts/tests/tests/util"
package="com.android.cts.util"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-view"
- build_path="cts/tests"
+ build_path="cts/tests/tests/view"
package="com.android.cts.view"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"
cts="true" />
<test name="cts-widget"
- build_path="cts/tests"
+ build_path="cts/tests/tests/widget"
package="com.android.cts.widget"
runner="android.test.InstrumentationCtsTestRunner"
coverage_target="framework"