Fix xml reporter crashing when a benchmark failed.

This commit is contained in:
Joachim Meyer 2019-07-29 12:42:49 +02:00 committed by Martin Hořeňovský
parent 425957dc63
commit 7e7ab0e28b
2 changed files with 7 additions and 3 deletions

View File

@ -220,10 +220,13 @@ namespace Catch {
} }
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) { void XmlReporter::benchmarkPreparing(std::string const& name) {
m_xml.startElement("BenchmarkResults") m_xml.startElement("BenchmarkResults")
.writeAttribute("name", info.name) .writeAttribute("name", name);
.writeAttribute("samples", info.samples) }
void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) {
m_xml.writeAttribute("samples", info.samples)
.writeAttribute("resamples", info.resamples) .writeAttribute("resamples", info.resamples)
.writeAttribute("iterations", info.iterations) .writeAttribute("iterations", info.iterations)
.writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution)) .writeAttribute("clockResolution", static_cast<uint64_t>(info.clockResolution))

View File

@ -51,6 +51,7 @@ namespace Catch {
void testRunEnded(TestRunStats const& testRunStats) override; void testRunEnded(TestRunStats const& testRunStats) override;
#if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING)
void benchmarkPreparing(std::string const& name) override;
void benchmarkStarting(BenchmarkInfo const&) override; void benchmarkStarting(BenchmarkInfo const&) override;
void benchmarkEnded(BenchmarkStats<> const&) override; void benchmarkEnded(BenchmarkStats<> const&) override;
void benchmarkFailed(std::string const&) override; void benchmarkFailed(std::string const&) override;