mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-22 09:57:41 +00:00
[#3732] Meson: Add gtest.cc compiler check to detect crashes
This commit is contained in:
parent
53342bf8ca
commit
80fc384e21
12
compiler-checks/gtest.cc
Normal file
12
compiler-checks/gtest.cc
Normal file
@ -0,0 +1,12 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
// musl's mallocng memory allocator stupidly crash for test names that are
|
||||
// lengthier than 16 characters. Hence the long test name.
|
||||
TEST(Fixture, testWithLongLongLongName) {
|
||||
EXPECT_LT(1, 2);
|
||||
}
|
||||
|
||||
int main() {
|
||||
testing::InitGoogleTest();
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
21
meson.build
21
meson.build
@ -244,11 +244,22 @@ if netconf_opt.enabled() and NETCONF_DEP.get_variable(
|
||||
error('Dependency not found: NETCONF.')
|
||||
endif
|
||||
|
||||
GTEST_DEP = dependency(
|
||||
'gtest',
|
||||
fallback: ['gtest', 'gtest_dep'],
|
||||
required: TESTS_OPT.enabled() or FUZZ_OPT.enabled(),
|
||||
)
|
||||
# Google Test
|
||||
GTEST_DEP = dependency('gtest', required: TESTS_OPT.enabled() or FUZZ_OPT.enabled())
|
||||
if GTEST_DEP.found()
|
||||
result = cpp.run(
|
||||
fs.read('compiler-checks/gtest.cc'),
|
||||
name: 'Check if a simple GTest test runs.',
|
||||
dependencies: [GTEST_DEP],
|
||||
)
|
||||
if result.returncode() != 0
|
||||
GTEST_DEP = disabler()
|
||||
gtest_subproject = subproject('gtest', required: false)
|
||||
if gtest_subproject.found()
|
||||
GTEST_DEP = gtest_subproject.get_variable('gtest_dep')
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# Crypto
|
||||
if crypto_opt == 'botan'
|
||||
|
Loading…
x
Reference in New Issue
Block a user