Json daccor
json daccor is a json-schema validation library that accepts json-c
objects as input, and seems to be designed for openwrt, a system
with very similar requirements to BMCs.
Using this library has several motivations. First, it keeps
libcper as a C application so integrations aren't required to provide
a c++ toolchain to be able to run unit tests.
Next, it means that we avoid an "expensive" conversion in unit tests
from json-c -> nlohmann just so we can use a third library, valijson
In terms of dependency count, it drops one dependency.
(nlohmann+valijson) to (json daccor)
Finally, it means that in the future versions of the library, we
can allow json-schema verification as an option in the library
itself, which would allow us to give a CLI option for verifying
schema on any arbitrary output (helping in debugging).
Testing to see if it will work and what improvements it makes
Change-Id: I1c00bf2ef9b898b2e5decd90b749c784fb4de109
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/tests/meson.build b/tests/meson.build
index ca21b42..2f1e2b2 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -21,22 +21,7 @@
endif
endif
-nlohmann_json_dep = dependency(
- 'nlohmann_json',
- required: false,
- version: '>=3.11.2',
- include_type: 'system',
-)
-if not nlohmann_json_dep.found()
- nlohmann_proj = subproject('nlohmann_json', required: true)
- nlohmann_json_dep = nlohmann_proj.get_variable('nlohmann_json_dep')
-endif
-
-valijson_dep = dependency('valijson', required: false)
-if not valijson_dep.found()
- valijson_proj = cmake.subproject('valijson')
- valijson_dep = valijson_proj.get_variable('valijson_dep')
-endif
+jsonc_daccord = dependency('jsoncdac')
test_sources = ['test-utils.cpp', 'base64_test.cpp']
@@ -50,13 +35,12 @@
include_directories: include_directories(test_include_dirs),
cpp_args: '-fpermissive',
dependencies: [
+ json_c_dep,
+ jsonc_daccord,
libcper_parse_dep,
libcper_generate_dep,
- json_c_dep,
gtest,
gmock,
- nlohmann_json_dep,
- valijson_dep,
],
)
test('test-cper-tests', cper_tests)
@@ -81,13 +65,7 @@
cpp_args: fuzz_args,
c_args: fuzz_args,
link_args: fuzz_args,
- dependencies: [
- json_c_dep,
- gtest,
- gmock,
- nlohmann_json_dep,
- valijson_dep,
- ],
+ dependencies: [json_c_dep, jsonc_daccord, gtest, gmock],
)
test(
fuzzer_test,