Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2399)

Unified Diff: build/android/run_monkey_test.py

Issue 12544033: [Android] Rewrite base test result classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: build/android/run_monkey_test.py
diff --git a/build/android/run_monkey_test.py b/build/android/run_monkey_test.py
index 7bae4c2623d16a23ec6a408e31742af3ce65da88..cb15694ee474b9ab3ec5ef04add916c47da5120d 100755
--- a/build/android/run_monkey_test.py
+++ b/build/android/run_monkey_test.py
@@ -8,19 +8,17 @@ import logging
import optparse
import random
import sys
-import time
from pylib import android_commands
-from pylib.base import test_result
+from pylib.base import base_test_result
from pylib.host_driven import python_test_base
from pylib.host_driven import python_test_sharder
+from pylib.utils import report_results
from pylib.utils import test_options_parser
class MonkeyTest(python_test_base.PythonTestBase):
def testMonkey(self):
- start_ms = int(time.time()) * 1000
-
# Launch and wait for Chrome to launch.
self.adb.StartActivity(self.options.package_name,
self.options.activity_name,
@@ -34,23 +32,21 @@ class MonkeyTest(python_test_base.PythonTestBase):
# Run the test.
output = ''
- duration_ms = 0
if before_pids:
output = '\n'.join(self._LaunchMonkeyTest())
- duration_ms = int(time.time()) * 1000 - start_ms
after_pids = self.adb.ExtractPid(self.options.package_name)
crashed = (not before_pids or not after_pids
or after_pids[0] != before_pids[0])
- result = test_result.SingleTestResult(self.qualified_name, start_ms,
- duration_ms, log=output)
- results = test_result.TestResults()
+ results = base_test_result.TestRunResults()
if 'Monkey finished' in output and not crashed:
- results.ok = [result]
+ result = base_test_result.BaseTestResult(
+ self.qualified_name, base_test_result.ResultType.PASS, log=output)
else:
- results.crashed = [result]
-
+ result = base_test_result.BaseTestResult(
+ self.qualified_name, base_test_result.ResultType.FAIL, log=output)
+ results.AddResult(result)
return results
def _LaunchMonkeyTest(self):
@@ -107,12 +103,13 @@ def DispatchPythonTests(options):
options.ensure_value('shard_retries', 1)
sharder = python_test_sharder.PythonTestSharder(
attached_devices, available_tests, options)
- result = sharder.RunShardedTests()
- result.LogFull(
+ results = sharder.RunShardedTests()
+ report_results.LogFull(
+ results=results,
test_type='Monkey',
test_package='Monkey',
build_type=options.build_type)
- result.PrintAnnotation()
+ report_results.PrintAnnotation(results)
def main():

Powered by Google App Engine
This is Rietveld 408576698