| 504 | namespace { |
| 505 | struct TProgOpts { |
| 506 | TProgOpts(int argc, char** argv) { |
| 507 | TOpts opts = TOpts::Default(); |
| 508 | |
| 509 | opts.AddHelpOption(); |
| 510 | |
| 511 | opts.AddLongOption('b', "budget") |
| 512 | .StoreResult(&TimeBudget) |
| 513 | .RequiredArgument("SEC") |
| 514 | .Optional() |
| 515 | .Help("overall time budget"); |
| 516 | |
| 517 | opts.AddLongOption('l', "list") |
| 518 | .NoArgument() |
| 519 | .StoreValue(&ListTests, true) |
| 520 | .Help("list all tests"); |
| 521 | |
| 522 | opts.AddLongOption('t', "threads") |
| 523 | .StoreResult(&Threads) |
| 524 | .OptionalValue(ToString((NSystemInfo::CachedNumberOfCpus() + 1) / 2), "JOBS") |
| 525 | .DefaultValue("1") |
| 526 | .Help("run benchmarks in parallel"); |
| 527 | |
| 528 | opts.AddLongOption('f', "format") |
| 529 | .AddLongName("benchmark_format") |
| 530 | .StoreResult(&OutFormat) |
| 531 | .RequiredArgument("FORMAT") |
| 532 | .DefaultValue("console") |
| 533 | .Help("output format (console|csv|json)"); |
| 534 | |
| 535 | opts.AddLongOption('r', "report_path") |
| 536 | .StoreResult(&ReportPath) |
| 537 | .Optional() |
| 538 | .Help("path to save report"); |
| 539 | |
| 540 | opts.SetFreeArgDefaultTitle("REGEXP", "RE2 regular expression to filter tests"); |
| 541 | |
| 542 | const TOptsParseResult parseResult{&opts, argc, argv}; |
| 543 | |
| 544 | for (const auto& regexp : parseResult.GetFreeArgs()) { |
| 545 | Filters.push_back(MakeHolder<RE2>(regexp.data(), RE2::Quiet)); |
| 546 | Y_ENSURE(Filters.back()->ok(), "incorrect RE2 expression '" << regexp << "'"); |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | bool MatchFilters(const TStringBuf& name) const { |
| 551 | if (!Filters) { |
nothing calls this directly
no test coverage detected