diff --git a/testrunner/runtest.py b/testrunner/runtest.py index b72727064..c13fb4cc9 100755 --- a/testrunner/runtest.py +++ b/testrunner/runtest.py @@ -177,17 +177,20 @@ class TestRunner(object): 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 @@ class TestRunner(object): 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 f7a435e95..2cdcfa87c 100644 --- a/testrunner/test_defs.py +++ b/testrunner/test_defs.py @@ -158,6 +158,7 @@ class TestSuite(object): _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 @@ class TestSuite(object): 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 @@ class TestSuite(object): 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 9007a11bf..03ecbbcfd 100644 --- a/testrunner/test_defs.xml +++ b/testrunner/test_defs.xml @@ -68,9 +68,11 @@ Native tests: 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 /Android.mk + make /Android.mk adb sync for test_prog in ; do adb shell "/system/bin/${test_prog} >/dev/null 2>&1;echo \$?" @@ -259,7 +261,8 @@ Native tests: + description="Bionic libstdc++." + extra_make_args="BIONIC_TESTS=1" />