From 484f644b866396e7a6f4c61980422a138bf6a67f Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 25 Sep 2026 08:21:38 +0200 Subject: [PATCH] Diff fewer nesting depths so the test does not time out under Valgrind Checking every depth up to 300 made test-json_patch exceed the 1500 s ctest timeout in ci_test_valgrind. Check the depths up to 16, those around the recursion limit of 128, and 300 instead. Signed-off-by: Niels Lohmann --- tests/src/unit-json_patch.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/src/unit-json_patch.cpp b/tests/src/unit-json_patch.cpp index b57f3820a..3797267b7 100644 --- a/tests/src/unit-json_patch.cpp +++ b/tests/src/unit-json_patch.cpp @@ -16,6 +16,7 @@ using nlohmann::json; #include #include +#include #include "make_test_data_available.hpp" namespace @@ -1812,9 +1813,21 @@ TEST_CASE("JSON patch: diff of deeply nested values") { SECTION("the diff reproduces the target at every depth") { - // every depth on either side of the nesting depth up to which diff() - // recurses (detail::recursion_depth_limit(), 128) - for (std::size_t depth = 0; depth <= 300; ++depth) + // depths on either side of the nesting depth up to which diff() + // recurses (detail::recursion_depth_limit(), 128); not every depth up + // to 300, as the test would then time out under Valgrind + std::vector depths; + for (std::size_t depth = 0; depth <= 16; ++depth) + { + depths.push_back(depth); + } + for (std::size_t depth = 120; depth <= 136; ++depth) + { + depths.push_back(depth); + } + depths.push_back(300); + + for (const auto depth : depths) { CAPTURE(depth); for (int from = 0; from < 3; ++from)