diff options
author | ZyX <kp-pav@yandex.ru> | 2017-03-31 19:42:18 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-31 19:42:18 +0300 |
commit | 86f5b1276bf444b164ac3a3b60b411afe4bd7ec4 (patch) | |
tree | e0869ee4475529f19282300f05d285b78c337aac | |
parent | 929c398aab786473e6c28998862cbd1356de0166 (diff) | |
download | rneovim-86f5b1276bf444b164ac3a3b60b411afe4bd7ec4.tar.gz rneovim-86f5b1276bf444b164ac3a3b60b411afe4bd7ec4.tar.bz2 rneovim-86f5b1276bf444b164ac3a3b60b411afe4bd7ec4.zip |
ci: Add test watchdog and tracing for lint tests
-rw-r--r-- | ci/common/suite.sh | 48 | ||||
-rwxr-xr-x | ci/run_lint.sh | 4 |
2 files changed, 51 insertions, 1 deletions
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 } diff --git a/ci/run_lint.sh b/ci/run_lint.sh index c7937930d1..5122ffc2b6 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -10,8 +10,10 @@ source "${CI_DIR}/common/suite.sh" enter_suite 'lint' +set -x + run_test 'top_make clint-full' clint run_test 'top_make testlint' testlint -run_test 'top_make check-single-includes' single-includes +run_test_wd 5s 'top_make check-single-includes' single-includes exit_suite |