Runtest support for tests that need 'make' not 'mmm' to build.
Change-Id: I0508db2578826249f9bf4756d5adc6f95e841231
This commit is contained in:
@@ -222,9 +222,12 @@ class TestRunner(object):
|
|||||||
|
|
||||||
def _DoBuild(self):
|
def _DoBuild(self):
|
||||||
logger.SilentLog("Building tests...")
|
logger.SilentLog("Building tests...")
|
||||||
|
|
||||||
|
tests = self._GetTestsToRun()
|
||||||
|
self._DoFullBuild(tests)
|
||||||
|
|
||||||
target_set = Set()
|
target_set = Set()
|
||||||
extra_args_set = Set()
|
extra_args_set = Set()
|
||||||
tests = self._GetTestsToRun()
|
|
||||||
for test_suite in tests:
|
for test_suite in tests:
|
||||||
self._AddBuildTarget(test_suite, target_set, extra_args_set)
|
self._AddBuildTarget(test_suite, target_set, extra_args_set)
|
||||||
|
|
||||||
@@ -232,21 +235,8 @@ class TestRunner(object):
|
|||||||
if self._options.coverage:
|
if self._options.coverage:
|
||||||
coverage.EnableCoverageBuild()
|
coverage.EnableCoverageBuild()
|
||||||
|
|
||||||
# hack to build cts dependencies
|
target_build_string = ' '.join(list(target_set))
|
||||||
# TODO: remove this when build dependency support added to runtest or
|
extra_args_string = ' '.join(list(extra_args_set))
|
||||||
# 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:
|
|
||||||
old_dir = os.getcwd()
|
|
||||||
os.chdir(self._root_path)
|
|
||||||
run_command.RunCommand(cmd, return_output=False)
|
|
||||||
os.chdir(old_dir)
|
|
||||||
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
|
# mmm cannot be used from python, so perform a similar operation using
|
||||||
# ONE_SHOT_MAKEFILE
|
# ONE_SHOT_MAKEFILE
|
||||||
cmd = 'ONE_SHOT_MAKEFILE="%s" make -j%s -C "%s" files %s' % (
|
cmd = 'ONE_SHOT_MAKEFILE="%s" make -j%s -C "%s" files %s' % (
|
||||||
@@ -263,12 +253,43 @@ class TestRunner(object):
|
|||||||
logger.Log("Syncing to device...")
|
logger.Log("Syncing to device...")
|
||||||
self._adb.Sync()
|
self._adb.Sync()
|
||||||
|
|
||||||
|
def _DoFullBuild(self, tests):
|
||||||
|
"""If necessary, run a full 'make' command for the tests that need it."""
|
||||||
|
extra_args_set = Set()
|
||||||
|
|
||||||
|
# hack to build cts dependencies
|
||||||
|
# TODO: remove this when cts dependencies are removed
|
||||||
|
if self._IsCtsTests(tests):
|
||||||
|
# need to use make since these fail building with ONE_SHOT_MAKEFILE
|
||||||
|
extra_args_set.add('CtsTestStubs')
|
||||||
|
extra_args_set.add('android.core.tests.runner')
|
||||||
|
for test in tests:
|
||||||
|
if test.IsFullMake():
|
||||||
|
if test.GetExtraBuildArgs():
|
||||||
|
# extra args contains the args to pass to 'make'
|
||||||
|
extra_args_set.add(test.GetExtraBuildArgs())
|
||||||
|
else:
|
||||||
|
logger.Log("Warning: test %s needs a full build but does not specify"
|
||||||
|
" extra_build_args" % test.GetName())
|
||||||
|
|
||||||
|
# check if there is actually any tests that required a full build
|
||||||
|
if extra_args_set:
|
||||||
|
cmd = ('make -j%s %s' % (self._options.make_jobs,
|
||||||
|
' '.join(list(extra_args_set))))
|
||||||
|
logger.Log(cmd)
|
||||||
|
if not self._options.preview:
|
||||||
|
old_dir = os.getcwd()
|
||||||
|
os.chdir(self._root_path)
|
||||||
|
run_command.RunCommand(cmd, return_output=False)
|
||||||
|
os.chdir(old_dir)
|
||||||
|
|
||||||
def _AddBuildTarget(self, test_suite, target_set, extra_args_set):
|
def _AddBuildTarget(self, test_suite, target_set, extra_args_set):
|
||||||
build_dir = test_suite.GetBuildPath()
|
if not test_suite.IsFullMake():
|
||||||
if self._AddBuildTargetPath(build_dir, target_set):
|
build_dir = test_suite.GetBuildPath()
|
||||||
extra_args_set.add(test_suite.GetExtraBuildArgs())
|
if self._AddBuildTargetPath(build_dir, target_set):
|
||||||
for path in test_suite.GetBuildDependencies(self._options):
|
extra_args_set.add(test_suite.GetExtraBuildArgs())
|
||||||
self._AddBuildTargetPath(path, target_set)
|
for path in test_suite.GetBuildDependencies(self._options):
|
||||||
|
self._AddBuildTargetPath(path, target_set)
|
||||||
|
|
||||||
def _AddBuildTargetPath(self, build_dir, target_set):
|
def _AddBuildTargetPath(self, build_dir, target_set):
|
||||||
if build_dir is not None:
|
if build_dir is not None:
|
||||||
|
|||||||
@@ -484,9 +484,9 @@ See test_defs.xsd for more information.
|
|||||||
<test-native name="libjingle"
|
<test-native name="libjingle"
|
||||||
build_path="vendor/google/libraries/libjingle"
|
build_path="vendor/google/libraries/libjingle"
|
||||||
description="Libjingle."
|
description="Libjingle."
|
||||||
|
full_make="true"
|
||||||
extra_build_args="LIBJINGLE_TESTS=1" />
|
extra_build_args="LIBJINGLE_TESTS=1" />
|
||||||
|
|
||||||
|
|
||||||
<!-- host java tests -->
|
<!-- host java tests -->
|
||||||
<test-host name="cts-appsecurity"
|
<test-host name="cts-appsecurity"
|
||||||
build_path="cts/tests/appsecurity-tests"
|
build_path="cts/tests/appsecurity-tests"
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<xs:attribute name="name" type="xs:string" use="required" />
|
<xs:attribute name="name" type="xs:string" use="required" />
|
||||||
|
|
||||||
<!-- File system path, relative to Android build root, to this
|
<!-- File system path, relative to Android build root, to this
|
||||||
package's Android.mk file. -->
|
package's Android.mk file.-->
|
||||||
<xs:attribute name="build_path" type="xs:string" use="required" />
|
<xs:attribute name="build_path" type="xs:string" use="required" />
|
||||||
|
|
||||||
<!-- Include test in continuous test system. -->
|
<!-- Include test in continuous test system. -->
|
||||||
@@ -55,10 +55,17 @@
|
|||||||
test. -->
|
test. -->
|
||||||
<xs:attribute name="description" type="xs:string" use="optional" />
|
<xs:attribute name="description" type="xs:string" use="optional" />
|
||||||
|
|
||||||
|
<!-- Specifies that a full 'make', as opposed to 'mmm' command, is
|
||||||
|
needed to build this test. The build command used will be
|
||||||
|
'make extra_build_args' -->
|
||||||
|
<xs:attribute name="full_make" type="xs:boolean"
|
||||||
|
use="optional" />
|
||||||
|
|
||||||
<!-- Extra arguments to append to build command when building this
|
<!-- Extra arguments to append to build command when building this
|
||||||
test. -->
|
test. -->
|
||||||
<xs:attribute name="extra_build_args" type="xs:string"
|
<xs:attribute name="extra_build_args" type="xs:string"
|
||||||
use="optional" />
|
use="optional" />
|
||||||
|
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
||||||
<!-- Java on device instrumentation test.
|
<!-- Java on device instrumentation test.
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class AbstractTestSuite(object):
|
|||||||
self._suite = None
|
self._suite = None
|
||||||
self._description = ''
|
self._description = ''
|
||||||
self._extra_build_args = ''
|
self._extra_build_args = ''
|
||||||
|
self._is_full_make = False
|
||||||
|
|
||||||
def GetName(self):
|
def GetName(self):
|
||||||
return self._name
|
return self._name
|
||||||
@@ -88,6 +89,13 @@ class AbstractTestSuite(object):
|
|||||||
self._extra_build_args = build_args
|
self._extra_build_args = build_args
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def IsFullMake(self):
|
||||||
|
return self._is_full_make
|
||||||
|
|
||||||
|
def SetIsFullMake(self, full_make):
|
||||||
|
self._is_full_make = full_make
|
||||||
|
return self
|
||||||
|
|
||||||
def Run(self, options, adb):
|
def Run(self, options, adb):
|
||||||
"""Runs the test.
|
"""Runs the test.
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class XmlSuiteParser(object):
|
|||||||
_SUITE_ATTR = 'suite'
|
_SUITE_ATTR = 'suite'
|
||||||
_DESCRIPTION_ATTR = 'description'
|
_DESCRIPTION_ATTR = 'description'
|
||||||
_EXTRA_BUILD_ARGS_ATTR = 'extra_build_args'
|
_EXTRA_BUILD_ARGS_ATTR = 'extra_build_args'
|
||||||
|
_FULL_MAKE_ATTR = 'full_make'
|
||||||
|
|
||||||
def Parse(self, element):
|
def Parse(self, element):
|
||||||
"""Populates common suite attributes from given suite xml element.
|
"""Populates common suite attributes from given suite xml element.
|
||||||
@@ -79,6 +80,9 @@ class XmlSuiteParser(object):
|
|||||||
default_value=''))
|
default_value=''))
|
||||||
test_suite.SetExtraBuildArgs(self._ParseAttribute(
|
test_suite.SetExtraBuildArgs(self._ParseAttribute(
|
||||||
suite_element, self._EXTRA_BUILD_ARGS_ATTR, False, default_value=''))
|
suite_element, self._EXTRA_BUILD_ARGS_ATTR, False, default_value=''))
|
||||||
|
test_suite.SetIsFullMake(self._ParseAttribute(
|
||||||
|
suite_element, self._FULL_MAKE_ATTR, False, default_value=False))
|
||||||
|
|
||||||
|
|
||||||
def _ParseAttribute(self, suite_element, attribute_name, mandatory,
|
def _ParseAttribute(self, suite_element, attribute_name, mandatory,
|
||||||
default_value=None):
|
default_value=None):
|
||||||
|
|||||||
Reference in New Issue
Block a user