Add workaround to runtest to build cts dependencies.
BUG 2141242
This commit is contained in:
@@ -84,7 +84,7 @@ def RunOnce(cmd, timeout_time=None, return_output=True):
|
|||||||
so.append("ERROR")
|
so.append("ERROR")
|
||||||
error_occurred = True
|
error_occurred = True
|
||||||
if pipe.returncode != 0:
|
if pipe.returncode != 0:
|
||||||
logger.SilentLog("Error: %s returned %d error code" %(cmd,
|
logger.SilentLog("Error: %s returned %s error code" %(cmd,
|
||||||
pipe.returncode))
|
pipe.returncode))
|
||||||
error_occurred = True
|
error_occurred = True
|
||||||
|
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ class TestRunner(object):
|
|||||||
"The runtest script works in two ways. You can query it "
|
"The runtest script works in two ways. You can query it "
|
||||||
"for a list of tests, or you can launch one or more tests.")
|
"for a list of tests, or you can launch one or more tests.")
|
||||||
|
|
||||||
|
# default value for make -jX
|
||||||
|
_DEFAULT_JOBS=4
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# disable logging of timestamp
|
# disable logging of timestamp
|
||||||
self._root_path = android_build.GetTop()
|
self._root_path = android_build.GetTop()
|
||||||
@@ -78,6 +81,9 @@ class TestRunner(object):
|
|||||||
help="To view the list of tests")
|
help="To view the list of tests")
|
||||||
parser.add_option("-b", "--skip-build", dest="skip_build", default=False,
|
parser.add_option("-b", "--skip-build", dest="skip_build", default=False,
|
||||||
action="store_true", help="Skip build - just launch")
|
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,
|
parser.add_option("-n", "--skip_execute", dest="preview", default=False,
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Do not execute, just preview commands")
|
help="Do not execute, just preview commands")
|
||||||
@@ -198,18 +204,31 @@ class TestRunner(object):
|
|||||||
logger.SilentLog("Building tests...")
|
logger.SilentLog("Building tests...")
|
||||||
target_set = Set()
|
target_set = Set()
|
||||||
extra_args_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)
|
self._AddBuildTarget(test_suite, target_set, extra_args_set)
|
||||||
|
|
||||||
if target_set:
|
if target_set:
|
||||||
if self._options.coverage:
|
if self._options.coverage:
|
||||||
coverage.EnableCoverageBuild()
|
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))
|
target_build_string = " ".join(list(target_set))
|
||||||
extra_args_string = " ".join(list(extra_args_set))
|
extra_args_string = " ".join(list(extra_args_set))
|
||||||
# mmm cannot be used from python, so perform a similar operation using
|
# mmm cannot be used from python, so perform a similar operation using
|
||||||
# ONE_SHOT_MAKEFILE
|
# ONE_SHOT_MAKEFILE
|
||||||
cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files %s' % (
|
cmd = 'ONE_SHOT_MAKEFILE="%s" make -j%s -C "%s" files %s' % (
|
||||||
target_build_string, self._root_path, extra_args_string)
|
target_build_string, self._options.make_jobs, self._root_path,
|
||||||
|
extra_args_string)
|
||||||
logger.Log(cmd)
|
logger.Log(cmd)
|
||||||
|
|
||||||
if self._options.preview:
|
if self._options.preview:
|
||||||
@@ -254,6 +273,13 @@ class TestRunner(object):
|
|||||||
tests.append(test)
|
tests.append(test)
|
||||||
return tests
|
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):
|
def RunTests(self):
|
||||||
"""Main entry method - executes the tests according to command line args."""
|
"""Main entry method - executes the tests according to command line args."""
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ See test_defs.xsd for more information.
|
|||||||
<!-- cts tests -->
|
<!-- cts tests -->
|
||||||
|
|
||||||
<test name="cts-permission"
|
<test name="cts-permission"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/permission"
|
||||||
package="com.android.cts.permission"
|
package="com.android.cts.permission"
|
||||||
runner="android.test.InstrumentationTestRunner"
|
runner="android.test.InstrumentationTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
@@ -153,44 +153,44 @@ See test_defs.xsd for more information.
|
|||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-process"
|
<test name="cts-process"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/process"
|
||||||
package="com.android.cts.process"
|
package="com.android.cts.process"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-api-signature"
|
<test name="cts-api-signature"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/SignatureTest"
|
||||||
package="android.tests.sigtest"
|
package="android.tests.sigtest"
|
||||||
runner=".InstrumentationRunner"
|
runner=".InstrumentationRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-api-signature-func"
|
<test name="cts-api-signature-func"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/SignatureTest"
|
||||||
package="android.tests.sigtest.tests"
|
package="android.tests.sigtest.tests"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-apidemos"
|
<test name="cts-apidemos"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/ApiDemosReferenceTest"
|
||||||
package="android.apidemos.cts"
|
package="android.apidemos.cts"
|
||||||
coverage_target="ApiDemos"
|
coverage_target="ApiDemos"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-app"
|
<test name="cts-app"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/app"
|
||||||
package="com.android.cts.app"
|
package="com.android.cts.app"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-content"
|
<test name="cts-content"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/content"
|
||||||
package="com.android.cts.content"
|
package="com.android.cts.content"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-database"
|
<test name="cts-database"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/database"
|
||||||
package="com.android.cts.database"
|
package="com.android.cts.database"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
@@ -204,21 +204,21 @@ See test_defs.xsd for more information.
|
|||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-graphics"
|
<test name="cts-graphics"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/graphics"
|
||||||
package="com.android.cts.graphics"
|
package="com.android.cts.graphics"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-hardware"
|
<test name="cts-hardware"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/hardware"
|
||||||
package="com.android.cts.hardware"
|
package="com.android.cts.hardware"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-location"
|
<test name="cts-location"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/location"
|
||||||
package="com.android.cts.location"
|
package="com.android.cts.location"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
@@ -232,86 +232,86 @@ See test_defs.xsd for more information.
|
|||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-net"
|
<test name="cts-net"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/net"
|
||||||
package="com.android.cts.net"
|
package="com.android.cts.net"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-os"
|
<test name="cts-os"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/os"
|
||||||
package="com.android.cts.os"
|
package="com.android.cts.os"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-perf1"
|
<test name="cts-perf1"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/performance"
|
||||||
package="com.android.cts.performance"
|
package="com.android.cts.performance"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-perf2"
|
<test name="cts-perf2"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/performance2"
|
||||||
package="com.android.cts.performance2"
|
package="com.android.cts.performance2"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-perf3"
|
<test name="cts-perf3"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/performance3"
|
||||||
package="com.android.cts.performance3"
|
package="com.android.cts.performance3"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-perf4"
|
<test name="cts-perf4"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/performance4"
|
||||||
package="com.android.cts.performance4"
|
package="com.android.cts.performance4"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-perf5"
|
<test name="cts-perf5"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/performance5"
|
||||||
package="com.android.cts.performance5"
|
package="com.android.cts.performance5"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-provider"
|
<test name="cts-provider"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/provider"
|
||||||
package="com.android.cts.provider"
|
package="com.android.cts.provider"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-text"
|
<test name="cts-text"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/text"
|
||||||
package="com.android.cts.text"
|
package="com.android.cts.text"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-telephony"
|
<test name="cts-telephony"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/telephony"
|
||||||
package="com.android.cts.telephony"
|
package="com.android.cts.telephony"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-util"
|
<test name="cts-util"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/util"
|
||||||
package="com.android.cts.util"
|
package="com.android.cts.util"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-view"
|
<test name="cts-view"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/view"
|
||||||
package="com.android.cts.view"
|
package="com.android.cts.view"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
cts="true" />
|
cts="true" />
|
||||||
|
|
||||||
<test name="cts-widget"
|
<test name="cts-widget"
|
||||||
build_path="cts/tests"
|
build_path="cts/tests/tests/widget"
|
||||||
package="com.android.cts.widget"
|
package="com.android.cts.widget"
|
||||||
runner="android.test.InstrumentationCtsTestRunner"
|
runner="android.test.InstrumentationCtsTestRunner"
|
||||||
coverage_target="framework"
|
coverage_target="framework"
|
||||||
|
|||||||
Reference in New Issue
Block a user