AI 144501: am: CL 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.
Original author: niko
Automated import of CL 144501
diff --git a/testrunner/runtest.py b/testrunner/runtest.py
index b727270..c13fb4c 100755
--- a/testrunner/runtest.py
+++ b/testrunner/runtest.py
@@ -177,17 +177,20 @@
def _DoBuild(self):
logger.SilentLog("Building tests...")
target_set = Set()
+ extra_args_set = Set()
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 self._options.coverage:
self._coverage_gen.EnableCoverageBuild()
self._AddBuildTarget(self._coverage_gen.GetEmmaBuildPath(), target_set)
target_build_string = " ".join(list(target_set))
- logger.Log("mmm %s" % target_build_string)
- cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files' % (target_build_string,
- self._root_path)
+ extra_args_string = " ".join(list(extra_args_set))
+ cmd = 'ONE_SHOT_MAKEFILE="%s" make -C "%s" files %s' % (
+ target_build_string, self._root_path, extra_args_string)
+ logger.Log(cmd)
+
if self._options.preview:
# in preview mode, just display to the user what command would have been
# run
@@ -197,11 +200,13 @@
logger.Log("Syncing to device...")
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:
build_file_path = os.path.join(build_dir, "Android.mk")
if os.path.isfile(os.path.join(self._root_path, build_file_path)):
target_set.add(build_file_path)
+ extra_args_set.add(test_suite.GetExtraMakeArgs())
def _GetTestsToRun(self):
"""Get a list of TestSuite objects to run, based on command line args."""
diff --git a/testrunner/test_defs.py b/testrunner/test_defs.py
index f7a435e..2cdcfa8 100644
--- a/testrunner/test_defs.py
+++ b/testrunner/test_defs.py
@@ -158,6 +158,7 @@
_BUILD_ATTR = "build_path"
_CONTINUOUS_ATTR = "continuous"
_DESCRIPTION_ATTR = "description"
+ _EXTRA_MAKE_ARGS_ATTR = "extra_make_args"
_DEFAULT_RUNNER = "android.test.InstrumentationTestRunner"
@@ -202,6 +203,11 @@
self._description = suite_element.getAttribute(self._DESCRIPTION_ATTR)
else:
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):
return self._name
@@ -235,8 +241,13 @@
return self._native
def GetDescription(self):
+ """Returns a description if available, an empty string otherwise."""
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):
"""Parses out a TestDefinitions from given path to xml file.
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 9007a11..03ecbbc 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -68,9 +68,11 @@
false if they are under development.
description: Optional string. Default is empty. Short description (typically
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:
- make <build_path>/Android.mk
+ make <build_path>/Android.mk <extra_make_args>
adb sync
for test_prog in <tests built>; do
adb shell "/system/bin/${test_prog} >/dev/null 2>&1;echo \$?"
@@ -259,7 +261,8 @@
<!-- native tests -->
<test-native name="libstdcpp"
build_path="system/extras/tests/bionic/libstdc++"
- description="Bionic libstdc++." />
+ description="Bionic libstdc++."
+ extra_make_args="BIONIC_TESTS=1" />
</test-definitions>