Don't hardcode GTest sources.
We've already converted err_test and forgot. Instead, recognize GTest vs. normal tests by their contents. This hack can be removed later once all the tests are converted. BUG=129 Change-Id: Iaa56e0f3c316faaee5458a4bba9b977dc6efb1e8 Reviewed-on: https://boringssl-review.googlesource.com/13844 Reviewed-by: Steven Valdez <svaldez@google.com> Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com> CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
parent
83a321231b
commit
1d5a570627
@ -50,20 +50,6 @@ NON_PERL_FILES = {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
# For now, GTest-based tests are specified manually. Once everything has updated
|
|
||||||
# to support GTest, these will be determined automatically by looking for files
|
|
||||||
# ending with _test.cc.
|
|
||||||
CRYPTO_TEST_SOURCES = [
|
|
||||||
'src/crypto/dh/dh_test.cc',
|
|
||||||
'src/crypto/dsa/dsa_test.cc',
|
|
||||||
]
|
|
||||||
DECREPIT_TEST_SOURCES = [
|
|
||||||
'src/decrepit/decrepit_test.cc',
|
|
||||||
]
|
|
||||||
SSL_TEST_SOURCES = [
|
|
||||||
'src/ssl/ssl_test.cc',
|
|
||||||
]
|
|
||||||
|
|
||||||
PREFIX = None
|
PREFIX = None
|
||||||
|
|
||||||
|
|
||||||
@ -464,13 +450,6 @@ def OnlyTests(dent, is_dir):
|
|||||||
non-test sources."""
|
non-test sources."""
|
||||||
if is_dir:
|
if is_dir:
|
||||||
return dent != 'test'
|
return dent != 'test'
|
||||||
# For now, GTest-based tests are specified manually.
|
|
||||||
if dent in [os.path.basename(p) for p in CRYPTO_TEST_SOURCES]:
|
|
||||||
return False
|
|
||||||
if dent in [os.path.basename(p) for p in DECREPIT_TEST_SOURCES]:
|
|
||||||
return False
|
|
||||||
if dent in [os.path.basename(p) for p in SSL_TEST_SOURCES]:
|
|
||||||
return False
|
|
||||||
return '_test.' in dent or dent.startswith('example_')
|
return '_test.' in dent or dent.startswith('example_')
|
||||||
|
|
||||||
|
|
||||||
@ -624,6 +603,11 @@ def WriteAsmFiles(perlasms):
|
|||||||
return asmfiles
|
return asmfiles
|
||||||
|
|
||||||
|
|
||||||
|
def IsGTest(path):
|
||||||
|
with open(path) as f:
|
||||||
|
return "#include <gtest/gtest.h>" in f.read()
|
||||||
|
|
||||||
|
|
||||||
def main(platforms):
|
def main(platforms):
|
||||||
crypto_c_files = FindCFiles(os.path.join('src', 'crypto'), NoTests)
|
crypto_c_files = FindCFiles(os.path.join('src', 'crypto'), NoTests)
|
||||||
ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests)
|
ssl_source_files = FindCFiles(os.path.join('src', 'ssl'), NoTests)
|
||||||
@ -643,8 +627,17 @@ def main(platforms):
|
|||||||
FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) +
|
FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) +
|
||||||
FindHeaderFiles(os.path.join('src', 'ssl', 'test'), AllFiles))
|
FindHeaderFiles(os.path.join('src', 'ssl', 'test'), AllFiles))
|
||||||
|
|
||||||
test_c_files = FindCFiles(os.path.join('src', 'crypto'), OnlyTests)
|
test_c_files = []
|
||||||
test_c_files += FindCFiles(os.path.join('src', 'ssl'), OnlyTests)
|
crypto_test_files = ['src/crypto/test/gtest_main.cc']
|
||||||
|
# TODO(davidben): Remove this loop once all tests are converted.
|
||||||
|
for path in FindCFiles(os.path.join('src', 'crypto'), OnlyTests):
|
||||||
|
if IsGTest(path):
|
||||||
|
crypto_test_files.append(path)
|
||||||
|
else:
|
||||||
|
test_c_files.append(path)
|
||||||
|
|
||||||
|
ssl_test_files = FindCFiles(os.path.join('src', 'ssl'), OnlyTests)
|
||||||
|
ssl_test_files.append('src/crypto/test/gtest_main.cc')
|
||||||
|
|
||||||
fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests)
|
fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests)
|
||||||
|
|
||||||
@ -689,15 +682,14 @@ def main(platforms):
|
|||||||
'crypto': crypto_c_files,
|
'crypto': crypto_c_files,
|
||||||
'crypto_headers': crypto_h_files,
|
'crypto_headers': crypto_h_files,
|
||||||
'crypto_internal_headers': crypto_internal_h_files,
|
'crypto_internal_headers': crypto_internal_h_files,
|
||||||
'crypto_test': sorted(CRYPTO_TEST_SOURCES +
|
'crypto_test': sorted(crypto_test_files),
|
||||||
['src/crypto/test/gtest_main.cc']),
|
|
||||||
'fuzz': fuzz_c_files,
|
'fuzz': fuzz_c_files,
|
||||||
'ssl': ssl_source_files,
|
'ssl': ssl_source_files,
|
||||||
'ssl_c': [s for s in ssl_source_files if s.endswith('.c')],
|
'ssl_c': [s for s in ssl_source_files if s.endswith('.c')],
|
||||||
'ssl_cc': [s for s in ssl_source_files if s.endswith('.cc')],
|
'ssl_cc': [s for s in ssl_source_files if s.endswith('.cc')],
|
||||||
'ssl_headers': ssl_h_files,
|
'ssl_headers': ssl_h_files,
|
||||||
'ssl_internal_headers': ssl_internal_h_files,
|
'ssl_internal_headers': ssl_internal_h_files,
|
||||||
'ssl_test': sorted(SSL_TEST_SOURCES + ['src/crypto/test/gtest_main.cc']),
|
'ssl_test': sorted(ssl_test_files),
|
||||||
'tool': tool_c_files,
|
'tool': tool_c_files,
|
||||||
'tool_headers': tool_h_files,
|
'tool_headers': tool_h_files,
|
||||||
'test': test_c_files,
|
'test': test_c_files,
|
||||||
|
Loading…
Reference in New Issue
Block a user