diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-21 15:32:50 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-21 16:10:45 +0300 |
commit | bb0e5ffb2ceea28d386a9ac317ab9e1e81d83b07 (patch) | |
tree | bfa0690240268c3873ccd5cfd904ae49386807d8 /render-test/runner.cpp | |
parent | 61d1018087ff2dc40922eedbe3aac09e2f721c03 (diff) | |
download | qtlocation-mapboxgl-bb0e5ffb2ceea28d386a9ac317ab9e1e81d83b07.tar.gz |
[test runner] Improve error messaging for memory metrics tests
Diffstat (limited to 'render-test/runner.cpp')
-rw-r--r-- | render-test/runner.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
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. |