#!/usr/bin/env python # # Copyright 2014 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. """Check if a LayoutTest expected file is a passing testharness result. The intent of this script is to identify expected files that are passing testharness.js results. Those files are not needed because the test infrastructure will read the output of testharness.js tests if there is no expected files.""" import fileinput import sys from webkitpy.layout_tests.models import testharness_results paths = [] for path in sys.argv[1:]: content = open(path, 'r').read() if (testharness_results.is_testharness_output(content) and testharness_results.is_testharness_output_passing(content) and not testharness_results.is_testharness_output_with_console_errors_or_warnings(content)): paths.append(path) if len(paths) > 0: sys.stderr.write('* The following files are passing testharness results without console error messages, they should be removed:\n ') sys.stderr.write('\n '.join(paths)) sys.stderr.write('\n') sys.exit("ERROR: found passing testharness results without console error messages.")