From e2d7e6f2d60c5fb8f0981cf0bfc91e1657117356 Mon Sep 17 00:00:00 2001 From: "danakj@chromium.org" Date: Tue, 23 Apr 2013 12:57:12 +0000 Subject: [PATCH] Allow test files to use non-platform suffixes for PRESUBMIT checks. The current check for deciding if a file is a unittest allows a strict whitelist of platforms as suffixes. However, when a unittest file becomes too large, it is useful to split it on other axes than by platform. This allows a _suffix for a topic to be used without failing production-only presubmit checks. In other words, it considers foo_bar_unittest_baz.cc to be a unittest. There are many examples of foo_unittest_utils.cc which are used only by unit tests throughout chromium, but they have been lucky to avoid using FunctionForTesting type functions. In cc/ we have run into this problem, so allowing our unittests to be considered non-production code prevents false positive warnings about our test files. NOTRY=true R=maruel@chromium.org BUG= Review URL: https://chromiumcodereview.appspot.com/14317011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195780 0039d316-1c4b-4281-b951-d872f2087c98 --- PRESUBMIT.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 6feebd029bd1a..9e7bd99a4e9b3 100644 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -27,10 +27,6 @@ r".+[\\\/]pnacl_shim\.c$", ) -# Fragment of a regular expression that matches file name suffixes -# used to indicate different platforms. -_PLATFORM_SPECIFIERS = r'(_(android|chromeos|gtk|mac|posix|win))?' - # Fragment of a regular expression that matches C++ and Objective-C++ # implementation files. _IMPLEMENTATION_EXTENSIONS = r'\.(cc|cpp|cxx|mm)$' @@ -40,8 +36,8 @@ _TEST_CODE_EXCLUDED_PATHS = ( r'.*[/\\](fake_|test_|mock_).+%s' % _IMPLEMENTATION_EXTENSIONS, r'.+_test_(base|support|util)%s' % _IMPLEMENTATION_EXTENSIONS, - r'.+_(api|browser|perf|unit|ui)?test%s%s' % (_PLATFORM_SPECIFIERS, - _IMPLEMENTATION_EXTENSIONS), + r'.+_(api|browser|perf|unit|ui)?test(_[a-z]+)?%s' % + _IMPLEMENTATION_EXTENSIONS, r'.+profile_sync_service_harness%s' % _IMPLEMENTATION_EXTENSIONS, r'.*[/\\](test|tool(s)?)[/\\].*', # At request of folks maintaining this folder.