Skip to content

Commit

Permalink
Allow test files to use non-platform suffixes for PRESUBMIT checks.
Browse files Browse the repository at this point in the history
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
[email protected]
BUG=

Review URL: https://chromiumcodereview.appspot.com/14317011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195780 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
[email protected] committed Apr 23, 2013
1 parent 379ee7f commit e2d7e6f
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions PRESUBMIT.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)$'
Expand All @@ -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.
Expand Down

0 comments on commit e2d7e6f

Please sign in to comment.