aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorW. J. van der Laan <laanwj@protonmail.com>2021-11-30 20:04:13 +0100
committerW. J. van der Laan <laanwj@protonmail.com>2021-11-30 20:05:44 +0100
commitc5712d172e92e231b8dc2828d4cf4bbbb8e86a16 (patch)
treeb7470e0117afd4ec4b8496b33ba51175146d84e9 /test
parent63c0d0e937afed7169c981a9b3a95e0fc5e44040 (diff)
parenta3f61676e83e908da67664c6163db61d1d11c5d2 (diff)
Merge bitcoin/bitcoin#23506: test: Make more shell scripts verifiable by the `shellcheck` tool
a3f61676e83e908da67664c6163db61d1d11c5d2 test: Make more shell scripts verifiable by the `shellcheck` tool (Hennadii Stepanov) Pull request description: Some shell scripts from `contrib/guix` and `contrib/shell` are not verifiable by the `shellcheck` tool for the following reasons: - they have no extension (see https://github.com/bitcoin/bitcoin/pull/21375/commits/4eccf063b252bfe256cf72d363a24cf0183e926e from bitcoin/bitcoin#21375) - they have the `.bash` extension while `.sh` is expected This PR adds these scripts to the input for the `shellcheck` tool, and it fixes discovered `shellcheck` warnings. ACKs for top commit: dongcarl: Code Review ACK a3f61676e83e908da67664c6163db61d1d11c5d2, this is a good robustness improvement for our shell scripts. jamesob: crACK https://github.com/bitcoin/bitcoin/pull/23506/commits/a3f61676e83e908da67664c6163db61d1d11c5d2 Tree-SHA512: 6703f5369d9c04c1a174491f381afa5ec2cc4d37321c1b93615abcdde4dfd3caae82868b699c25b72132d8c8c6f2e9cf24d38eb180ed4d0f0584d8c282e58935
Diffstat (limited to 'test')
-rwxr-xr-xtest/lint/lint-shell.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/lint/lint-shell.sh b/test/lint/lint-shell.sh
index 391f4825e8..5fa104fce6 100755
--- a/test/lint/lint-shell.sh
+++ b/test/lint/lint-shell.sh
@@ -20,12 +20,13 @@ if ! command -v shellcheck > /dev/null; then
exit $EXIT_CODE
fi
-SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
+SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced --source-path=SCRIPTDIR)
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
# Check shellcheck directive used for sourced files
mapfile -t SOURCED_FILES < <(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}')
+mapfile -t GUIX_FILES < <(git ls-files contrib/guix contrib/shell | xargs gawk '/^#!\/usr\/bin\/env bash/ {print FILENAME} {nextfile}')
mapfile -t FILES < <(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|minisketch|univalue)/')
-if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${FILES[@]}"; then
+if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${GUIX_FILES[@]}" "${FILES[@]}"; then
EXIT_CODE=1
fi