106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)#!/usr/bin/python 206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# 306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# Copyright (C) 2013 Google Inc. All rights reserved. 406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# 506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# Redistribution and use in source and binary forms, with or without 606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# modification, are permitted provided that the following conditions are 706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# met: 806f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# 906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# * Redistributions of source code must retain the above copyright 1006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# notice, this list of conditions and the following disclaimer. 1106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# * Redistributions in binary form must reproduce the above 1206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# copyright notice, this list of conditions and the following disclaimer 1306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# in the documentation and/or other materials provided with the 1406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# distribution. 1506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# * Neither the name of Google Inc. nor the names of its 1606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# contributors may be used to endorse or promote products derived from 1706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# this software without specific prior written permission. 1806f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# 1906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 2206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2806f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 3106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)import optparse 3206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 3306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)from webkitpy.layout_tests.controllers import layout_test_finder 3406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 3506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 3606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles)def main(host, argv): 3706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) port = host.port_factory.get() 3806f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 3906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) parser = optparse.OptionParser() 4006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) parser.add_option('--test-list', action='append') 4106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) parser.add_option('--type', action='append', 4206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) help='limit to tests of type X (valid values %s)' % port.ALL_TEST_TYPES) 4306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 4406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) options, args = parser.parse_args(argv) 4506f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) finder = layout_test_finder.LayoutTestFinder(port, options) 4606f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) _, tests = finder.find_tests(options, args) 4706f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) 4806f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) for test_name in tests: 4906f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) test_type = port.test_type(test_name) 5006f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) if options.type: 5106f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) if test_type in options.type: 5206f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) host.print_(test_name) 5306f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) else: 5406f816c7c76bc45a15e452ade8a34e8af077693eTorne (Richard Coles) host.print_(test_name, test_type) 55