AI 144500: Added support for some extra make arguments for some testsuite.
For instance the libstdc++ testsuite requires BIONIC_TESTS=1 to actually build the tests. * development/testrunner/test_defs.py: Parse the new extra_make_args attribute. * development/testrunner/runtest.py: Added support for extra make arguments. Some testsuite requires this to actually be built. Changed the log statement to log what is actually being done. * development/testrunner/test_defs.xml: Added extra make argument to enable the libstdc++ tests. Automated import of CL 144500
This commit is contained in:
committed by
The Android Open Source Project
parent
8ec960039f
commit
a6dc2abe8d
@@ -177,17 +177,20 @@ class TestRunner(object):
|
|||||||
def _DoBuild(self):
|
def _DoBuild(self):
|
||||||
logger.SilentLog("Building tests...")
|
logger.SilentLog("Building tests...")
|
||||||
target_set = Set()
|
target_set = Set()
|
||||||
|
extra_args_set = Set()
|
||||||
for test_suite in self._GetTestsToRun():
|
for test_suite in self._GetTestsToRun():
|
||||||
self._AddBuildTarget(test_suite.GetBuildPath(), target_set)
|
self._AddBuildTarget(test_suite, target_set, extra_args_set)
|
||||||
|
|
||||||
if target_set:
|
if target_set:
|
||||||
if self._options.coverage:
|
if self._options.coverage:
|
||||||
self._coverage_gen.EnableCoverageBuild()
|
self._coverage_gen.EnableCoverageBuild()
|
||||||
self._AddBuildTarget(self._coverage_gen.GetEmmaBuildPath(), target_set)
|
self._AddBuildTarget(self._coverage_gen.GetEmmaBuildPath(), target_set)
|
||||||
target_build_string = " ".join(list(target_set))
|
target_build_string = " ".join(list(target_set))
|
||||||
logger.Log("mmm %s" % target_build_string)
|
extra_args_string = " ".join(list(extra_args_set))
|
||||||
cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files' % (target_build_string,
|
cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files %s' % (
|
||||||
self._root_path)
|
target_build_string, self._root_path, extra_args_string)
|
||||||
|
logger.Log(cmd)
|
||||||
|
|
||||||
if self._options.preview:
|
if self._options.preview:
|
||||||
# in preview mode, just display to the user what command would have been
|
# in preview mode, just display to the user what command would have been
|
||||||
# run
|
# run
|
||||||
@@ -197,11 +200,13 @@ class TestRunner(object):
|
|||||||
logger.Log("Syncing to device...")
|
logger.Log("Syncing to device...")
|
||||||
self._adb.Sync()
|
self._adb.Sync()
|
||||||
|
|
||||||
def _AddBuildTarget(self, build_dir, target_set):
|
def _AddBuildTarget(self, test_suite, target_set, extra_args_set):
|
||||||
|
build_dir = test_suite.GetBuildPath()
|
||||||
if build_dir is not None:
|
if build_dir is not None:
|
||||||
build_file_path = os.path.join(build_dir, "Android.mk")
|
build_file_path = os.path.join(build_dir, "Android.mk")
|
||||||
if os.path.isfile(os.path.join(self._root_path, build_file_path)):
|
if os.path.isfile(os.path.join(self._root_path, build_file_path)):
|
||||||
target_set.add(build_file_path)
|
target_set.add(build_file_path)
|
||||||
|
extra_args_set.add(test_suite.GetExtraMakeArgs())
|
||||||
|
|
||||||
def _GetTestsToRun(self):
|
def _GetTestsToRun(self):
|
||||||
"""Get a list of TestSuite objects to run, based on command line args."""
|
"""Get a list of TestSuite objects to run, based on command line args."""
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ class TestSuite(object):
|
|||||||
_BUILD_ATTR = "build_path"
|
_BUILD_ATTR = "build_path"
|
||||||
_CONTINUOUS_ATTR = "continuous"
|
_CONTINUOUS_ATTR = "continuous"
|
||||||
_DESCRIPTION_ATTR = "description"
|
_DESCRIPTION_ATTR = "description"
|
||||||
|
_EXTRA_MAKE_ARGS_ATTR = "extra_make_args"
|
||||||
|
|
||||||
_DEFAULT_RUNNER = "android.test.InstrumentationTestRunner"
|
_DEFAULT_RUNNER = "android.test.InstrumentationTestRunner"
|
||||||
|
|
||||||
@@ -202,6 +203,11 @@ class TestSuite(object):
|
|||||||
self._description = suite_element.getAttribute(self._DESCRIPTION_ATTR)
|
self._description = suite_element.getAttribute(self._DESCRIPTION_ATTR)
|
||||||
else:
|
else:
|
||||||
self._description = ""
|
self._description = ""
|
||||||
|
if suite_element.hasAttribute(self._EXTRA_MAKE_ARGS_ATTR):
|
||||||
|
self._extra_make_args = suite_element.getAttribute(
|
||||||
|
self._EXTRA_MAKE_ARGS_ATTR)
|
||||||
|
else:
|
||||||
|
self._extra_make_args = ""
|
||||||
|
|
||||||
def GetName(self):
|
def GetName(self):
|
||||||
return self._name
|
return self._name
|
||||||
@@ -235,8 +241,13 @@ class TestSuite(object):
|
|||||||
return self._native
|
return self._native
|
||||||
|
|
||||||
def GetDescription(self):
|
def GetDescription(self):
|
||||||
|
"""Returns a description if available, an empty string otherwise."""
|
||||||
return self._description
|
return self._description
|
||||||
|
|
||||||
|
def GetExtraMakeArgs(self):
|
||||||
|
"""Returns the extra make args if available, an empty string otherwise."""
|
||||||
|
return self._extra_make_args
|
||||||
|
|
||||||
def Parse(file_path):
|
def Parse(file_path):
|
||||||
"""Parses out a TestDefinitions from given path to xml file.
|
"""Parses out a TestDefinitions from given path to xml file.
|
||||||
|
|
||||||
|
|||||||
@@ -68,9 +68,11 @@ Native tests:
|
|||||||
false if they are under development.
|
false if they are under development.
|
||||||
description: Optional string. Default is empty. Short description (typically
|
description: Optional string. Default is empty. Short description (typically
|
||||||
less than 60 characters) about this test.
|
less than 60 characters) about this test.
|
||||||
|
extra_make_args: Optional string. Default is empty. Some test module require
|
||||||
|
extra make arguments to build. This string is append to the make command.
|
||||||
|
|
||||||
These attributes map to the following commands:
|
These attributes map to the following commands:
|
||||||
make <build_path>/Android.mk
|
make <build_path>/Android.mk <extra_make_args>
|
||||||
adb sync
|
adb sync
|
||||||
for test_prog in <tests built>; do
|
for test_prog in <tests built>; do
|
||||||
adb shell "/system/bin/${test_prog} >/dev/null 2>&1;echo \$?"
|
adb shell "/system/bin/${test_prog} >/dev/null 2>&1;echo \$?"
|
||||||
@@ -259,7 +261,8 @@ Native tests:
|
|||||||
<!-- native tests -->
|
<!-- native tests -->
|
||||||
<test-native name="libstdcpp"
|
<test-native name="libstdcpp"
|
||||||
build_path="system/extras/tests/bionic/libstdc++"
|
build_path="system/extras/tests/bionic/libstdc++"
|
||||||
description="Bionic libstdc++." />
|
description="Bionic libstdc++."
|
||||||
|
extra_make_args="BIONIC_TESTS=1" />
|
||||||
|
|
||||||
|
|
||||||
</test-definitions>
|
</test-definitions>
|
||||||
|
|||||||
Reference in New Issue
Block a user