From 2294210660056df2f8abb277776cfd68f3fb1156 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:32:17 +0100 Subject: [PATCH] ci: remove fail summary (#22174) The tests already have a summary at the end, there's no need for an additional fail summary wrapper. --- ci/before_cache.sh | 6 +----- ci/common/suite.sh | 30 ------------------------------ ci/common/test.sh | 14 +++++++++++--- ci/run_tests.sh | 6 +----- src/nvim/testdir/runnvim.sh | 1 - src/nvim/testdir/suite.sh | 26 -------------------------- src/nvim/testdir/test.sh | 11 ++++++++++- 7 files changed, 23 insertions(+), 71 deletions(-) delete mode 100644 ci/common/suite.sh diff --git a/ci/before_cache.sh b/ci/before_cache.sh index 7bf66221ae..94c18bd2cf 100755 --- a/ci/before_cache.sh +++ b/ci/before_cache.sh @@ -3,14 +3,10 @@ set -e set -o pipefail -CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/suite.sh" - mkdir -p "$CACHE_DIR" # Update the third-party dependency cache only if the build was successful. -if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then +if [ -d "${DEPS_BUILD_DIR}" ]; then # Do not cache downloads. They should not be needed with up-to-date deps. rm -rf "${DEPS_BUILD_DIR}/build/downloads" rm -rf "${CACHE_NVIM_DEPS_DIR}" diff --git a/ci/common/suite.sh b/ci/common/suite.sh deleted file mode 100644 index d13546823b..0000000000 --- a/ci/common/suite.sh +++ /dev/null @@ -1,30 +0,0 @@ -# If FAIL_SUMMARY_FILE exists we know that some tests failed, this file will -# contain information about failed tests. Build is considered successful if -# tests ended without any of them failing. -FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" - -fail() { - local test_name="$1" - local message="$2" - - : "${message:=Test $test_name failed}" - - local full_msg="$test_name :: $message" - echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}" - echo "Failed: $full_msg" - export FAILED=1 -} - -ended_successfully() { - if test -f "${FAIL_SUMMARY_FILE}" ; then - echo 'Test failed, complete summary:' - cat "${FAIL_SUMMARY_FILE}" - - if [[ "$GITHUB_ACTIONS" == "true" ]]; then - rm -f "$FAIL_SUMMARY_FILE" - fi - - return 1 - fi - return 0 -} diff --git a/ci/common/test.sh b/ci/common/test.sh index c3b8d45b9f..f6e20d8f59 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -1,4 +1,13 @@ -. "${CI_DIR}/common/suite.sh" +fail() { + local test_name="$1" + local message="$2" + + : "${message:=Test $test_name failed}" + + local full_msg="$test_name :: $message" + echo "Failed: $full_msg" + exit 1 +} submit_coverage() { if [ -n "${GCOV}" ]; then @@ -124,7 +133,7 @@ check_runtime_files() {( local message="$1" ; shift local tst="$1" ; shift - cd runtime + cd runtime || exit for file in $(git ls-files "$@") ; do # Check that test is not trying to work with files with spaces/etc # Prefer failing the build over using more robust construct because files @@ -141,7 +150,6 @@ check_runtime_files() {( install_nvim() {( if ! ninja -C "${BUILD_DIR}" install; then fail 'install' 'make install failed' - exit 1 fi "${INSTALL_PREFIX}/bin/nvim" --version diff --git a/ci/run_tests.sh b/ci/run_tests.sh index f04165d37a..f777026ac2 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -6,8 +6,6 @@ set -o pipefail CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source-path=SCRIPTDIR source "${CI_DIR}/common/test.sh" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/suite.sh" build_nvim() { check_core_dumps --delete quiet @@ -53,11 +51,9 @@ else fi for i in "${tests[@]}"; do - eval "$i" || fail "$i" + eval "$i" || exit done -ended_successfully - if [[ -s "${GCOV_ERROR_FILE}" ]]; then echo '=== Unexpected gcov errors: ===' cat "${GCOV_ERROR_FILE}" diff --git a/src/nvim/testdir/runnvim.sh b/src/nvim/testdir/runnvim.sh index f316c7376e..4d8ea0527d 100755 --- a/src/nvim/testdir/runnvim.sh +++ b/src/nvim/testdir/runnvim.sh @@ -26,7 +26,6 @@ main() {( export BUILD_DIR export FAILED=0 - . $(dirname $0)/suite.sh . $(dirname $0)/test.sh # Redirect XDG_CONFIG_HOME so users local config doesn't interfere diff --git a/src/nvim/testdir/suite.sh b/src/nvim/testdir/suite.sh index 3059773ca1..bf5a16fd89 100644 --- a/src/nvim/testdir/suite.sh +++ b/src/nvim/testdir/suite.sh @@ -1,10 +1,3 @@ -# Test success marker. If END_MARKER file exists, we know that all tests -# finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this -# file will contain information about failed tests. Build is considered -# successful if tests ended without any of them failing. -END_MARKER="$BUILD_DIR/.tests_finished" -FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" - fail() { local test_name="$1" local message="$2" @@ -12,25 +5,6 @@ fail() { : "${message:=Test $test_name failed}" local full_msg="$test_name :: $message" - echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}" echo "Failed: $full_msg" export FAILED=1 } - -ended_successfully() { - if test -f "${FAIL_SUMMARY_FILE}" ; then - echo 'Test failed, complete summary:' - cat "${FAIL_SUMMARY_FILE}" - - if [[ "$GITHUB_ACTIONS" == "true" ]]; then - rm -f "$FAIL_SUMMARY_FILE" - fi - - return 1 - fi - if ! test -f "${END_MARKER}" ; then - echo 'ended_successfully called before end marker was touched' - return 1 - fi - return 0 -} diff --git a/src/nvim/testdir/test.sh b/src/nvim/testdir/test.sh index eab1736c32..affdc308d1 100644 --- a/src/nvim/testdir/test.sh +++ b/src/nvim/testdir/test.sh @@ -1,4 +1,13 @@ -. $(dirname $0)/suite.sh +fail() { + local test_name="$1" + local message="$2" + + : "${message:=Test $test_name failed}" + + local full_msg="$test_name :: $message" + echo "Failed: $full_msg" + export FAILED=1 +} print_core() { local app="$1"