Browse Source

Apply all current shellcheck suggestions to rest of the scripts

master
Kristaps Kaupe 3 years ago
parent
commit
4f0eebc68d
No known key found for this signature in database
GPG Key ID: 33E472FE870C7E5D
  1. 3
      scripts/joinmarket-qt.sh
  2. 6
      test/Dockerfiles/build_docker.sh
  3. 2
      test/lint/lint-python.sh
  4. 24
      test/run_tests.sh

3
scripts/joinmarket-qt.sh

@ -1,5 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
cd $(dirname "$0")/.. && \ # shellcheck source=/dev/null
cd "$(dirname "$0")/.." && \
source jmvenv/bin/activate && \ source jmvenv/bin/activate && \
cd scripts && \ cd scripts && \
python3 joinmarket-qt.py python3 joinmarket-qt.py

6
test/Dockerfiles/build_docker.sh

@ -20,10 +20,10 @@ build_docker ()
core_url="https://bitcoincore.org/bin/bitcoin-core-${core_version}/${core_dist}" core_url="https://bitcoincore.org/bin/bitcoin-core-${core_version}/${core_dist}"
declare -A deps=( [${core_dist}]="${core_url}" ) declare -A deps=( [${core_dist}]="${core_url}" )
jm_root="${TRAVIS_BUILD_DIR}" jm_root="${TRAVIS_BUILD_DIR}"
owner_name="${TRAVIS_REPO_SLUG%\/*}" #owner_name="${TRAVIS_REPO_SLUG%\/*}"
repo_name="${TRAVIS_REPO_SLUG#*\/}" repo_name="${TRAVIS_REPO_SLUG#*\/}"
for dep in ${!deps[@]}; do for dep in "${!deps[@]}"; do
if [[ ! -r "${HOME}/downloads/${dep}" ]]; then if [[ ! -r "${HOME}/downloads/${dep}" ]]; then
curl --retry 5 -L "${deps[${dep}]}" -o "$HOME/downloads/${dep}" curl --retry 5 -L "${deps[${dep}]}" -o "$HOME/downloads/${dep}"
fi fi
@ -31,7 +31,7 @@ build_docker ()
mkdir -p "${jm_root}/deps/cache" mkdir -p "${jm_root}/deps/cache"
find "$HOME/downloads" -type f -exec cp -v {} "${jm_root}/deps/cache/" \; find "$HOME/downloads" -type f -exec cp -v {} "${jm_root}/deps/cache/" \;
cd "${jm_root}/../" cd "${jm_root}/../" || return 1
docker build \ docker build \
--shm-size=1G \ --shm-size=1G \

2
test/lint/lint-python.sh

@ -13,7 +13,7 @@ elif flake8 --version | grep -q "Python 2"; then
fi fi
if [[ $# == 0 ]]; then if [[ $# == 0 ]]; then
flake8 $(git ls-files "*.py") --extend-exclude "${EXCLUDE_PATTERNS}" flake8 "$(git ls-files "*.py")" --extend-exclude "${EXCLUDE_PATTERNS}"
else else
flake8 "$@" flake8 "$@"
fi fi

24
test/run_tests.sh

@ -126,7 +126,7 @@ parse_flags ()
echo "Invalid option $1" echo "Invalid option $1"
fi fi
echo " echo "
Usage: "${0}" [options] Usage: ${0} [options]
Options: Options:
@ -155,7 +155,7 @@ run_jm_tests ()
btcuser="bitcoinrpc" btcuser="bitcoinrpc"
btcpwd="123456abcdef" btcpwd="123456abcdef"
nirc="2" nirc="2"
if ! parse_flags ${@}; then if ! parse_flags "${@}"; then
return 1 return 1
fi fi
@ -176,7 +176,7 @@ run_jm_tests ()
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VIRTUAL_ENV}/lib" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${VIRTUAL_ENV}/lib"
export C_INCLUDE_PATH="${C_INCLUDE_PATH}:${VIRTUAL_ENV}/include" export C_INCLUDE_PATH="${C_INCLUDE_PATH}:${VIRTUAL_ENV}/include"
pushd "${jm_source}" pushd "${jm_source}" || return 1
if [ ! -f 'miniircd.tar.gz' ] || ! sha256_verify 'ce3a4ddc777343645ccd06ca36233b5777e218ee89d887ef529ece86a917fc33' 'miniircd.tar.gz'; then if [ ! -f 'miniircd.tar.gz' ] || ! sha256_verify 'ce3a4ddc777343645ccd06ca36233b5777e218ee89d887ef529ece86a917fc33' 'miniircd.tar.gz'; then
http_get "https://github.com/JoinMarket-Org/miniircd/archive/master.tar.gz" "miniircd.tar.gz" http_get "https://github.com/JoinMarket-Org/miniircd/archive/master.tar.gz" "miniircd.tar.gz"
fi fi
@ -217,18 +217,18 @@ run_jm_tests ()
echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf" echo "datadir=${jm_test_datadir}" >> "${jm_test_datadir}/bitcoin.conf"
python -m pytest $additional_pytest_flags \ python -m pytest $additional_pytest_flags \
${HAS_JOSH_K_SEAL_OF_APPROVAL+--cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html} \ ${HAS_JOSH_K_SEAL_OF_APPROVAL+--cov=jmclient --cov=jmbitcoin --cov=jmbase --cov=jmdaemon --cov-report html} \
--btcconf=$btcconf \ --btcconf="$btcconf" \
--btcpwd=$btcpwd \ --btcpwd="$btcpwd" \
--btcroot=$btcroot \ --btcroot="$btcroot" \
--btcuser=$btcuser \ --btcuser="$btcuser" \
--nirc=$nirc \ --nirc="$nirc" \
-p no:warnings -p no:warnings
local success="$?" local success="$?"
[[ -f ./joinmarket.cfg ]] && unlink ./joinmarket.cfg [[ -f ./joinmarket.cfg ]] && unlink ./joinmarket.cfg
if [ -f "${jm_test_datadir}/bitcoind.pid" ] && read bitcoind_pid <"${jm_test_datadir}/bitcoind.pid"; then if [ -f "${jm_test_datadir}/bitcoind.pid" ] && read -r bitcoind_pid < "${jm_test_datadir}/bitcoind.pid"; then
kill -15 ${bitcoind_pid} || kill -9 ${bitcoind_pid} kill -15 "${bitcoind_pid}" || kill -9 "${bitcoind_pid}"
fi fi
if [[ "${HAS_JOSH_K_SEAL_OF_APPROVAL}" == true ]] && (( ${success} != 0 )); then if [[ "${HAS_JOSH_K_SEAL_OF_APPROVAL}" == true ]] && (( success != 0 )); then
tail -100 "${jm_test_datadir}/regtest/debug.log" tail -100 "${jm_test_datadir}/regtest/debug.log"
find "${jm_test_datadir}" find "${jm_test_datadir}"
else else
@ -236,4 +236,4 @@ run_jm_tests ()
fi fi
return ${success:-1} return ${success:-1}
} }
run_jm_tests ${@} run_jm_tests "${@}"

Loading…
Cancel
Save