Add PRESUBMIT test to make sure all valgrind dependencies are listed.

Add a PRESUBMIT test to make sure new valgrind runtime dependencies are
listed in tools_webrtc/valgrind/valgrind-webrtc.gni, so that they are
isolated and uploaded to swarming.

TBR=phoglund@webrtc.org

Bug: webrtc:7249
Change-Id: I090b790da0b6dd7c1e76c20f96e40df9000cbd62
Reviewed-on: https://webrtc-review.googlesource.com/42740
Commit-Queue: Edward Lemur <ehmaldonado@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#21933}
This commit is contained in:
Edward Lemur 2018-02-01 15:23:33 +01:00 committed by Commit Bot
parent 95a5f00484
commit 27b2c9a3b0

View File

@ -6,6 +6,9 @@
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
import os
def _LicenseHeader(input_api):
"""Returns the license header regexp."""
# Accept any year number from 2003 to the current year
@ -27,11 +30,34 @@ def _LicenseHeader(input_api):
}
return license_header
def _CheckValgrindFiles(input_api, output_api):
"""Check that valgrind-webrtc.gni contains all existing files."""
valgrind_dir = os.path.join('tools_webrtc', 'valgrind')
with open(os.path.join('valgrind', 'valgrind-webrtc.gni')) as f:
valgrind_webrtc = f.read()
results = []
for f in input_api.AffectedFiles():
f = f.LocalPath()
if (f.startswith(valgrind_dir)
and f not in valgrind_webrtc
and not f.endswith('valgrind-webrtc.gni')):
results.append(' * %s\n' % f)
if results:
results = [output_api.PresubmitError(
'The following files are not listed in '
'tools_webrtc/valgrind/valgrind-webrt.gni. Please add them, so they can '
'be isolated and uploaded to swarming:\n' +
''.join(file_path for file_path in results))]
return results
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
results.extend(input_api.canned_checks.CheckLicense(
input_api, output_api, _LicenseHeader(input_api)))
results.extend(_CheckValgrindFiles(input_api, output_api))
return results
def CheckChangeOnUpload(input_api, output_api):