#!/usr/bin/env python # Copyright (c) 2011 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. """Main function to run the layout test analyzer. The purpose of this script is to run the layout test analyzer for various teams based on the run configuration file in CSV format. The CSV file is based on https://sites.google.com/a/chromium.org/dev/developers/testing/ webkit-layout-tests/layout-test-stats-1. """ import csv import optparse import os import shutil from subprocess import Popen import sys DEFAULT_RUNNER_CONFIG_FILE = os.path.join('runner_config', 'runner_config.csv') # Predefined result/graph directory. DEFAULT_RESULT_DIR = 'result' DEFAULT_GRAPH_DIR = 'graph' DEFAULT_ANNO_DIR = 'anno' def ParseOption(): """Parse command-line options using OptionParser. Returns: an object containing all command-line option information. """ option_parser = optparse.OptionParser() option_parser.add_option('-c', '--runner-config-file-location', dest='runner_config_file_location', help=('Location of the bug annotation file; ' 'file is expected to be in CSV format ' '(default to %default)'), default=DEFAULT_RUNNER_CONFIG_FILE) option_parser.add_option('-x', '--test-group-name', dest='test_group_name', help='A name of test group.') option_parser.add_option('-d', '--result-directory-location', dest='result_directory_location', help=('Name of result directory location ' '(default to %default)'), default=DEFAULT_RESULT_DIR) option_parser.add_option('-p', '--graph-directory-location', dest='graph_directory_location', help=('Name of graph directory location ' '(default to %default)'), default=DEFAULT_GRAPH_DIR) option_parser.add_option('-a', '--anno-directory-location', dest='annotation_directory_location', help=('Name of annotation directory location; ' 'each annotation file should be the same ' 'as test group name with replacement of "/"' 'with "_" (default to %default)'), default=DEFAULT_ANNO_DIR) option_parser.add_option('-b', '--email-appended-text-file-location', dest='email_appended_text_file_location', help=('File location of the email appended text. ' 'The text is appended in the status email. ' '(default to %default and no text is ' 'appended in that case.)'), default=None) option_parser.add_option('-e', '--email-only-change-mode', dest='email_only_change_mode', help=('With this mode, email is sent out ' 'only when there is a change in the ' 'analyzer result compared to the previous ' 'result (off by default)'), action='store_true', default=False) return option_parser.parse_args()[0] def GenerateDashboardHTMLFile(file_name, test_group_list): """Generate dashboard HTML file. Currently, it is simple table that shows all the analyzer results. Args: file_name: the file name of the dashboard. test_group_list: a list of test group names such as 'media' or 'composite'. """ file_object = open(file_name, 'wb') legend_txt = """
Base Directory | ') file_object.write('Trend Graph | ') file_object.write('#Tests | ') file_object.write('#Skipped Tests | ') file_object.write('#Non-Skipped Failing Tests | ') file_object.write('Failing Rate | ') file_object.write('Passing Rate | ') file_object.write('Last Revision Number | ') file_object.write('Last Revision Date | ') file_object.write('Owner Email | ') file_object.write('Bug Information |
---|---|---|---|---|---|---|---|---|---|---|
' + test_group + ' | \n') file_object.write('