Commit ba744c00 authored by Ben Pastene's avatar Ben Pastene Committed by Commit Bot

chromeos: Switch Tast result parser to use streamed_results.jsonl.

This should let us parse some results even if something goes wrong
and the final results.json doesn't get generated for some reason.

Bug: 923426
Change-Id: I028896c9edc7aeb8b3ec6339b8867f0b29ae095f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1575105Reviewed-by: default avatarJohn Budorick <jbudorick@chromium.org>
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654678}
parent 4425977d
...@@ -25,7 +25,14 @@ ...@@ -25,7 +25,14 @@
python_version: "2.7" python_version: "2.7"
# Used by: # Used by:
# build/chromeos/run_vm_test.py # build/chromeos/test_runner.py
wheel: <
name: "infra/python/wheels/jsonlines-py2_py3"
version: "version:1.2.0"
>
# Used by:
# build/chromeos/test_runner.py
# third_party/catapult # third_party/catapult
# #
# This version must be compatible with the version range specified by # This version must be compatible with the version range specified by
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import argparse import argparse
import collections
import json import json
import logging import logging
import os import os
...@@ -18,6 +19,7 @@ import tempfile ...@@ -18,6 +19,7 @@ import tempfile
# The following non-std imports are fetched via vpython. See the list at # The following non-std imports are fetched via vpython. See the list at
# //.vpython # //.vpython
import dateutil.parser # pylint: disable=import-error import dateutil.parser # pylint: disable=import-error
import jsonlines # pylint: disable=import-error
import psutil # pylint: disable=import-error import psutil # pylint: disable=import-error
CHROMIUM_SRC_PATH = os.path.abspath(os.path.join( CHROMIUM_SRC_PATH = os.path.abspath(os.path.join(
...@@ -325,9 +327,7 @@ class TastTest(RemoteTest): ...@@ -325,9 +327,7 @@ class TastTest(RemoteTest):
if not self._use_host_tast: if not self._use_host_tast:
return super(TastTest, self).post_run(return_code) return super(TastTest, self).post_run(return_code)
# TODO(crbug.com/952085): Switch to streamed_results.jsonl after jsonlines tast_results_path = os.path.join(self._logs_dir, 'streamed_results.jsonl')
# becomes available as a wheel.
tast_results_path = os.path.join(self._logs_dir, 'results.json')
if not os.path.exists(tast_results_path): if not os.path.exists(tast_results_path):
logging.error( logging.error(
'Tast results not found at %s. Falling back to generic result ' 'Tast results not found at %s. Falling back to generic result '
...@@ -336,8 +336,8 @@ class TastTest(RemoteTest): ...@@ -336,8 +336,8 @@ class TastTest(RemoteTest):
# See the link below for the format of the results: # See the link below for the format of the results:
# https://godoc.org/chromium.googlesource.com/chromiumos/platform/tast.git/src/chromiumos/cmd/tast/run#TestResult # https://godoc.org/chromium.googlesource.com/chromiumos/platform/tast.git/src/chromiumos/cmd/tast/run#TestResult
with open(tast_results_path) as f: with jsonlines.open(tast_results_path) as reader:
tast_results = json.load(f) tast_results = collections.deque(reader)
suite_results = base_test_result.TestRunResults() suite_results = base_test_result.TestRunResults()
for test in tast_results: for test in tast_results:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment