-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Assert failure because of SkipWithError() #937
Copy link
Copy link
Closed
Description
If SkipWithError() is used before the benchmark loop, and we also early exit before the benchmark loop starts the assert failure is triggered:
src/benchmark_runner.cc:120: RunInThread: Check `st.iterations() >= st.max_iterations' failed. Benchmark returned before State::KeepRunning() returned false!
at https://github.com/google/benchmark/blob/master/src/benchmark_runner.cc#L120.
The example unit test:
void BM_error_no_running(benchmark::State& state) {
state.SkipWithError("error message");
}
BENCHMARK(BM_error_no_running);
ADD_CASES("BM_error_before_running", {{"", true, "error message"}});I was thinking about fixing the issue by modifying the assert condition allow it pass if there was a failure in the benchmark. But there is no API to read this information from a State object.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels