2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2017-09-14 11:38:47 +02:00
|
|
|
#
|
2019-05-16 17:02:11 +02:00
|
|
|
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
2017-09-14 11:38:47 +02:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
#
|
2022-04-05 08:41:39 +02:00
|
|
|
# This script runs all contrib/devtools/lint-* files, and fails if any exit
|
2017-09-14 11:38:47 +02:00
|
|
|
# with a non-zero status code.
|
|
|
|
|
2018-06-18 13:12:07 +02:00
|
|
|
# This script is intentionally locale dependent by not setting "export LC_ALL=C"
|
|
|
|
# in order to allow for the executed lint scripts to opt in or opt out of locale
|
|
|
|
# dependence themselves.
|
|
|
|
|
2017-09-14 11:38:47 +02:00
|
|
|
set -u
|
|
|
|
|
|
|
|
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
|
|
|
LINTALL=$(basename "${BASH_SOURCE[0]}")
|
|
|
|
|
2019-05-16 17:02:11 +02:00
|
|
|
EXIT_CODE=0
|
|
|
|
|
2021-12-30 17:34:36 +01:00
|
|
|
if ! command -v parallel > /dev/null; then
|
2022-04-05 08:41:39 +02:00
|
|
|
for f in "${SCRIPTDIR}"/lint-*; do
|
2021-12-30 17:34:36 +01:00
|
|
|
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
|
|
|
if ! "$f"; then
|
|
|
|
echo "^---- failure generated from $f"
|
|
|
|
EXIT_CODE=1
|
|
|
|
fi
|
2017-09-14 11:38:47 +02:00
|
|
|
fi
|
2021-12-30 17:34:36 +01:00
|
|
|
done
|
|
|
|
else
|
|
|
|
SCRIPTS=()
|
|
|
|
|
2024-11-23 18:49:16 +01:00
|
|
|
for f in "${SCRIPTDIR}"/lint-*; do
|
2021-12-30 17:34:36 +01:00
|
|
|
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
|
|
|
SCRIPTS+=("$f")
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2024-11-23 18:49:16 +01:00
|
|
|
if ! parallel --jobs 100% --will-cite --joblog parallel_out.log ::: "${SCRIPTS[@]}"; then
|
2021-12-30 17:34:36 +01:00
|
|
|
echo "^---- failure generated"
|
|
|
|
EXIT_CODE=1
|
2017-09-14 11:38:47 +02:00
|
|
|
fi
|
2021-12-30 17:34:36 +01:00
|
|
|
column -t parallel_out.log && rm parallel_out.log
|
|
|
|
fi
|
2019-05-16 17:02:11 +02:00
|
|
|
|
|
|
|
exit ${EXIT_CODE}
|