From 2bf9d36ccd59f12e3895c885e8cf17e620bf191b Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 16:02:53 +0300 Subject: ci: Refactor CI scripts 1. CI_TARGET now determines which run_${CI_TARGET}.sh script to use. Defaults to `tests`. 2. Build no longer halts on the first failing suit: e.g. if functional tests failed it will continue with unit tests, etc. 3. All ${MAKE_CMD} occurrences moved to `top_make` function, added `build_make` as an alias to `make -C build` (`"${MAKE_CMD}" -C "${BUILD_DIR}"`) which is too verbose. `suite.sh` was copied from powerline (tests/common.sh file), assumes running with POSIX shells (and actually uses dash in powerline). Then some convenience functions were added (run_test and below). --- ci/common/suite.sh | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 ci/common/suite.sh (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh new file mode 100644 index 0000000000..ad7c30708f --- /dev/null +++ b/ci/common/suite.sh @@ -0,0 +1,55 @@ +FAILED=0 + +FAIL_SUMMARY="" + +enter_suite() { + local suite_name="$1" + export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name" +} + +exit_suite() { + if test $FAILED -ne 0 ; then + echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" + echo "${FAIL_SUMMARY}" + fi + export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" + if test "x$1" != "x--continue" ; then + exit $FAILED + fi +} + +fail() { + local allow_failure= + if test "x$1" = "x--allow-failure" ; then + shift + allow_failure=A + fi + local test_name="$1" + local fail_char="$allow_failure$2" + local message="$3" + + : ${fail_char:=F} + : ${message:=Test $test_name failed} + + local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message" + FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}" + echo "Failed: $full_msg" + if test "x$allow_failure" = "x" ; then + FAILED=1 + fi +} + +run_test() { + local cmd="$1" + shift + local test_name="$1" + : ${test_name:=$cmd} + shift + if ! eval "$cmd" ; then + fail "${test_name}" "$@" + fi +} + +succeeded() { + return $FAILED +} -- cgit From 4c20733f6bbdcfe2a230766aa6b602681a399ac8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 16:19:47 +0300 Subject: ci: Add ${NL} variable --- ci/common/suite.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index ad7c30708f..e8c6a2b07a 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -1,3 +1,7 @@ +# HACK: get newline for use in strings given that "\n" and $'' do not work. +NL="$(printf '\nE')" +NL="${NL%E}" + FAILED=0 FAIL_SUMMARY="" -- cgit From 86f5b1276bf444b164ac3a3b60b411afe4bd7ec4 Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 19:42:18 +0300 Subject: ci: Add test watchdog and tracing for lint tests --- ci/common/suite.sh | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index e8c6a2b07a..8c44e5f974 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -54,6 +54,54 @@ run_test() { fi } +run_test_wd() { + local timeout="$1" + shift + local cmd="$1" + shift + local test_name="$1" + : ${test_name:=$cmd} + shift + local output_file="$(mktemp)" + local status_file="$(mktemp)" + local restarts=5 + local prev_tmpsize=-1 + while test $restarts -gt 0 ; do + : > "${status_file}" + ( + if ! ( + set -o pipefail + eval "$cmd" 2>&1 | tee -a "$output_file" + ) ; then + fail "${test_name}" "$@" + fi + echo "$FAILED" > "$status_file" + ) & + local pid=$! + while test "$(stat -c "%s" "$status_file")" -eq 0 ; do + prev_tmpsize=$tmpsize + sleep $timeout + tmpsize="$(stat -c "%s" "$output_file")" + if test $tempsize -eq $prev_temsize ; then + # no output, assuming either hang or exit + break + fi + done + if test "$(stat -c "%s" "$status_file")" -eq 0 ; then + # status file not updated, assuming hang + kill -KILL $pid + echo "Test ${test_name} hang up, restarting" + else + local new_failed="$(cat "$status_file")" + if test "x$new_failed" != "x0" ; then + fail "${test_name}" F "Test failed in run_test_wd" + fi + return 0 + fi + restarts=$[ restarts - 1 ] + done +} + succeeded() { return $FAILED } -- cgit From 6ddaace7ac9f2ed13d7b210d87c715c9f7209c7f Mon Sep 17 00:00:00 2001 From: ZyX Date: Fri, 31 Mar 2017 20:52:05 +0300 Subject: ci: Do not shift if there are not enough arguments --- ci/common/suite.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 8c44e5f974..a70cafc92c 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -45,10 +45,10 @@ fail() { run_test() { local cmd="$1" - shift + test $# -gt 0 && shift local test_name="$1" : ${test_name:=$cmd} - shift + test $# -gt 0 && shift if ! eval "$cmd" ; then fail "${test_name}" "$@" fi @@ -56,12 +56,12 @@ run_test() { run_test_wd() { local timeout="$1" - shift + test $# -gt 0 && shift local cmd="$1" - shift + test $# -gt 0 && shift local test_name="$1" : ${test_name:=$cmd} - shift + test $# -gt 0 && shift local output_file="$(mktemp)" local status_file="$(mktemp)" local restarts=5 -- cgit From ae7d8d8ffb86eefa45d8f59834eb0f088e93535d Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 3 Apr 2017 03:47:42 +0300 Subject: ci: Do not mark test as failed if it is previous one which failed --- ci/common/suite.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index a70cafc92c..5c79ce2718 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -69,6 +69,7 @@ run_test_wd() { while test $restarts -gt 0 ; do : > "${status_file}" ( + FAILED=0 if ! ( set -o pipefail eval "$cmd" 2>&1 | tee -a "$output_file" -- cgit From 644db2165e3437be66d11e46624124c99cfb810e Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 03:58:10 +0300 Subject: ci: Clean up when restarting single includes test --- ci/common/suite.sh | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 5c79ce2718..44a560c50a 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -57,13 +57,21 @@ run_test() { run_test_wd() { local timeout="$1" test $# -gt 0 && shift + local cmd="$1" test $# -gt 0 && shift + + local restart_cmd="$1" + : ${restart_cmd:=true} + test $# -gt 0 && shift + local test_name="$1" : ${test_name:=$cmd} test $# -gt 0 && shift + local output_file="$(mktemp)" local status_file="$(mktemp)" + local restarts=5 local prev_tmpsize=-1 while test $restarts -gt 0 ; do @@ -92,6 +100,7 @@ run_test_wd() { # status file not updated, assuming hang kill -KILL $pid echo "Test ${test_name} hang up, restarting" + eval "$restart_cmd" else local new_failed="$(cat "$status_file")" if test "x$new_failed" != "x0" ; then -- cgit From 017f64b9707955e66319e07e6e8f173b29583235 Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 04:59:30 +0300 Subject: ci: Also fail if last restart hang up --- ci/common/suite.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 44a560c50a..46207754fa 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -96,11 +96,16 @@ run_test_wd() { break fi done + restarts=$[ restarts - 1 ] if test "$(stat -c "%s" "$status_file")" -eq 0 ; then # status file not updated, assuming hang kill -KILL $pid - echo "Test ${test_name} hang up, restarting" - eval "$restart_cmd" + if test $restarts -eq 0 ; then + fail "${test_name}" E "Test hang up" + else + echo "Test ${test_name} hang up, restarting" + eval "$restart_cmd" + fi else local new_failed="$(cat "$status_file")" if test "x$new_failed" != "x0" ; then @@ -108,7 +113,6 @@ run_test_wd() { fi return 0 fi - restarts=$[ restarts - 1 ] done } -- cgit From c1416e066534363e35b8895c30d7d7ce90e8b509 Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 20:15:30 +0300 Subject: ci: Really continue tests on failure, print global summary --- ci/common/suite.sh | 58 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 20 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 46207754fa..e22252c985 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -2,11 +2,18 @@ NL="$(printf '\nE')" NL="${NL%E}" -FAILED=0 - FAIL_SUMMARY="" +# 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" + enter_suite() { + FAILED=0 + rm -f "${END_MARKER}" local suite_name="$1" export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name" } @@ -19,17 +26,16 @@ exit_suite() { export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" if test "x$1" != "x--continue" ; then exit $FAILED + else + local saved_failed=$FAILED + FAILED=0 + return $saved_failed fi } fail() { - local allow_failure= - if test "x$1" = "x--allow-failure" ; then - shift - allow_failure=A - fi local test_name="$1" - local fail_char="$allow_failure$2" + local fail_char="$2" local message="$3" : ${fail_char:=F} @@ -37,10 +43,9 @@ fail() { local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message" FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}" + echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}" echo "Failed: $full_msg" - if test "x$allow_failure" = "x" ; then - FAILED=1 - fi + FAILED=1 } run_test() { @@ -77,14 +82,13 @@ run_test_wd() { while test $restarts -gt 0 ; do : > "${status_file}" ( - FAILED=0 - if ! ( - set -o pipefail - eval "$cmd" 2>&1 | tee -a "$output_file" - ) ; then - fail "${test_name}" "$@" + set -o pipefail + ret=0 + if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then + ret=1 fi - echo "$FAILED" > "$status_file" + echo "$ret" > "$status_file" + exit $ret ) & local pid=$! while test "$(stat -c "%s" "$status_file")" -eq 0 ; do @@ -116,6 +120,20 @@ run_test_wd() { done } -succeeded() { - return $FAILED +ended_successfully() { + if [[ -f "${FAIL_SUMMARY_FILE}" ]]; then + echo 'Test failed, complete summary:' + cat "${FAIL_SUMMARY_FILE}" + return 1 + fi + if ! [[ -f "${END_MARKER}" ]] ; then + echo 'ended_successfully called before end marker was touched' + return 1 + fi + return 0 +} + +end_tests() { + touch "${END_MARKER}" + ended_successfully } -- cgit From 3321232c814f2847e835a6aaaf72b257cb4f6432 Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 8 Apr 2017 00:46:32 +0300 Subject: ci: Allow check-single-includes to hang --- ci/common/suite.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index e22252c985..568d5d5bee 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -60,6 +60,12 @@ run_test() { } run_test_wd() { + local hang_ok= + if test "x$1" = "x--allow-hang" ; then + hang_ok=1 + shift + fi + local timeout="$1" test $# -gt 0 && shift @@ -105,7 +111,9 @@ run_test_wd() { # status file not updated, assuming hang kill -KILL $pid if test $restarts -eq 0 ; then - fail "${test_name}" E "Test hang up" + if test "x$hang_ok" = "x" ; then + fail "${test_name}" E "Test hang up" + fi else echo "Test ${test_name} hang up, restarting" eval "$restart_cmd" -- cgit From 26fad863bad65ab66ca34b0879b13868d8aa0d97 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 18:27:33 +0300 Subject: ci: When using restarting tests kill make with the shell --- ci/common/suite.sh | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 568d5d5bee..75bdb5abfb 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -82,21 +82,27 @@ run_test_wd() { local output_file="$(mktemp)" local status_file="$(mktemp)" + local sid_file="$(mktemp)" local restarts=5 local prev_tmpsize=-1 while test $restarts -gt 0 ; do : > "${status_file}" - ( - set -o pipefail - ret=0 - if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then - ret=1 - fi - echo "$ret" > "$status_file" - exit $ret - ) & - local pid=$! + setsid \ + env \ + output_file="$output_file" \ + status_file="$status_file" \ + sid_file="$sid_file" \ + cmd="$cmd" \ + sh -c ' + set -o pipefail + ps -o sid= > "$sid_file" + ret=0 + if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then + ret=1 + fi + echo "$ret" > "$status_file" + ' while test "$(stat -c "%s" "$status_file")" -eq 0 ; do prev_tmpsize=$tmpsize sleep $timeout @@ -106,13 +112,13 @@ run_test_wd() { break fi done - restarts=$[ restarts - 1 ] + restarts=$(( restarts - 1 )) if test "$(stat -c "%s" "$status_file")" -eq 0 ; then # status file not updated, assuming hang - kill -KILL $pid + pkill -KILL -s$(cat "$sid_file") if test $restarts -eq 0 ; then if test "x$hang_ok" = "x" ; then - fail "${test_name}" E "Test hang up" + fail "$test_name" E "Test hang up" fi else echo "Test ${test_name} hang up, restarting" @@ -121,11 +127,15 @@ run_test_wd() { else local new_failed="$(cat "$status_file")" if test "x$new_failed" != "x0" ; then - fail "${test_name}" F "Test failed in run_test_wd" + fail "$test_name" F "Test failed in run_test_wd" fi - return 0 + break fi done + + rm -f "$output_file" + rm -f "$status_file" + rm -f "$sid_file" } ended_successfully() { -- cgit From 3a0117c850a69b70bf2a39e9f2e61220a1e7f228 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 18:34:47 +0300 Subject: ci: Do not accidentally kill something unneeded --- ci/common/suite.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 75bdb5abfb..986c145736 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -87,7 +87,8 @@ run_test_wd() { local restarts=5 local prev_tmpsize=-1 while test $restarts -gt 0 ; do - : > "${status_file}" + : > "$status_file" + : > "$sid_file" setsid \ env \ output_file="$output_file" \ @@ -114,8 +115,18 @@ run_test_wd() { done restarts=$(( restarts - 1 )) if test "$(stat -c "%s" "$status_file")" -eq 0 ; then - # status file not updated, assuming hang + # Status file not updated, assuming hang + + # SID not known, this should not ever happen + if test "$(stat -c "%s" "$sid_file")" -eq 0 ; then + fail "$test_name" E "Shell did not run" + break + fi + + # Kill all processes which belong to one session: should get rid of test + # processes as well as sh itself. pkill -KILL -s$(cat "$sid_file") + if test $restarts -eq 0 ; then if test "x$hang_ok" = "x" ; then fail "$test_name" E "Test hang up" -- cgit From fc16d02c3dc8482fb41501f834083146680f41f8 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 19:30:28 +0300 Subject: ci: Do not use pipefail --- ci/common/suite.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 986c145736..4fa8256ee8 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -96,7 +96,6 @@ run_test_wd() { sid_file="$sid_file" \ cmd="$cmd" \ sh -c ' - set -o pipefail ps -o sid= > "$sid_file" ret=0 if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then -- cgit From 4ccef05829bc9956207299215672c2e8c3e51c43 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 21:43:27 +0300 Subject: ci: Make $cmd failure fail the build without -o pipefail --- ci/common/suite.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 4fa8256ee8..c4120c8584 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -97,11 +97,13 @@ run_test_wd() { cmd="$cmd" \ sh -c ' ps -o sid= > "$sid_file" - ret=0 - if ! eval "$cmd" 2>&1 | tee -a "$output_file" ; then - ret=1 - fi - echo "$ret" > "$status_file" + ( + ret=0 + if ! eval "$cmd" 2>&1 ; then + ret=1 + fi + echo "$ret" > "$status_file" + ) | tee -a "$output_file" ' while test "$(stat -c "%s" "$status_file")" -eq 0 ; do prev_tmpsize=$tmpsize -- cgit From 85903cb0e6a2428c5a071ed78b12a9f95e56792b Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 22:14:32 +0300 Subject: ci: Make scripts in common be dash-compatible `ulimit` may still be not present: dash and busybox support it, but posh does not. --- ci/common/suite.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index c4120c8584..9eba5ca664 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -151,12 +151,12 @@ run_test_wd() { } ended_successfully() { - if [[ -f "${FAIL_SUMMARY_FILE}" ]]; then + if test -f "${FAIL_SUMMARY_FILE}" ; then echo 'Test failed, complete summary:' cat "${FAIL_SUMMARY_FILE}" return 1 fi - if ! [[ -f "${END_MARKER}" ]] ; then + if ! test -f "${END_MARKER}" ; then echo 'ended_successfully called before end marker was touched' return 1 fi -- cgit From 74d5705ca9de7ce0a1edef65590594a55c1a4ea3 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 22:17:34 +0300 Subject: ci: Source ci/common/test.sh in run_test_wd subshell --- ci/common/suite.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 9eba5ca664..860e7f79ea 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -95,7 +95,9 @@ run_test_wd() { status_file="$status_file" \ sid_file="$sid_file" \ cmd="$cmd" \ + CI_DIR="$CI_DIR" \ sh -c ' + . "${CI_DIR}/common/test.sh" ps -o sid= > "$sid_file" ( ret=0 -- cgit From ee4daa65723df100ce58d132243747aad48d4f12 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 24 Apr 2017 23:11:13 +0300 Subject: ci: Remove `x` from `test x` --- ci/common/suite.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 860e7f79ea..a6fe7dd650 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -24,7 +24,7 @@ exit_suite() { echo "${FAIL_SUMMARY}" fi export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" - if test "x$1" != "x--continue" ; then + if test "$1" != "--continue" ; then exit $FAILED else local saved_failed=$FAILED @@ -61,7 +61,7 @@ run_test() { run_test_wd() { local hang_ok= - if test "x$1" = "x--allow-hang" ; then + if test "$1" = "--allow-hang" ; then hang_ok=1 shift fi @@ -131,7 +131,7 @@ run_test_wd() { pkill -KILL -s$(cat "$sid_file") if test $restarts -eq 0 ; then - if test "x$hang_ok" = "x" ; then + if test -z "$hang_ok" ; then fail "$test_name" E "Test hang up" fi else @@ -140,7 +140,7 @@ run_test_wd() { fi else local new_failed="$(cat "$status_file")" - if test "x$new_failed" != "x0" ; then + if test "$new_failed" != "0" ; then fail "$test_name" F "Test failed in run_test_wd" fi break -- cgit From 48fa42153acbf271db8edc94f94b524eb5b492e0 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 1 May 2017 06:45:24 +0300 Subject: ci: Fold output in travis web interface --- ci/common/suite.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index a6fe7dd650..54afa28be6 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -11,14 +11,35 @@ FAIL_SUMMARY="" END_MARKER="$BUILD_DIR/.tests_finished" FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" +ANSI_CLEAR="\033[0K" + +travis_fold() { + local action="$1" + local name="$2" + name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\+/-/g')" + name="$(echo -n "$name" | sed 's/-$//')" + echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" +} + +if test "$TRAVIS" != "true" ; then + travis_fold() { + return 0 + } +fi + enter_suite() { + set +x FAILED=0 rm -f "${END_MARKER}" local suite_name="$1" export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name" + travis_fold start "${NVIM_TEST_CURRENT_SUITE}" + set -x } exit_suite() { + set +x + travis_fold end "${NVIM_TEST_CURRENT_SUITE}" if test $FAILED -ne 0 ; then echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" echo "${FAIL_SUMMARY}" -- cgit From 1109ca7198a73dd26061817c6548410cb33debb4 Mon Sep 17 00:00:00 2001 From: ZyX Date: Mon, 1 May 2017 17:36:45 +0300 Subject: ci: Use \{1,\} in place of \+ --- ci/common/suite.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 54afa28be6..8feb642547 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -16,7 +16,7 @@ ANSI_CLEAR="\033[0K" travis_fold() { local action="$1" local name="$2" - name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\+/-/g')" + name="$(echo -n "$name" | tr '\n\0' '--' | sed 's/[^A-Za-z0-9]\{1,\}/-/g')" name="$(echo -n "$name" | sed 's/-$//')" echo -en "travis_fold:${action}:${name}\r${ANSI_CLEAR}" } -- cgit From eb6dd3e42dc38460e8624dc5faef894e21c6aa26 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Tue, 30 May 2017 14:54:09 +0200 Subject: ci: Dump $NVIM_LOG_FILE contents --- ci/common/suite.sh | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'ci/common/suite.sh') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 8feb642547..d3fbcd1eda 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -39,6 +39,13 @@ enter_suite() { exit_suite() { set +x + if test -f "$NVIM_LOG_FILE" ; then + printf "===============================================================================\n" + printf "NVIM_LOG_FILE: $NVIM_LOG_FILE\n" + cat "$NVIM_LOG_FILE" 2>/dev/null || printf '(empty)' + printf "\n" + rm -rf "$NVIM_LOG_FILE" + fi travis_fold end "${NVIM_TEST_CURRENT_SUITE}" if test $FAILED -ne 0 ; then echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" -- cgit