1#!/usr/bin/env python
2#
3# Copyright 2014 The Chromium Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""Check if a LayoutTest expected file is a passing testharness result.
8
9The intent of this script is to identify expected files that are passing
10testharness.js results. Those files are not needed because the test
11infrastructure will read the output of testharness.js tests if there is no
12expected files."""
13
14
15import fileinput
16import sys
17
18from webkitpy.layout_tests.models import testharness_results
19
20paths = []
21
22for path in sys.argv[1:]:
23    content = open(path, 'r').read()
24    if testharness_results.is_testharness_output(content) and \
25       testharness_results.is_testharness_output_passing(content):
26        paths.append(path)
27
28if len(paths) > 0:
29    sys.stderr.write('* The following files are passing testharness results, they should be removed:\n ')
30    sys.stderr.write('\n '.join(paths))
31    sys.stderr.write('\n')
32    sys.exit("ERROR: found passing testharness results.")
33