Use less c++
As a design, it would be better if we didn't need to have a dependency
on c++ in a c library. Moving things to C will reduce both
dependencies and compile times.
Reduced dependencies makes the library itself easier to use in
more environments.
libmctp Is a library that doesn't take a dependency on gtest for its
tests
libpldm Is an example that does take a dependency on gtest.
Change-Id: If1dc638f87b75b28181a0baf67f5a18d389cff81
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/meson.build b/tests/meson.build
index 2f1e2b2..0123dc2 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -9,7 +9,6 @@
dependencies: [
dependency('threads'),
gtest_proj.dependency('gtest'),
- gtest_proj.dependency('gtest_main'),
],
)
gmock = gtest_proj.dependency('gmock')
@@ -21,9 +20,12 @@
endif
endif
-jsonc_daccord = dependency('jsoncdac')
+jsonc_daccord = dependency(
+ 'jsoncdac',
+ default_options: ['default_library=static'],
+)
-test_sources = ['test-utils.cpp', 'base64_test.cpp']
+test_sources = ['test-utils.c', 'base64_test.cpp']
test_include_dirs = ['.', '../include']
@@ -33,7 +35,6 @@
test_sources,
implicit_include_directories: false,
include_directories: include_directories(test_include_dirs),
- cpp_args: '-fpermissive',
dependencies: [
json_c_dep,
jsonc_daccord,
@@ -43,7 +44,7 @@
gmock,
],
)
-test('test-cper-tests', cper_tests)
+test('test-cper-tests', cper_tests, protocol: 'gtest')
cxx = meson.get_compiler('cpp')
@@ -52,20 +53,20 @@
if (cxx.get_id() == 'clang') and get_option('fuzz').allowed() and not is_darwin
sanitize = ['fuzzer']
fuzz_args = [
- '-fsanitize=' + ','.join(sanitize),
'-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION',
+ '-fsanitize=fuzzer,address,leak',
]
foreach fuzzer_test : ['fuzz_cper_buf_to_ir']
fuzz_exe = executable(
fuzzer_test,
- [fuzzer_test + '.cpp'] + libcper_parse_sources + edk_sources + test_sources + libcper_generate_sources,
+ [fuzzer_test + '.c'] + libcper_parse_sources + edk_sources + 'test-utils.c' + libcper_generate_sources,
implicit_include_directories: false,
include_directories: include_directories(test_include_dirs),
cpp_args: fuzz_args,
c_args: fuzz_args,
link_args: fuzz_args,
- dependencies: [json_c_dep, jsonc_daccord, gtest, gmock],
+ dependencies: [json_c_dep, jsonc_daccord],
)
test(
fuzzer_test,