blob: 4a87755e919b819e858c6b54f9578098f2e3b3d2 [file] [log] [blame]
# Copyright 2018 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This module is for test results related operations."""
from libs.test_results.gtest_test_results import GtestTestResults
from libs.test_results.blink_web_test_results import BlinkWebTestResults
_TEST_RESULTS = [GtestTestResults, BlinkWebTestResults]
def GetTestResultObject(test_results_json, partial_result=False):
for format_class in _TEST_RESULTS:
if format_class.IsTestResultsInExpectedFormat(test_results_json):
return format_class(test_results_json, partial_result)
return None
def IsTestResultsValid(test_results_json):
"""Checks if the test result can be used for analysis."""
return GetTestResultObject(test_results_json) is not None
def RemoveSuffixFromStepName(step_name):
"""Returns step name without suffix.
step_name: Raw step name. Example: 'net_unittests on Windows-10'.
Step name without platform or the string ' on '. Example: 'net_unittests'.
return step_name.split(_STEP_NAME_SEPARATOR)[0]