How to Stop/Fail a Benchmark if fixture SetUp() fails?
Opened this issue · 3 comments
roniemartinez commented
Hi,
It seems there's not a way to stop/fail a benchmark whenever it is not possible to continue during SetUp().
class TestFixture : public ::hayai::Fixture
{
public:
virtual void SetUp() {
test = new Test();
if (!test->canContinue()) {
// SHOULD STOP HERE!
}
}
virtual void TearDown() {
delete(test);
}
Test *test;
};
BENCHMARK_F()'s connected to the fixture above still continues to execute.
Cheers!
nickbruun commented
So, what you want is a way to fail during fixture setup?
roniemartinez commented
Yes. Since some systems might throw errors, unable to connect to servers, initialization fails, etc. during SetUp().
conz27 commented
Google Test Framework has some very useful macros for this sort of thing:
https://github.com/google/googletest/blob/master/googletest/docs/AdvancedGuide.md#explicit-success-and-failure
I'd use it as inspiration.