Skip to content

Commit b9028b2

Browse files
author
MarcoFalke
committed
Merge bitcoin/bitcoin#26481: bench: Suppress output when running with -sanity-check option
f1e8959 test: Drop no longer required bench output redirection (Hennadii Stepanov) 4dbcdf2 bench: Suppress output when running with `-sanity-check` option (Hennadii Stepanov) Pull request description: This change allows to simplify CI tests, and makes it easier to integrate the `bench_bitcoin` binary into CMake custom [targets](https://cmake.org/cmake/help/latest/command/add_custom_target.html) or [commands](https://cmake.org/cmake/help/latest/command/add_custom_command.html), as `COMMAND` does not support output redirection. ACKs for top commit: aureleoules: tACK f1e8959. Ran as expected and is more practical than using an output redirection. Tree-SHA512: 29086d428cccedcfd031c0b4514213cbc1670e35f955e8fd35cee212bc6f9616cf9f20d0cb984495390c4ae2c50788ace616aea907d44e0d6a905b9dda1685d8
2 parents 4654506 + f1e8959 commit b9028b2

File tree

4 files changed

+5
-4
lines changed

4 files changed

+5
-4
lines changed

.cirrus.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ task:
175175
- ccache --show-stats
176176
check_script:
177177
- src\test_bitcoin.exe -l test_suite
178-
- src\bench_bitcoin.exe --sanity-check > NUL
178+
- src\bench_bitcoin.exe --sanity-check
179179
- python test\util\test_runner.py
180180
- python test\util\rpcauth-test.py
181181
functional_tests_script:

src/Makefile.test.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ if TARGET_WINDOWS
376376
else
377377
if ENABLE_BENCH
378378
@echo "Running bench/bench_bitcoin (one iteration sanity check, only high priority)..."
379-
$(BENCH_BINARY) -sanity-check -priority-level=high > /dev/null
379+
$(BENCH_BINARY) -sanity-check -priority-level=high
380380
endif
381381
endif
382382
$(AM_V_at)$(MAKE) $(AM_MAKEFLAGS) -C secp256k1 check

src/bench/bench.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ void BenchRunner::RunAll(const Args& args)
8383
std::smatch baseMatch;
8484

8585
if (args.sanity_check) {
86-
std::cout << "Running with --sanity-check option, benchmark results will be useless." << std::endl;
86+
std::cout << "Running with -sanity-check option, output is being suppressed as benchmark results will be useless." << std::endl;
8787
}
8888

8989
std::vector<ankerl::nanobench::Result> benchmarkResults;
@@ -106,6 +106,7 @@ void BenchRunner::RunAll(const Args& args)
106106
Bench bench;
107107
if (args.sanity_check) {
108108
bench.epochs(1).epochIterations(1);
109+
bench.output(nullptr);
109110
}
110111
bench.name(name);
111112
if (args.min_time > 0ms) {

src/bench/bench_bitcoin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static void SetupBenchArgs(ArgsManager& argsman)
3131
argsman.AddArg("-min-time=<milliseconds>", strprintf("Minimum runtime per benchmark, in milliseconds (default: %d)", DEFAULT_MIN_TIME_MS), ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::OPTIONS);
3232
argsman.AddArg("-output-csv=<output.csv>", "Generate CSV file with the most important benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3333
argsman.AddArg("-output-json=<output.json>", "Generate JSON file with all benchmark results", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
34-
argsman.AddArg("-sanity-check", "Run benchmarks for only one iteration", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
34+
argsman.AddArg("-sanity-check", "Run benchmarks for only one iteration with no output", ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3535
argsman.AddArg("-priority-level=<l1,l2,l3>", strprintf("Run benchmarks of one or multiple priority level(s) (%s), default: '%s'",
3636
benchmark::ListPriorities(), DEFAULT_PRIORITY), ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
3737
}

0 commit comments

Comments
 (0)