diff options
Diffstat (limited to 'render-test')
-rw-r--r-- | render-test/render_test.cpp | 4 | ||||
-rw-r--r-- | render-test/runner.cpp | 21 |
2 files changed, 10 insertions, 15 deletions
diff --git a/render-test/render_test.cpp b/render-test/render_test.cpp index ac54d08ca0..c3a9c6dd77 100644 --- a/render-test/render_test.cpp +++ b/render-test/render_test.cpp @@ -125,9 +125,7 @@ int runRenderTests(int argc, char** argv) { color = "red"; stats.erroredTests++; printf(ANSI_COLOR_RED "* errored %s" ANSI_COLOR_RESET "\n", id.c_str()); - if (!metadata.errorMessage.empty()) { - printf(ANSI_COLOR_RED "* error: %s" ANSI_COLOR_RESET "\n", metadata.errorMessage.c_str()); - } + printf(ANSI_COLOR_RED "* error: %s" ANSI_COLOR_RESET "\n", metadata.errorMessage.c_str()); } else { status = "failed"; color = "red"; diff --git a/render-test/runner.cpp b/render-test/runner.cpp index 0464fd861a..1204c72d71 100644 --- a/render-test/runner.cpp +++ b/render-test/runner.cpp @@ -270,25 +270,22 @@ bool TestRunner::checkRenderTestResults(mbgl::PremultipliedImage&& actualImage, } bool passed{false}; float delta{0.0f}; + std::stringstream errorStream; std::tie(passed, delta) = MemoryProbe::checkPeak(expected.second, actual->second); if (!passed) { - std::stringstream ss; - ss << "Allocated memory peak size at probe \"" << expected.first << "\" is " << actual->second.peak - << " bytes, expected is " << expected.second.peak << "±" << delta << " bytes."; - - metadata.errorMessage = ss.str(); - return false; + errorStream << "Allocated memory peak size at probe \"" << expected.first << "\" is " << actual->second.peak + << " bytes, expected is " << expected.second.peak << "±" << delta << " bytes."; } std::tie(passed, delta) = MemoryProbe::checkAllocations(expected.second, actual->second); if (!passed) { - std::stringstream ss; - ss << "Number of allocations at probe \"" << expected.first << "\" is " << actual->second.allocations - << ", expected is " << expected.second.allocations << "±" << std::round(delta) << " allocations."; - - metadata.errorMessage = ss.str(); - return false; + errorStream << "Number of allocations at probe \"" << expected.first << "\" is " + << actual->second.allocations << ", expected is " << expected.second.allocations << "±" + << std::round(delta) << " allocations."; } + + metadata.errorMessage = errorStream.str(); + if (!metadata.errorMessage.empty()) return false; } // Check network metrics. |