blob: e38a697360ce46e012f170d75ccdf061ac1db27a [file] [log] [blame]
# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import re
from autotest_lib.client.bin import test, utils
from autotest_lib.client.common_lib import error, site_utils
# Parse the score result lines, e.g. output of regression tests for mario
# | mario/base_click | | success (1.0000) | |
# | mario/base_tap | | failure | |
# We would like to retrieve the test name and its score if it is a success
# pattern and give the score of 0.0 if it is a failure pattern.
SUCCESS_PATTERN = '\|\s*([\w\d.]*/\w+)\s*\|\s*\|\s*success\s\((\d.\d+\))\s*\|'
FAILURE_PATTERN = '\|\s*([\w\d.]*/\w+)\s*\|\s*\|\s*failure\s*\|'
TOUCHPAD_TEST = os.path.join('touchpad-tests', 'touchtests')
class platform_GesturesRegressionTest(test.test):
""" Wrapper of regression test of gestures library.
This test takes advantage of autotest framework to execute the touchtests,
i.e. regression test of gestures library, and store results of the test
per build(as one of BVTs) for us to keep track of patches of gestures
library and regression tests, and their score changes accordingly.
version = 1
def setup(self):
def run_once(self):
""" Run the regression test and collect the results.
# decide what tests to be executed, strip out prefix 'x86-' if exists
board = site_utils.get_current_board().replace('x86-', '')
if board == 'daisy':
board = 'snow'
touchtests = os.path.join(self.autodir, 'deps', TOUCHPAD_TEST)
cmd = '%s %s*/*' % (touchtests, board)
output = utils.system_output(cmd)
if not output:
raise error.TestError('Can not run the touchtests')
self.test_results = {}
for line in output.splitlines():
result =
score = ''
if result:
score =
result =
if result:
# set the score of failure test to 0.0
score = '0.0'
if score:
# '/' is not a valid character for a key name
self.test_results['/', '-')] = score
# write converted test results out
if self.test_results: