diff --git a/bazel/test_wrapper.sh b/bazel/test_wrapper.sh index 05f297a4430..372c5b97f35 100755 --- a/bazel/test_wrapper.sh +++ b/bazel/test_wrapper.sh @@ -1,17 +1,43 @@ #!/bin/bash +is_ppc64le() { + local -r arch="$(uname -m)" + [[ "${arch}" == "ppc64le" || "${arch}" == "ppc64" || "${arch}" == "ppc" ]] && return 0 || return 1 +} + +is_s390x() { + local -r arch="$(uname -m)" + [[ "${arch}" == "s390x" || "${arch}" == "s390" ]] && return 0 || return 1 +} + +is_s390x_or_ppc64le() { + if is_ppc64le || is_s390x; then + return 0 + else + return 1 + fi +} + ulimit -c unlimited eval ${@:1} & main_pid=$! echo "Process-under-test started with PID: ${main_pid}" +timeout_seconds=600 + +if is_s390x_or_ppc64le; then + timeout_seconds=$((timeout_seconds * 4)) +fi + +timeout_minutes=$((timeout_seconds / 60)) + ( - sleep 600 + sleep $timeout_seconds # 'kill -0' checks for process existence without sending a signal if kill -0 "$main_pid" 2>/dev/null; then - echo "10 minute Timer finished. Process-under-test ${main_pid} is still running. Sending a SIGABRT to trigger a coredump now." + echo "${timeout_minutes} minute Timer finished. Process-under-test ${main_pid} is still running. Sending a SIGABRT to trigger a coredump now." kill -ABRT "${main_pid}" fi ) &