summaryrefslogtreecommitdiff
path: root/travis-ci
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2018-11-14 10:38:59 +0100
committerLennart Poettering <lennart@poettering.net>2018-11-14 16:17:04 +0100
commitd419b75ce96106839e2bc7edd8f05b372c923e72 (patch)
tree80f19708a1ad45989de259b4878fc87c61e6679d /travis-ci
parentb5be61d1ed6d29fa811830654854267d723567ce (diff)
downloadsystemd-d419b75ce96106839e2bc7edd8f05b372c923e72.tar.gz
travis: use double the normal timeout in the ASan & UBSan stage
This should somewhat address https://github.com/systemd/systemd/issues/10696.
Diffstat (limited to 'travis-ci')
-rwxr-xr-xtravis-ci/managers/fedora.sh4
-rw-r--r--travis-ci/managers/travis_wait.bash59
2 files changed, 62 insertions, 1 deletions
diff --git a/travis-ci/managers/fedora.sh b/travis-ci/managers/fedora.sh
index 8b7b3c873d..077595c482 100755
--- a/travis-ci/managers/fedora.sh
+++ b/travis-ci/managers/fedora.sh
@@ -23,6 +23,8 @@ function info() {
set -e
+source "$(dirname $0)/travis_wait.bash"
+
for phase in "${PHASES[@]}"; do
case $phase in
SETUP)
@@ -55,7 +57,7 @@ for phase in "${PHASES[@]}"; do
$DOCKER_EXEC ninja -v -C build
# Never remove halt_on_error from UBSAN_OPTIONS. See https://github.com/systemd/systemd/commit/2614d83aa06592aedb.
- $DOCKER_EXEC sh -c "UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 meson test --timeout-multiplier=3 -C ./build/ --print-errorlogs"
+ travis_wait docker exec --interactive=false -t $CONT_NAME sh -c "UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1 meson test --timeout-multiplier=3 -C ./build/ --print-errorlogs"
;;
CLEANUP)
info "Cleanup phase"
diff --git a/travis-ci/managers/travis_wait.bash b/travis-ci/managers/travis_wait.bash
new file mode 100644
index 0000000000..3de9b9b0cd
--- /dev/null
+++ b/travis-ci/managers/travis_wait.bash
@@ -0,0 +1,59 @@
+# This was borrowed from https://github.com/travis-ci/travis-build/tree/master/lib/travis/build/bash
+# to get around https://github.com/travis-ci/travis-ci/issues/9979. It should probably be removed
+# as soon as Travis CI has started to provide an easy way to export the functions to bash scripts.
+
+travis_jigger() {
+ local cmd_pid="${1}"
+ shift
+ local timeout="${1}"
+ shift
+ local count=0
+
+ echo -e "\\n"
+
+ while [[ "${count}" -lt "${timeout}" ]]; do
+ count="$((count + 1))"
+ echo -ne "Still running (${count} of ${timeout}): ${*}\\r"
+ sleep 60
+ done
+
+ echo -e "\\n${ANSI_RED}Timeout (${timeout} minutes) reached. Terminating \"${*}\"${ANSI_RESET}\\n"
+ kill -9 "${cmd_pid}"
+}
+
+travis_wait() {
+ local timeout="${1}"
+
+ if [[ "${timeout}" =~ ^[0-9]+$ ]]; then
+ shift
+ else
+ timeout=20
+ fi
+
+ local cmd=("${@}")
+ local log_file="travis_wait_${$}.log"
+
+ "${cmd[@]}" &>"${log_file}" &
+ local cmd_pid="${!}"
+
+ travis_jigger "${!}" "${timeout}" "${cmd[@]}" &
+ local jigger_pid="${!}"
+ local result
+
+ {
+ wait "${cmd_pid}" 2>/dev/null
+ result="${?}"
+ ps -p"${jigger_pid}" &>/dev/null && kill "${jigger_pid}"
+ }
+
+ if [[ "${result}" -eq 0 ]]; then
+ echo -e "\\n${ANSI_GREEN}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
+ else
+ echo -e "\\n${ANSI_RED}The command ${cmd[*]} exited with ${result}.${ANSI_RESET}"
+ fi
+
+ echo -e "\\n${ANSI_GREEN}Log:${ANSI_RESET}\\n"
+ cat "${log_file}"
+
+ return "${result}"
+}