summaryrefslogtreecommitdiffstats
path: root/third_party/android_testrunner
diff options
context:
space:
mode:
authoryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-31 16:44:10 +0000
committeryfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-31 16:44:10 +0000
commita46d542914380935743e391b3425940bea17884e (patch)
tree2d1919e10a1eafca0f97e457e8fc4dace122f465 /third_party/android_testrunner
parentaf551a6809de1b3554f2938dab0736c356048e36 (diff)
downloadchromium_src-a46d542914380935743e391b3425940bea17884e.zip
chromium_src-a46d542914380935743e391b3425940bea17884e.tar.gz
chromium_src-a46d542914380935743e391b3425940bea17884e.tar.bz2
[Android] Upstream changes to android_testrunner.
1. Add option to suppress logging to omit sensitive information. 2. Change debug output to longMsg to aid debugging. BUG=137853 Review URL: https://chromiumcodereview.appspot.com/10823093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149204 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/android_testrunner')
-rw-r--r--third_party/android_testrunner/README.chromium6
-rw-r--r--third_party/android_testrunner/adb_interface.py22
2 files changed, 18 insertions, 10 deletions
diff --git a/third_party/android_testrunner/README.chromium b/third_party/android_testrunner/README.chromium
index d62c373..ce18244 100644
--- a/third_party/android_testrunner/README.chromium
+++ b/third_party/android_testrunner/README.chromium
@@ -9,8 +9,10 @@ This package is the scripts used to run the unit test for Android and from
Android Gingerbread.
Local Modifications:
-There are no local modifications, all files were copied from
-<android_gingerbread_tree>/development/testrunner/
+1. Added |silent_log| argument to |StartInstrumentation| so that output can be
+ suppressed.
+2. Changed error message handling in |StartInstrumentation| from |shortMsg| to
+ |longMsg| to provide more information when debugging.
Here is the detail steps
1. Checkout Android source code
diff --git a/third_party/android_testrunner/adb_interface.py b/third_party/android_testrunner/adb_interface.py
index 1928c73..b8f740b 100644
--- a/third_party/android_testrunner/adb_interface.py
+++ b/third_party/android_testrunner/adb_interface.py
@@ -176,7 +176,7 @@ class AdbInterface:
def StartInstrumentation(
self, instrumentation_path, timeout_time=60*10, no_window_animation=False,
- profile=False, instrumentation_args={}):
+ profile=False, instrumentation_args={}, silent_log=False):
"""Runs an instrumentation class on the target.
@@ -195,6 +195,8 @@ class AdbInterface:
profile: If True, profiling will be turned on for the instrumentation.
instrumentation_args: Dictionary of key value bundle arguments to pass to
instrumentation.
+ silent_log: If True, the invocation of the instrumentation test runner
+ will not be logged.
Returns:
(test_results, inst_finished_bundle)
@@ -217,22 +219,26 @@ class AdbInterface:
instrumentation_path, no_window_animation=no_window_animation,
profile=profile, raw_mode=True,
instrumentation_args=instrumentation_args)
- logger.Log(command_string)
+ if silent_log:
+ logger.SilentLog(command_string)
+ else:
+ logger.Log(command_string)
(test_results, inst_finished_bundle) = (
am_instrument_parser.ParseAmInstrumentOutput(
self.SendShellCommand(command_string, timeout_time=timeout_time,
retry_count=2)))
-
if "code" not in inst_finished_bundle:
+ logger.Log('No code available. inst_finished_bundle contains: %s '
+ % inst_finished_bundle)
raise errors.InstrumentationError("no test results... device setup "
"correctly?")
if inst_finished_bundle["code"] == "0":
- short_msg_result = "no error message"
- if "shortMsg" in inst_finished_bundle:
- short_msg_result = inst_finished_bundle["shortMsg"]
- logger.Log("Error! Test run failed: %s" % short_msg_result)
- raise errors.InstrumentationError(short_msg_result)
+ long_msg_result = "no error message"
+ if "longMsg" in inst_finished_bundle:
+ long_msg_result = inst_finished_bundle["longMsg"]
+ logger.Log("Error! Test run failed: %s" % long_msg_result)
+ raise errors.InstrumentationError(long_msg_result)
if "INSTRUMENTATION_ABORTED" in inst_finished_bundle:
logger.Log("INSTRUMENTATION ABORTED!")