Commit c6601a53 authored by Jan Wilken Dörrie's avatar Jan Wilken Dörrie Committed by Chromium LUCI CQ

[Tools] Support NoCompile Tests in boilerplate.py

This change modifies tools/boilerplate.py to also support no compile
tests. This effectively generates the same code as it does for Cpp
implementation files, but also adds the following no compile
explanation:

// This is a "No Compile Test" suite.
// https://dev.chromium.org/developers/testing/no-compile-tests

Bug: None
Change-Id: I913d8e4673fdb4986f7d7e87a6fef15aae835daf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2595533
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#840168}
parent a776a5ac
......@@ -22,9 +22,15 @@ LINES = [
'found in the LICENSE file.'
]
NO_COMPILE_LINES = [
'This is a "No Compile Test" suite.',
'https://dev.chromium.org/developers/testing/no-compile-tests'
]
EXTENSIONS_TO_COMMENTS = {
'h': '//',
'cc': '//',
'nc': '//',
'mm': '//',
'js': '//',
'py': '#',
......@@ -34,11 +40,21 @@ EXTENSIONS_TO_COMMENTS = {
'typemap': '#',
}
def _GetHeader(filename):
def _GetHeaderImpl(filename, lines):
_, ext = os.path.splitext(filename)
ext = ext[1:]
comment = EXTENSIONS_TO_COMMENTS[ext] + ' '
return '\n'.join([comment + line for line in LINES])
return '\n'.join([comment + line for line in lines])
def _GetHeader(filename):
return _GetHeaderImpl(filename, LINES)
def _GetNoCompileHeader(filename):
assert (filename.endswith(".nc"))
return '\n' + _GetHeaderImpl(filename, NO_COMPILE_LINES)
def _CppHeader(filename):
......@@ -112,6 +128,9 @@ def _CreateFile(filename):
contents += _CppHeader(filename)
elif filename.endswith('.cc'):
contents += _CppImplementation(filename)
elif filename.endswith('.nc'):
contents += _GetNoCompileHeader(filename) + '\n'
contents += _CppImplementation(filename)
elif filename.endswith('.mm'):
contents += _ObjCppImplementation(filename)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment