Skip to content

[BUG] BENCHMARK_OUT_FORMAT and BENCHMARK_OUT env variables are not working #995

@Lectem

Description

@Lectem

Describe the bug

According to the documentation

Write benchmark results to a file with the --benchmark_out= option (or set BENCHMARK_OUT). Specify the output format with --benchmark_out_format={json|console|csv} (or set BENCHMARK_OUT_FORMAT={json|console|csv}). Note that specifying --benchmark_out does not suppress the console output.

However setting those environment variables does not work.
This is because the command argument names already start by benchmark so the function FlagToEnvVar adds the BENCHMARK_ prefix again

return "BENCHMARK_" + env_var;

So the actual variables that the code checks are BENCHMARK_BENCHMARK_OUT_FORMAT and BENCHMARK_BENCHMARK_OUT.

System
Which OS, compiler, and compiler version are you using:

  • OS: Any
  • Compiler and version: Any

To reproduce
Steps to reproduce the behavior:

  1. sync to tag v1.5.1
  2. cmake/bazel...
  3. make ...
  4. Try any example with BENCHMARK_OUT set to test_out.json and BENCHMARK_OUT_FORMAT to json

Expected behavior

BENCHMARK_OUT and BENCHMARK_OUT_FORMAT should have the same effect as the flags --benchmark_out and --benchmark_out_format respectively, or the documentation should give the correct environment variables.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions