Use sources.cmake for the test_support library
As part of this, align the generated and standalone builds in how crypto/test/gtest_main.cc is added. Since not all test targets (urandom_test) include gtest_main.cc, and the generated one just manually adds it to the file lists, just put it into the file lists ahead of time. That way we don't need to synchronize the dependency information with the generated build. This also aligns the generated build with https://boringssl-review.googlesource.com/c/boringssl/+/56567 to put files like crypto/test/abi_test.cc and crypto/test/file_test_gtest.cc in the test_support library. Update-Note: If something odd happens with the test_support library in downstream builds, this CL is probably to blame. Bug: 542 Change-Id: I235e0ccd0432f4b380a92b265ede35eb8a6a6e36 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61288 Commit-Queue: David Benjamin <davidben@google.com> Reviewed-by: Bob Beck <bbe@google.com>
This commit is contained in:
parent
197b57154f
commit
847a395a50
@ -520,6 +520,17 @@ add_subdirectory(util/fipstools)
|
||||
add_subdirectory(util/fipstools/acvp/modulewrapper)
|
||||
add_subdirectory(decrepit)
|
||||
|
||||
add_library(test_support_lib STATIC ${TEST_SUPPORT_SOURCES})
|
||||
if (LIBUNWIND_FOUND)
|
||||
target_compile_options(test_support_lib PRIVATE ${LIBUNWIND_CFLAGS_OTHER})
|
||||
target_include_directories(test_support_lib PRIVATE ${LIBUNWIND_INCLUDE_DIRS})
|
||||
target_link_libraries(test_support_lib ${LIBUNWIND_LDFLAGS})
|
||||
endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(test_support_lib dbghelp)
|
||||
endif()
|
||||
target_link_libraries(test_support_lib boringssl_gtest crypto)
|
||||
|
||||
# urandom_test is a separate binary because it needs to be able to observe the
|
||||
# PRNG initialisation, which means that it can't have other tests running before
|
||||
# it does.
|
||||
@ -528,15 +539,15 @@ target_link_libraries(urandom_test test_support_lib boringssl_gtest crypto)
|
||||
add_dependencies(all_tests urandom_test)
|
||||
|
||||
add_executable(crypto_test ${CRYPTO_TEST_SOURCES} $<TARGET_OBJECTS:crypto_test_data>)
|
||||
target_link_libraries(crypto_test test_support_lib boringssl_gtest_main crypto)
|
||||
target_link_libraries(crypto_test test_support_lib boringssl_gtest crypto)
|
||||
add_dependencies(all_tests crypto_test)
|
||||
|
||||
add_executable(ssl_test ${SSL_TEST_SOURCES})
|
||||
target_link_libraries(ssl_test test_support_lib boringssl_gtest_main ssl crypto)
|
||||
target_link_libraries(ssl_test test_support_lib boringssl_gtest ssl crypto)
|
||||
add_dependencies(all_tests ssl_test)
|
||||
|
||||
add_executable(decrepit_test ${DECREPIT_TEST_SOURCES})
|
||||
target_link_libraries(decrepit_test test_support_lib boringssl_gtest_main
|
||||
target_link_libraries(decrepit_test test_support_lib boringssl_gtest
|
||||
decrepit crypto)
|
||||
add_dependencies(all_tests decrepit_test)
|
||||
|
||||
@ -550,7 +561,7 @@ target_link_libraries(pki crypto)
|
||||
|
||||
add_executable(pki_test ${PKI_TEST_SOURCES})
|
||||
target_compile_definitions(pki_test PRIVATE _BORINGSSL_LIBPKI_)
|
||||
target_link_libraries(pki_test test_support_lib boringssl_gtest_main pki crypto)
|
||||
target_link_libraries(pki_test test_support_lib boringssl_gtest pki crypto)
|
||||
add_dependencies(all_tests pki_test)
|
||||
|
||||
# The PKI library requires C++17.
|
||||
|
@ -1,5 +1,4 @@
|
||||
add_subdirectory(fipsmodule)
|
||||
add_subdirectory(test)
|
||||
|
||||
if(FIPS_DELOCATE OR FIPS_SHARED)
|
||||
SET_SOURCE_FILES_PROPERTIES(fipsmodule/bcm.o PROPERTIES EXTERNAL_OBJECT true)
|
||||
|
@ -1,24 +0,0 @@
|
||||
add_library(
|
||||
test_support_lib
|
||||
|
||||
STATIC
|
||||
|
||||
abi_test.cc
|
||||
file_test.cc
|
||||
file_test_gtest.cc
|
||||
test_util.cc
|
||||
wycheproof_util.cc
|
||||
)
|
||||
|
||||
if (LIBUNWIND_FOUND)
|
||||
target_compile_options(test_support_lib PRIVATE ${LIBUNWIND_CFLAGS_OTHER})
|
||||
target_include_directories(test_support_lib PRIVATE ${LIBUNWIND_INCLUDE_DIRS})
|
||||
target_link_libraries(test_support_lib ${LIBUNWIND_LDFLAGS})
|
||||
endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(test_support_lib dbghelp)
|
||||
endif()
|
||||
target_link_libraries(test_support_lib boringssl_gtest crypto)
|
||||
|
||||
add_library(boringssl_gtest_main STATIC gtest_main.cc)
|
||||
target_link_libraries(boringssl_gtest_main boringssl_gtest crypto test_support_lib)
|
@ -66,6 +66,7 @@ set(
|
||||
crypto/stack/stack_test.cc
|
||||
crypto/siphash/siphash_test.cc
|
||||
crypto/thread_test.cc
|
||||
crypto/test/gtest_main.cc
|
||||
crypto/trust_token/trust_token_test.cc
|
||||
crypto/x509/x509_test.cc
|
||||
crypto/x509/x509_time_test.cc
|
||||
@ -317,14 +318,16 @@ set(
|
||||
set(
|
||||
SSL_TEST_SOURCES
|
||||
|
||||
crypto/test/gtest_main.cc
|
||||
ssl/span_test.cc
|
||||
ssl/ssl_test.cc
|
||||
ssl/ssl_c_test.c
|
||||
ssl/ssl_test.cc
|
||||
)
|
||||
|
||||
set(
|
||||
DECREPIT_TEST_SOURCES
|
||||
|
||||
crypto/test/gtest_main.cc
|
||||
decrepit/blowfish/blowfish_test.cc
|
||||
decrepit/cast/cast_test.cc
|
||||
decrepit/cfb/cfb_test.cc
|
||||
@ -382,6 +385,7 @@ set(
|
||||
set(
|
||||
PKI_TEST_SOURCES
|
||||
|
||||
crypto/test/gtest_main.cc
|
||||
pki/cert_issuer_source_static_unittest.cc
|
||||
pki/certificate_policies_unittest.cc
|
||||
pki/encode_values_unittest.cc
|
||||
@ -411,3 +415,13 @@ set(
|
||||
pki/verify_name_match_unittest.cc
|
||||
pki/verify_signed_data_unittest.cc
|
||||
)
|
||||
|
||||
set(
|
||||
TEST_SUPPORT_SOURCES
|
||||
|
||||
crypto/test/abi_test.cc
|
||||
crypto/test/file_test.cc
|
||||
crypto/test/file_test_gtest.cc
|
||||
crypto/test/test_util.cc
|
||||
crypto/test/wycheproof_util.cc
|
||||
)
|
@ -598,10 +598,6 @@ def NoTestRunnerFiles(path, dent, is_dir):
|
||||
return not is_dir or dent != 'runner'
|
||||
|
||||
|
||||
def NotGTestSupport(path, dent, is_dir):
|
||||
return 'gtest' not in dent and 'abi_test' not in dent
|
||||
|
||||
|
||||
def SSLHeaderFiles(path, dent, is_dir):
|
||||
return dent in ['ssl.h', 'tls1.h', 'ssl23.h', 'ssl3.h', 'dtls1.h', 'srtp.h']
|
||||
|
||||
@ -779,8 +775,6 @@ def main(platforms):
|
||||
crypto_c_files.append('err_data.c')
|
||||
crypto_c_files.sort()
|
||||
|
||||
test_support_c_files = FindCFiles(os.path.join('src', 'crypto', 'test'),
|
||||
NotGTestSupport)
|
||||
test_support_h_files = (
|
||||
FindHeaderFiles(os.path.join('src', 'crypto', 'test'), AllFiles) +
|
||||
FindHeaderFiles(os.path.join('src', 'ssl', 'test'), NoTestRunnerFiles))
|
||||
@ -793,23 +787,11 @@ def main(platforms):
|
||||
['go', 'run', 'util/embed_test_data.go'] + cmake['CRYPTO_TEST_DATA'],
|
||||
cwd='src',
|
||||
stdout=out)
|
||||
crypto_test_files += ['crypto_test_data.cc']
|
||||
crypto_test_files.append('crypto_test_data.cc')
|
||||
|
||||
crypto_test_files += PrefixWithSrc(cmake['CRYPTO_TEST_SOURCES'])
|
||||
crypto_test_files += [
|
||||
'src/crypto/test/abi_test.cc',
|
||||
'src/crypto/test/file_test_gtest.cc',
|
||||
'src/crypto/test/gtest_main.cc',
|
||||
]
|
||||
crypto_test_files.sort()
|
||||
|
||||
ssl_test_files = PrefixWithSrc(cmake['SSL_TEST_SOURCES'])
|
||||
ssl_test_files += [
|
||||
'src/crypto/test/abi_test.cc',
|
||||
'src/crypto/test/gtest_main.cc',
|
||||
]
|
||||
ssl_test_files.sort()
|
||||
|
||||
fuzz_c_files = FindCFiles(os.path.join('src', 'fuzz'), NoTests)
|
||||
|
||||
ssl_h_files = FindHeaderFiles(os.path.join('src', 'include', 'openssl'),
|
||||
@ -854,10 +836,10 @@ def main(platforms):
|
||||
'ssl': ssl_source_files,
|
||||
'ssl_headers': ssl_h_files,
|
||||
'ssl_internal_headers': ssl_internal_h_files,
|
||||
'ssl_test': ssl_test_files,
|
||||
'ssl_test': PrefixWithSrc(cmake['SSL_TEST_SOURCES']),
|
||||
'tool': tool_c_files,
|
||||
'tool_headers': tool_h_files,
|
||||
'test_support': test_support_c_files,
|
||||
'test_support': PrefixWithSrc(cmake['TEST_SUPPORT_SOURCES']),
|
||||
'test_support_headers': test_support_h_files,
|
||||
'urandom_test': PrefixWithSrc(cmake['URANDOM_TEST_SOURCES']),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user