#!/bin/sh

# Exit on error
set -e

# Copy the config file to the expected location.
cp debian/tests/config.ini test/

# Stop the bitcoin-knots service if it is running.  The tests will launch their
# own instance of bitcoind.
if [ -f "/usr/bin/systemctl" ]; then
    if systemctl list-unit-files --all | grep -Fq "bitcoin-knots"; then
        service bitcoin-knots stop
    fi
fi

# Run the upstream tests.
test/functional/test_runner.py
