Skip to content

Instantly share code, notes, and snippets.

@Raimo33
Last active October 24, 2025 13:44
Show Gist options
  • Save Raimo33/ca3b8a157861e42167ede3322e2e3df8 to your computer and use it in GitHub Desktop.
Save Raimo33/ca3b8a157861e42167ede3322e2e3df8 to your computer and use it in GitHub Desktop.
Test the previous N commits sequentially (Bitcoincore)
#!/usr/bin/env bash
set -e
N=${1:-1}
CURRENT_COMMIT=$(git rev-parse HEAD)
COMMITS=$(git rev-list --max-count="$N" --reverse HEAD)
trap 'git checkout -q "$CURRENT_COMMIT"' EXIT SIGINT SIGTERM
RED="\033[0;31m"
GREEN="\033[0;32m"
YELLOW="\033[1;33m"
NC="\033[0m"
for COMMIT in $COMMITS; do
git checkout -q "$COMMIT"
COMMIT_MSG=$(git log -1 --pretty=format:"%s")
echo -en "${YELLOW}Testing commit ${COMMIT}: '${COMMIT_MSG}'${NC}"
cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=ON --fresh
ninja -C build test_bitcoin
./build/bin/test_bitcoin
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment