aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2022-04-06 10:10:17 +0100
committerfanquake <fanquake@gmail.com>2022-04-06 10:10:41 +0100
commit372f1a3c25813cc79b5484599f0b26f857b99857 (patch)
tree88cd6afeeaaebbe22807e7a6e9585ae3b409b71e /ci
parent27cfaeed1ea975f52c2307153f7295d43bc84b64 (diff)
parentfab24f8c3540b6f1a128cb9d6812df6678472b8d (diff)
downloadbitcoin-372f1a3c25813cc79b5484599f0b26f857b99857.tar.xz
Merge bitcoin/bitcoin#24753: ci: Add clang-tidy task
fab24f8c3540b6f1a128cb9d6812df6678472b8d ci: Add clang-tidy task (MarcoFalke) Pull request description: Fixes #24747 ACKs for top commit: fanquake: ACK fab24f8c3540b6f1a128cb9d6812df6678472b8d vincenzopalazzo: Code Review ACK https://github.com/bitcoin/bitcoin/pull/24753/commits/fab24f8c3540b6f1a128cb9d6812df6678472b8d Tree-SHA512: 87a5d67a23d540cea09925a6c186303c1249d4ca244b95940c5214860bf7a849fa12cc4fcf1bb9270b1004407124b3487902969d8ae9d2b14dae1fdfb57cc7e8
Diffstat (limited to 'ci')
-rwxr-xr-xci/test/00_setup_env.sh1
-rwxr-xr-xci/test/00_setup_env_native_tidy.sh19
-rwxr-xr-xci/test/06_script_a.sh7
-rwxr-xr-xci/test/06_script_b.sh5
4 files changed, 31 insertions, 1 deletions
diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh
index e806683128..5a150d5f80 100755
--- a/ci/test/00_setup_env.sh
+++ b/ci/test/00_setup_env.sh
@@ -37,6 +37,7 @@ export USE_BUSY_BOX=${USE_BUSY_BOX:-false}
export RUN_UNIT_TESTS=${RUN_UNIT_TESTS:-true}
export RUN_FUNCTIONAL_TESTS=${RUN_FUNCTIONAL_TESTS:-true}
+export RUN_TIDY=${RUN_TIDY:-false}
export RUN_SECURITY_TESTS=${RUN_SECURITY_TESTS:-false}
# By how much to scale the test_runner timeouts (option --timeout-factor).
# This is needed because some ci machines have slow CPU or disk, so sanitizers
diff --git a/ci/test/00_setup_env_native_tidy.sh b/ci/test/00_setup_env_native_tidy.sh
new file mode 100755
index 0000000000..7d1f763938
--- /dev/null
+++ b/ci/test/00_setup_env_native_tidy.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 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.
+
+export LC_ALL=C.UTF-8
+
+export DOCKER_NAME_TAG="ubuntu:22.04"
+export CONTAINER_NAME=ci_native_tidy
+export PACKAGES="clang llvm clang-tidy bear libevent-dev libboost-dev"
+export NO_DEPENDS=1
+export RUN_UNIT_TESTS=false
+export RUN_FUNCTIONAL_TESTS=false
+export RUN_FUZZ_TESTS=false
+export RUN_TIDY=true
+export GOAL="install"
+export BITCOIN_CONFIG="CC=clang CXX=clang++ --disable-hardening CFLAGS='-O0 -g0' CXXFLAGS='-O0 -g0'"
+export CCACHE_SIZE=200M
diff --git a/ci/test/06_script_a.sh b/ci/test/06_script_a.sh
index 7158b69b4e..4742cb02ea 100755
--- a/ci/test/06_script_a.sh
+++ b/ci/test/06_script_a.sh
@@ -48,7 +48,12 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
CI_EXEC 'grep -v HAVE_SYS_GETRANDOM src/config/bitcoin-config.h > src/config/bitcoin-config.h.tmp && mv src/config/bitcoin-config.h.tmp src/config/bitcoin-config.h'
fi
-CI_EXEC make "$MAKEJOBS" "$GOAL" || ( echo "Build failure. Verbose build follows." && CI_EXEC make "$GOAL" V=1 ; false )
+if [[ "${RUN_TIDY}" == "true" ]]; then
+ MAYBE_BEAR="bear"
+ MAYBE_TOKEN="--"
+fi
+
+CI_EXEC "${MAYBE_BEAR}" "${MAYBE_TOKEN}" make "$MAKEJOBS" "$GOAL" || ( echo "Build failure. Verbose build follows." && CI_EXEC make "$GOAL" V=1 ; false )
CI_EXEC "ccache --version | head -n 1 && ccache --show-stats"
CI_EXEC du -sh "${DEPENDS_DIR}"/*/
diff --git a/ci/test/06_script_b.sh b/ci/test/06_script_b.sh
index e70d811d5a..30788f1543 100755
--- a/ci/test/06_script_b.sh
+++ b/ci/test/06_script_b.sh
@@ -34,6 +34,11 @@ if [ "$RUN_FUNCTIONAL_TESTS" = "true" ]; then
CI_EXEC LD_LIBRARY_PATH="${DEPENDS_DIR}/${HOST}/lib" "${TEST_RUNNER_ENV}" test/functional/test_runner.py --ci "$MAKEJOBS" --tmpdirprefix "${BASE_SCRATCH_DIR}/test_runner/" --ansi --combinedlogslen=4000 --timeout-factor="${TEST_RUNNER_TIMEOUT_FACTOR}" "${TEST_RUNNER_EXTRA}" --quiet --failfast
fi
+if [ "${RUN_TIDY}" = "true" ]; then
+ export P_CI_DIR="${BASE_BUILD_DIR}/bitcoin-$HOST/src/"
+ CI_EXEC run-clang-tidy "${MAKEJOBS}"
+fi
+
if [ "$RUN_SECURITY_TESTS" = "true" ]; then
CI_EXEC make test-security-check
fi