Skip to content

Behavior of --benchmark_filter="" doesn't match the documentation #736

@derekmauro

Description

@derekmauro

There is a contradiction in the documentation of this flag and the behavior of the code. The documentation says the empty string runs no benchmarks, but the code actually runs all of them.

DEFINE_string(benchmark_filter, ".",
"A regular expression that specifies the set of benchmarks "
"to execute. If this flag is empty, no benchmarks are run. "
"If this flag is the string \"all\", all benchmarks linked "
"into the process are run.");

benchmark/src/benchmark.cc

Lines 349 to 351 in 99d1356

std::string spec = FLAGS_benchmark_filter;
if (spec.empty() || spec == "all")
spec = "."; // Regexp that matches all benchmarks

I think the correct behavior for the empty string should be to run none of them, as I think there might be CI systems that by default don't want to run time consuming benchmarks, and to do this they might want to override this flag with the empty string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions