mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-10-08 18:49:18 +02:00
bench: surround main() execution with try/catch
so we have a cleaner exit on internal runtime errors. e.g. an unknown priority level.
This commit is contained in:
@@ -118,17 +118,22 @@ int main(int argc, char** argv)
|
|||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
benchmark::Args args;
|
try {
|
||||||
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
|
benchmark::Args args;
|
||||||
args.is_list_only = argsman.GetBoolArg("-list", false);
|
args.asymptote = parseAsymptote(argsman.GetArg("-asymptote", ""));
|
||||||
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min-time", DEFAULT_MIN_TIME_MS));
|
args.is_list_only = argsman.GetBoolArg("-list", false);
|
||||||
args.output_csv = argsman.GetPathArg("-output-csv");
|
args.min_time = std::chrono::milliseconds(argsman.GetIntArg("-min-time", DEFAULT_MIN_TIME_MS));
|
||||||
args.output_json = argsman.GetPathArg("-output-json");
|
args.output_csv = argsman.GetPathArg("-output-csv");
|
||||||
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
|
args.output_json = argsman.GetPathArg("-output-json");
|
||||||
args.sanity_check = argsman.GetBoolArg("-sanity-check", false);
|
args.regex_filter = argsman.GetArg("-filter", DEFAULT_BENCH_FILTER);
|
||||||
args.priority = parsePriorityLevel(argsman.GetArg("-priority-level", DEFAULT_PRIORITY));
|
args.sanity_check = argsman.GetBoolArg("-sanity-check", false);
|
||||||
|
args.priority = parsePriorityLevel(argsman.GetArg("-priority-level", DEFAULT_PRIORITY));
|
||||||
|
|
||||||
benchmark::BenchRunner::RunAll(args);
|
benchmark::BenchRunner::RunAll(args);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
} catch (const std::exception& e) {
|
||||||
|
tfm::format(std::cerr, "Error: %s\n", e.what());
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user