mirror of
https://github.com/dashpay/dash.git
synced 2024-12-24 19:42:46 +01:00
merge bitcoin#24982: Port lint-all.sh
to lint-all.py
This commit is contained in:
parent
b054a0d894
commit
bda1e03b24
@ -25,7 +25,7 @@ if [ "$CHECK_DOC" = 1 ]; then
|
|||||||
# TODO: Check docs (re-enable after all Bitcoin PRs have been merged and docs fully fixed)
|
# TODO: Check docs (re-enable after all Bitcoin PRs have been merged and docs fully fixed)
|
||||||
#test/lint/check-doc.py
|
#test/lint/check-doc.py
|
||||||
# Run all linters
|
# Run all linters
|
||||||
test/lint/lint-all.sh
|
test/lint/lint-all.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ccache --zero-stats --max-size=$CCACHE_SIZE
|
ccache --zero-stats --max-size=$CCACHE_SIZE
|
||||||
|
@ -21,7 +21,7 @@ test/lint/git-subtree-check.sh src/minisketch
|
|||||||
test/lint/git-subtree-check.sh src/univalue
|
test/lint/git-subtree-check.sh src/univalue
|
||||||
test/lint/git-subtree-check.sh src/leveldb
|
test/lint/git-subtree-check.sh src/leveldb
|
||||||
test/lint/check-doc.py
|
test/lint/check-doc.py
|
||||||
test/lint/lint-all.sh
|
test/lint/lint-all.py
|
||||||
|
|
||||||
if [ "$CIRRUS_REPO_FULL_NAME" = "dashpay/dash" ] && [ -n "$CIRRUS_CRON" ]; then
|
if [ "$CIRRUS_REPO_FULL_NAME" = "dashpay/dash" ] && [ -n "$CIRRUS_CRON" ]; then
|
||||||
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
|
git log --merges --before="2 days ago" -1 --format='%H' > ./contrib/verify-commits/trusted-sha512-root-commit
|
||||||
|
@ -332,7 +332,7 @@ test/lint/lint-files.py
|
|||||||
You can run all the shell-based lint tests by running:
|
You can run all the shell-based lint tests by running:
|
||||||
|
|
||||||
```
|
```
|
||||||
test/lint/lint-all.sh
|
test/lint/lint-all.py
|
||||||
```
|
```
|
||||||
|
|
||||||
# Writing functional tests
|
# Writing functional tests
|
||||||
|
@ -39,6 +39,6 @@ To do so, add the upstream repository as remote:
|
|||||||
git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git
|
git remote add --fetch secp256k1 https://github.com/bitcoin-core/secp256k1.git
|
||||||
```
|
```
|
||||||
|
|
||||||
lint-all.sh
|
lint-all.py
|
||||||
===========
|
===========
|
||||||
Calls other scripts with the `lint-` prefix.
|
Calls other scripts with the `lint-` prefix.
|
||||||
|
36
test/lint/lint-all.py
Executable file
36
test/lint/lint-all.py
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright (c) 2017-2022 The Bitcoin Core developers
|
||||||
|
# Distributed under the MIT software license, see the accompanying
|
||||||
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||||
|
#
|
||||||
|
# This script runs all test/lint/lint-* files, and fails if any exit
|
||||||
|
# with a non-zero status code.
|
||||||
|
|
||||||
|
from glob import glob
|
||||||
|
from os import path as os_path, remove
|
||||||
|
from pathlib import Path
|
||||||
|
from shutil import which
|
||||||
|
from subprocess import run
|
||||||
|
|
||||||
|
exit_code = 0
|
||||||
|
mod_path = Path(__file__).parent
|
||||||
|
lints = [x for x in glob(f"{mod_path}/lint-*") if x != __file__]
|
||||||
|
if which("parallel") and which("column"):
|
||||||
|
logfile = "parallel_out.log"
|
||||||
|
command = ["parallel", "--jobs", "100%", "--will-cite", "--joblog", logfile, ":::"] + lints
|
||||||
|
result = run(command)
|
||||||
|
if result.returncode != 0:
|
||||||
|
print(f"^---- failure generated")
|
||||||
|
exit_code = result.returncode
|
||||||
|
result = run(["column", "-t", logfile])
|
||||||
|
if os_path.isfile(logfile):
|
||||||
|
remove(logfile)
|
||||||
|
else:
|
||||||
|
for lint in lints:
|
||||||
|
result = run([lint])
|
||||||
|
if result.returncode != 0:
|
||||||
|
print(f"^---- failure generated from {lint.split('/')[-1]}")
|
||||||
|
exit_code |= result.returncode
|
||||||
|
|
||||||
|
exit(exit_code)
|
@ -1,46 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Copyright (c) 2017-2019 The Bitcoin Core developers
|
|
||||||
# Distributed under the MIT software license, see the accompanying
|
|
||||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
||||||
#
|
|
||||||
# This script runs all contrib/devtools/lint-* files, and fails if any exit
|
|
||||||
# with a non-zero status code.
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
|
|
||||||
set -u
|
|
||||||
|
|
||||||
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
|
|
||||||
LINTALL=$(basename "${BASH_SOURCE[0]}")
|
|
||||||
|
|
||||||
EXIT_CODE=0
|
|
||||||
|
|
||||||
if ! command -v parallel > /dev/null; then
|
|
||||||
for f in "${SCRIPTDIR}"/lint-*; do
|
|
||||||
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
|
||||||
if ! "$f"; then
|
|
||||||
echo "^---- failure generated from $f"
|
|
||||||
EXIT_CODE=1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
else
|
|
||||||
SCRIPTS=()
|
|
||||||
|
|
||||||
for f in "${SCRIPTDIR}"/lint-*; do
|
|
||||||
if [ "$(basename "$f")" != "$LINTALL" ]; then
|
|
||||||
SCRIPTS+=("$f")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if ! parallel --jobs 100% --will-cite --joblog parallel_out.log ::: "${SCRIPTS[@]}"; then
|
|
||||||
echo "^---- failure generated"
|
|
||||||
EXIT_CODE=1
|
|
||||||
fi
|
|
||||||
column -t parallel_out.log && rm parallel_out.log
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit ${EXIT_CODE}
|
|
Loading…
Reference in New Issue
Block a user