Skip to content

Instantly share code, notes, and snippets.

@Sjors
Last active January 16, 2024 14:53
Show Gist options
  • Save Sjors/cd55370fa67aa095df90c433ee9bd135 to your computer and use it in GitHub Desktop.
Save Sjors/cd55370fa67aa095df90c433ee9bd135 to your computer and use it in GitHub Desktop.
Run (much of) Bitcoin CI on your own machine

Tested on Ubuntu 23.04 with Gnome desktop.

This runs 11 of the Bitcoin Core CI machines, opening one terminal window for each. The window is automatically closed if the tests pass, otherwise it stays open.

My AMD Ryzen 9 7950X machine has 16 cores (32 threads) at 64 GB of memory. Memory peaks at about 25 GB. Everything but native_fuzz completes in 50 minutes, with CPU usage mostly at 100%. The fuzzer idles around (?) for another 10 minutes and then finishes.

Usage

From your Bitcoin repo:

PATH_TO_SCRIPT/run-bitcoin-cli.sh

Issues

We wait a few seconds before starting the next CI, because otherwise they'll fail. Maybe they're using a shared docker resource at initiation?

The fuzzer task is given 32 threads so that it takes about the same time as the rest. It's still the last to finish. Interestingly I noticed that after addrman_serdeser this taks seems to hand using almost no CPU for several minutes.

Although we call gnome-terminal --tab it opens new windows. Probably because I missed an env variable. Conversely some of the passed env variables may not be needed.

It does not run mac native, because that requires a Mac to run. It also skip Android, ARM and s390x - afaik those also require a different machine architecture (or a VM?).

It skips valgrind machines because that's too slow (TODO: test again).

Skips native_fuzz_with_msan because it doesn't work and CI doesn't run it anyway.

echo "Cleanup earlier stuff..."
docker stop $(docker ps -a -q)
set -o errexit
echo "Running linter VM..."
# See test/lint/README.md
DOCKER_BUILDKIT=1 docker build -t bitcoin-linter --file "./ci/lint_imagefile" ./ && docker run --rm -v $(pwd):/bitcoin -it bitcoin-linter
envs=`ls ./ci/test | grep 00_setup_env_ | grep -v android | grep -v valgrind | grep -v arm | grep -v mac_native | grep -v s390x | grep -v native_fuzz_with`
for environment in $envs
do
export MAKEJOBS=-j5
if [ "$environment" = "00_setup_env_native_fuzz.sh" ]; then
echo "More CPU for fuzzer"
export MAKEJOBS=-j32
fi
echo "Wait before launching $environment container..."
sleep 10
env -i CCACHE_SIZE=1G MAKEJOBS="$MAKEJOBS" DISPLAY="$DISPLAY" GDMSESSION="$GDMSESSION" DBUS_SESSION_BUS_ADDRESS="$DBUS_SESSION_BUS_ADDRESS" GNOME_TERMINAL_SCREEN="$GNOME_TERMINAL_SCREEN" DOCKER_HOST="$DOCKER_HOST" HOME="$HOME" PATH="$PATH" USER="$USER" SESSION_MANAGER="$SESSION_MANAGER" FILE_ENV="./ci/test/$environment" gnome-terminal --tab --title="$environment" -- bash -c './ci/test_run_all.sh || bash'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment