From 53dc3392c137b02ae59e5d0b845cd8997ef45bb9 Mon Sep 17 00:00:00 2001 From: Kim Neunert Date: Mon, 30 Sep 2019 17:54:51 +0200 Subject: [PATCH 1/2] ignore ResourceWarnings --- test/test_wallet.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/test_wallet.py b/test/test_wallet.py index be48183..84bce0c 100644 --- a/test/test_wallet.py +++ b/test/test_wallet.py @@ -1,4 +1,5 @@ import unittest +import warnings import tempfile import os import logging @@ -84,6 +85,7 @@ def setUp(self): } disk.ensure_datadir() disk.write_json_file(settings, 'settings.json') + warnings.simplefilter("ignore", ResourceWarning) def test_create_wallet_wrong_parameters(self): # m > n From f3a908b114fc176161f17395c2bbf8ea83dae3e6 Mon Sep 17 00:00:00 2001 From: Kim Neunert Date: Mon, 30 Sep 2019 18:04:12 +0200 Subject: [PATCH 2/2] travisci including ability to pin bitcoin-repo --- .travis.yml | 44 ++++++++++++++++++++++++++++++++++++++++ test/bitcoin_pin | 1 + test/install_bitcoind.sh | 30 +++++++++++++++++++++------ 3 files changed, 69 insertions(+), 6 deletions(-) create mode 100644 .travis.yml create mode 100644 test/bitcoin_pin diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..957a089 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,44 @@ +language: python +os: linux +dist: xenial +cache: + pip: true + ccache: true + directories: + - test/bitcoin + +addons: + apt: + sources: + - sourceline: 'ppa:bitcoin/bitcoin' + packages: + - libdb4.8-dev + - libdb4.8++-dev + - build-essential + - curl + - git + - libsdl2-dev + - libsdl2-image-dev + - gcc-arm-none-eabi + - libnewlib-arm-none-eabi + - libudev-dev + - libtool + - autotools-dev + - automake + - pkg-config + - bsdmainutils + - libssl-dev + - libevent-dev + - libboost-system-dev + - libboost-filesystem-dev + - libboost-chrono-dev + - libboost-test-dev + - libboost-thread-dev + - libusb-1.0-0-dev + - protobuf-compiler + - cython3 + - ccache + +before_install: + - set -o errexit; source ./test/install_bitcoind.sh +script: python -m unittest test.test_wallet \ No newline at end of file diff --git a/test/bitcoin_pin b/test/bitcoin_pin new file mode 100644 index 0000000..2f768c9 --- /dev/null +++ b/test/bitcoin_pin @@ -0,0 +1 @@ +f4a0d27e85754d60804ffa36e415b67c263180b9 \ No newline at end of file diff --git a/test/install_bitcoind.sh b/test/install_bitcoind.sh index 3d101bd..4c24def 100755 --- a/test/install_bitcoind.sh +++ b/test/install_bitcoind.sh @@ -2,32 +2,50 @@ # (copied from HWI) cd test bitcoind_setup_needed=false -if [ ! -d "bitcoin" ]; then +if [ ! -d "./bitcoin/.git" ]; then + echo " --> cloning bitcoin" git clone https://github.com/bitcoin/bitcoin.git cd bitcoin bitcoind_setup_needed=true else cd bitcoin + echo " --> fetching bitcoin" git fetch +fi - # Determine if we need to pull. From https://stackoverflow.com/a/3278427 - UPSTREAM=${1:-'@{u}'} - LOCAL=$(git rev-parse @) +# Determine if we need to pull. From https://stackoverflow.com/a/3278427 +UPSTREAM=${1:-'@{u}'} +LOCAL=$(git rev-parse @) +if [ -f ../bitcoin_pin ]; then + PINNED=$(cat ../bitcoin_pin) +fi +if [ -z PINNED ]; then REMOTE=$(git rev-parse "$UPSTREAM") BASE=$(git merge-base @ "$UPSTREAM") - if [ $LOCAL = $REMOTE ]; then echo "Up-to-date" elif [ $LOCAL = $BASE ]; then git pull bitcoind_setup_needed=true fi +else + if [ $LOCAL = $PINNED ]; then + echo " --> Pinned: $PINNED! Checkout not needed!" + else + echo " --> Pinned: $PINNED! Checkout needed!" + git pull + git checkout $PINNED + bitcoind_setup_needed=true + fi fi + # Build bitcoind. This is super slow, but it is cached so it runs fairly quickly. -if [ "$bitcoind_setup_needed" == true ] ; then +if [ "$bitcoind_setup_needed" = "true" ] ; then ./autogen.sh ./configure --with-miniupnpc=no --without-gui --disable-zmq --disable-tests --disable-bench --with-libs=no --with-utils=no fi make -j$(nproc) src/bitcoind +cd ../.. #travis is sourcing this script +echo " --> Finished build bitcoind"