Skip to content

Commit ed42377

Browse files
committed
fix windows
sonarqubecloud error corrected Refactor JSONAdapter parse method to use parseImpl Refactor JSONAdapter parse methods to remove adapter parameter Add parseImpl method to json_adapter.h Refactor JSON field handling in regression tests Refactor JSON field processing by introducing a reusable for_each_json_field function. This change simplifies the code in multiple update functions by eliminating redundant logic. Refactor parsing functions for improved validation Cleanup: Remove unused parsing functions Removed unused functions related to parsing and scenario building in json_benchmark.cc. Improve benchmark output and add bilingual benchmark docs Apply minimal Sonar-focused fixes in benchmark parser/script Measure benchmark timer only around transaction loop Revisit JSON Sonar follow-ups for adapter and enum handling Reduce duplicated JSON backend control-flow blocks fix: probably UB (left shift of neg. val) in ip_tree fix: nullptr dereference in seclang scanner fix: unhandled exception in parser Deduplicate shared JSON backend helper functions
1 parent c13f7d1 commit ed42377

25 files changed

+2035
-1380
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,10 @@ It is recommended to use assertions where applicable, and to enable them with
253253

254254
The source tree includes a Benchmark tool that can help measure library performance. The tool is located in the `test/benchmark/` directory. The build process also creates the binary here, so you will have the tool after the compilation is finished.
255255

256+
Detailed benchmark test documentation is available in:
257+
* `docs/benchmark-tests.en.md`
258+
* `docs/benchmark-tests.de.md`
259+
256260
To compare the JSON regression suite across both supported JSON backends with separate build directories, run:
257261

258262
```shell
@@ -325,7 +329,7 @@ The tool is a straightforward wrapper application that utilizes the library. It
325329

326330
Each transaction is an HTTP/1.1 GET request with some GET parameters. Common headers are added, followed by the response headers and an XML body. Between phases, the tool checks whether an intervention has occurred. All transactions are created with the same data.
327331

328-
Note that the tool does not call the last phase (logging).
332+
Note that the tool calls the logging phase (`processLogging()`) for each transaction.
329333

330334
Please remember to reset `basic_rules.conf` if you want to try with a different ruleset.
331335

build/win32/CMakeLists.txt

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,22 @@ endfunction()
192192

193193
# unit tests
194194
file(GLOB unitTestSources ${BASE_DIR}/test/unit/*.cc)
195+
196+
list(REMOVE_ITEM unitTestSources
197+
${BASE_DIR}/test/unit/json_backend_depth_tests.cc
198+
)
199+
195200
add_executable(unit_tests ${unitTestSources} ${BASE_DIR}/test/common/custom_debug_log.cc)
196201
setTestTargetProperties(unit_tests)
197202
target_compile_options(unit_tests PRIVATE /wd4805)
198203

204+
add_executable(json_backend_depth_tests
205+
${BASE_DIR}/test/unit/json_backend_depth_tests.cc
206+
${BASE_DIR}/test/common/custom_debug_log.cc
207+
)
208+
setTestTargetProperties(json_backend_depth_tests)
209+
target_compile_options(json_backend_depth_tests PRIVATE /wd4805)
210+
199211
# regression tests
200212
file(GLOB regressionTestsSources ${BASE_DIR}/test/regression/*.cc)
201213
add_executable(regression_tests ${regressionTestsSources} ${BASE_DIR}/test/common/custom_debug_log.cc)
@@ -214,6 +226,12 @@ add_regression_test_capability(WITH_MAXMIND HAVE_MAXMIND)
214226

215227
enable_testing()
216228

229+
add_test(
230+
NAME json_backend_depth_tests
231+
COMMAND json_backend_depth_tests
232+
WORKING_DIRECTORY ${BASE_DIR}/test
233+
)
234+
217235
file(READ ${BASE_DIR}/test/test-suite.in TEST_FILES_RAW)
218236
string(REPLACE "\n" ";" TEST_FILES ${TEST_FILES_RAW})
219237

@@ -233,15 +251,25 @@ foreach(TEST_FILE ${TEST_FILES})
233251
# test name
234252
get_filename_component(TEST_NAME ${TEST_FILE} NAME_WE)
235253

254+
# json_backend_depth_tests is built as a standalone executable,
255+
# so skip automatic registration through unit_tests
256+
if(TEST_NAME STREQUAL "json_backend_depth_tests")
257+
continue()
258+
endif()
259+
236260
# determine test runner based on test path prefix
237261
string(FIND ${TEST_FILE} "test-cases/regression/" is_regression_test)
238262
if(is_regression_test EQUAL 0)
239-
set(TEST_RUNNER "regression_tests")
263+
set(TEST_RUNNER "regression_tests")
240264
else()
241-
set(TEST_RUNNER "unit_tests")
265+
set(TEST_RUNNER "unit_tests")
242266
endif()
243267

244-
add_test(NAME ${TEST_NAME} COMMAND ${TEST_RUNNER} ${TEST_FILE} WORKING_DIRECTORY ${BASE_DIR}/test)
268+
add_test(
269+
NAME ${TEST_NAME}
270+
COMMAND ${TEST_RUNNER} ${TEST_FILE}
271+
WORKING_DIRECTORY ${BASE_DIR}/test
272+
)
245273
endif()
246274
endforeach()
247275

@@ -253,7 +281,6 @@ setTestTargetProperties(benchmark)
253281
add_executable(rules_optimization ${BASE_DIR}/test/optimization/optimization.cc)
254282
setTestTargetProperties(rules_optimization)
255283

256-
257284
# examples
258285
#
259286

0 commit comments

Comments
 (0)