diff --git a/contrib/devtools/smoke-tests.sh b/contrib/devtools/smoke-tests.sh new file mode 100755 --- /dev/null +++ b/contrib/devtools/smoke-tests.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +# Copyright (c) 2020 The Bitcoin developers +# Distributed under the MIT software license, see the accompanying +# file COPYING or http://www.opensource.org/licenses/mit-license.php. + +# Note: Smoke tests should focus on speed rather than coverage so they +# can be used as a quick sanity check. Do not put long-running tests +# in this script. + +export LC_ALL=C.UTF-8 + +set -euxo pipefail + +echo "Running smoke tests..." + +# Lint checks +LINT_OUTPUT=$(arc lint --never-apply-patches) +LINT_EXIT_CODE=$? +# If there is more than one line of output, then lint advice lines are likely present. +# We treat these as errors since they appear as such during review anyway. +LINT_NUM_LINES=$(echo ${LINT_OUTPUT} | wc -l) +if [ "${LINT_EXIT_CODE}" -ne 0 ] || [ "${LINT_NUM_LINES}" -gt 1 ]; then + echo "Error: There are lint issues." + exit 1 +fi + +# Unit and functional test coverage +TOPLEVEL=$(git rev-parse --show-toplevel) +DEVTOOLS_DIR="${TOPLEVEL}"/contrib/devtools +BUILD_DIR="${TOPLEVEL}"/build +mkdir -p "${BUILD_DIR}" +export BUILD_DIR + +pushd "${BUILD_DIR}" +"${DEVTOOLS_DIR}"/build_cmake.sh +ninja check-bitcoin check-functional +popd diff --git a/contrib/source-control-tools/automated-commits.sh b/contrib/source-control-tools/automated-commits.sh --- a/contrib/source-control-tools/automated-commits.sh +++ b/contrib/source-control-tools/automated-commits.sh @@ -201,23 +201,8 @@ ;; esac -echo "Sanity checks..." - -LINT_OUTPUT=$(arc lint --never-apply-patches) -LINT_EXIT_CODE=$? -# If there is more than one line of output, then lint advice lines are likely present. -# We treat these as errors because code generators should always produce lint-free code. -LINT_NUM_LINES=$(echo ${LINT_OUTPUT} | wc -l) -if [ "${LINT_EXIT_CODE}" -ne 0 ] || [ "${LINT_NUM_LINES}" -gt 1 ]; then - echo "Error: The linter found issues with the automated commit. Correct the issue in the code generator and try again." - exit 20 -fi - # Smoke tests to give some confidence that master won't be put into a bad state -pushd "${BUILD_DIR}" -"${DEVTOOLS_DIR}"/build_cmake.sh -ninja check-bitcoin check-functional -popd +"${DEVTOOLS_DIR}"/smoke-tests.sh echo "Pushing automated commit '${COMMIT_TYPE}'..."