diff --git a/tools/ci/bench-base.sh b/tools/ci/bench-base.sh index 9679e41d..5c733657 100755 --- a/tools/ci/bench-base.sh +++ b/tools/ci/bench-base.sh @@ -6,5 +6,5 @@ java -jar "$RENAISSANCE_JAR" --raw-list > list.txt for BENCH in $(cat list.txt); do echo "====> $BENCH" - java -Xms2500M -Xmx2500M -jar "$RENAISSANCE_JAR" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 + timeout_with_thread_dump 5m java -Xms2500M -Xmx2500M -jar "$RENAISSANCE_JAR" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 done diff --git a/tools/ci/bench-standalone.sh b/tools/ci/bench-standalone.sh index cee1b26e..1cc8205b 100755 --- a/tools/ci/bench-standalone.sh +++ b/tools/ci/bench-standalone.sh @@ -8,5 +8,5 @@ unzip "$RENAISSANCE_JAR" -d "extracted-renaissance" for BENCH in $(cat list.txt); do echo "====> $BENCH" - java -Xms2500M -Xmx2500M -jar "./extracted-renaissance/single/$BENCH.jar" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 + timeout_with_thread_dump 5m java -Xms2500M -Xmx2500M -jar "./extracted-renaissance/single/$BENCH.jar" -c test -r 1 --csv output.csv --json output.json "$BENCH" || exit 1 done diff --git a/tools/ci/common.sh b/tools/ci/common.sh index 487656de..d30724e4 100644 --- a/tools/ci/common.sh +++ b/tools/ci/common.sh @@ -67,6 +67,23 @@ get_jvm_workaround_args() { esac } +if command -v timeout >/dev/null; then + TIMEOUT_IMPL=timeout_with_thread_dump_real +else + TIMEOUT_IMPL=timeout_with_thread_dump_fake +fi + +timeout_with_thread_dump_real() { + timeout --signal=3 --kill-after=5s "$@" +} +timeout_with_thread_dump_fake() { + shift + "$@" +} +timeout_with_thread_dump() { + "$TIMEOUT_IMPL" "$@" +} + # Make sure we are in the top-level directory so that we can use # relative paths when referring to files within the project.