blob: 9e6999ce9d5bd6a2828e438a9f29779fec459af4 [file] [log] [blame]
# Copyright 2017 The PDFium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Presubmit script for PDFium testing corpus.
for more details about the presubmit API built into depot_tools.
def _CheckNoIn(input_api, output_api):
"""Checks that corpus tests don't contain .in files. Corpus tests should be
.pdf files, having both can cause race conditions on the bots, which run the
tests in parallel.
results = []
for f in input_api.AffectedFiles(include_deletes=False):
if f.LocalPath().endswith('.in'):
'Remove %s since corpus tests should not use .in files' % f.LocalPath()))
return results
def _CheckPngNames(input_api, output_api):
"""Checks that .png files have the right file name pattern"""
png_regex ='.+_expected(_(win|mac|linux))?\.pdf\.\d+.png')
warnings = []
for f in input_api.AffectedFiles(include_deletes=False):
local_path = f.LocalPath()
if local_path.endswith('.png'):
if not png_regex.match(local_path):
results = []
if warnings:
'The following PNG files have the wrong file name format:\n',
return results
def CheckChangeOnUpload(input_api, output_api):
results = []
results += _CheckPngNames(input_api, output_api)
results += _CheckNoIn(input_api, output_api)
return results