Skip to content

Instantly share code, notes, and snippets.

@Raimo33
Last active October 18, 2025 15:32
Show Gist options
  • Save Raimo33/0cff39ea0bdc812663504bd857a95af9 to your computer and use it in GitHub Desktop.
Save Raimo33/0cff39ea0bdc812663504bd857a95af9 to your computer and use it in GitHub Desktop.
Find Throwing Bitcoin Core Benchmarks
#!/usr/bin/env bash
set -u
out_file="benchmarks_throwing_exception.txt"
log="$(mktemp)"
mapfile -t benches < <(./build/bin/bench_bitcoin --list)
rm -f "$out_file"
for bench in "${benches[@]}"; do
bench="${bench%%$'\r'}"
[ -z "$bench" ] && continue
filter="^${bench}$"
safe_name=$(printf '%s' "$bench" | tr '/ ' '__')
./build/bin/bench_bitcoin --filter="$filter" --min-time=1 >"$log" 2>&1
exit_code=$?
if grep -q -E '(Assertion.*failed)' "$log"; then
echo "$bench" >> "$out_file"
fi
echo "Tested bench: $bench"
done
@Raimo33
Copy link
Author

Raimo33 commented Oct 18, 2025

to use just add:

assert(false);

to the functions you want to benchmark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment