From 644db2165e3437be66d11e46624124c99cfb810e Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 03:58:10 +0300 Subject: [PATCH 1/4] ci: Clean up when restarting single includes test --- ci/common/suite.sh | 9 +++++++++ ci/run_lint.sh | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) 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 diff --git a/ci/run_lint.sh b/ci/run_lint.sh index 5122ffc2b6..d2807e425e 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -12,8 +12,13 @@ enter_suite 'lint' set -x +csi_clean() { + rm "${BUILD_DIR}"/bin/test-includes-* + find "${BUILD_DIR}" -name '*test-include*.o' -delete +} + run_test 'top_make clint-full' clint run_test 'top_make testlint' testlint -run_test_wd 5s 'top_make check-single-includes' single-includes +run_test_wd 5s 'top_make check-single-includes' 'csi_clean' single-includes exit_suite From d59378a5cafd3408a1cbecfd8c4de1a96198c81d Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 04:02:54 +0300 Subject: [PATCH 2/4] ci: Force make output coloring --- ci/run_lint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/run_lint.sh b/ci/run_lint.sh index d2807e425e..82a8532850 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -19,6 +19,10 @@ csi_clean() { run_test 'top_make clint-full' clint run_test 'top_make testlint' testlint -run_test_wd 5s 'top_make check-single-includes' 'csi_clean' single-includes +CLICOLOR_FORCE=1 run_test_wd \ + 5s \ + 'top_make check-single-includes' \ + 'csi_clean' \ + single-includes exit_suite From dcad882256af21bb620f580ff8a112691cd149db Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 04:17:40 +0300 Subject: [PATCH 3/4] ci: Do not fail csi_clean if there are no files to remove --- ci/run_lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run_lint.sh b/ci/run_lint.sh index 82a8532850..39a90102e7 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -13,7 +13,7 @@ enter_suite 'lint' set -x csi_clean() { - rm "${BUILD_DIR}"/bin/test-includes-* + find "${BUILD_DIR}/bin" -name 'test-includes-*' -delete find "${BUILD_DIR}" -name '*test-include*.o' -delete } From 017f64b9707955e66319e07e6e8f173b29583235 Mon Sep 17 00:00:00 2001 From: ZyX Date: Tue, 4 Apr 2017 04:59:30 +0300 Subject: [PATCH 4/4] ci: Also fail if last restart hang up --- ci/common/suite.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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 }