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

Unified Diff: build/android/test_runner.py

Issue 2933993002: Add local results details pages.
Patch Set: Add --local-output arg which enables local results detail pages. Created 3 years, 6 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/test_runner.py
diff --git a/build/android/test_runner.py b/build/android/test_runner.py
index 3753483a9ef6fbd7eb293bc63f6a1314e56e9c36..d10d7f9653e44b46290a764f0530a24efe5e5bc0 100755
--- a/build/android/test_runner.py
+++ b/build/android/test_runner.py
@@ -15,6 +15,7 @@ import os
import shutil
import signal
import sys
+import tempfile
import threading
import traceback
import unittest
@@ -40,8 +41,10 @@ from pylib.base import test_instance_factory
from pylib.base import test_run_factory
from pylib.results import json_results
from pylib.results import report_results
+from pylib.results.presentation import test_results_presentation
from pylib.utils import logdog_helper
from pylib.utils import logging_utils
+from pylib.utils import test_output_saver_factory
from py_utils import contextlib_ext
@@ -141,6 +144,11 @@ def AddCommonOptions(parser):
default='local', choices=constants.VALID_ENVIRONMENTS,
help='Test environment to run in (default: %(default)s).')
+ parser.add_argument(
+ '--local-output', action='store_true',
+ help='Whether to archive test output locally and generate '
+ 'a local results detail page.')
+
class FastLocalDevAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
namespace.verbose_count = max(namespace.verbose_count, 1)
@@ -785,10 +793,11 @@ def RunTestsInPlatformMode(args):
### Set up test objects.
+ test_output_saver = test_output_saver_factory.CreateTestOutputSaver(args)
env = environment_factory.CreateEnvironment(args, infra_error)
test_instance = test_instance_factory.CreateTestInstance(args, infra_error)
test_run = test_run_factory.CreateTestRun(
- args, env, test_instance, infra_error)
+ args, env, test_instance, test_output_saver, infra_error)
### Run.
@@ -852,6 +861,22 @@ def RunTestsInPlatformMode(args):
if args.command == 'perf' and (args.steps or args.single_step):
return 0
+ if args.local_output:
jbudorick 2017/06/20 14:12:55 We won't write local output on exception w/ this.
mikecase (-- gone --) 2017/07/10 17:11:11 Like, if the test_runner itself throws an exceptio
+ result_html_string = test_results_presentation.result_details(
+ json_path=args.json_results_file,
+ test_name=args.command,
+ cs_base_url='http://cs.chromium.org',
+ local_output=True)
+ with tempfile.NamedTemporaryFile() as html_tmp:
+ html_tmp.write(result_html_string)
+ html_tmp.flush()
+ link = test_output_saver.Save(
+ html_tmp.name,
+ 'test_results_presentation.html',
+ 'test_results_presentation',
+ test_output_saver_factory.Datatype.HTML)
+ logging.critical('TEST RESULTS: %s', link)
+
return (0 if all(r.DidRunPass() for r in all_iteration_results)
else constants.ERROR_EXIT_CODE)

Powered by Google App Engine
This is Rietveld 408576698