# HG changeset patch # User KUBOTA Yuji # Date 1491865725 -32400 # Node ID 2412c90533d00d06e53925e4af15abce66f8ab9b # Parent f3d7307b0ee3b493932cd1710398125d260b55f7 Bug 3353: [TEST]Add a test runner for deadlock and thread-recording Reviewed-by: yasuenag https://github.com/HeapStats/heapstats/pull/87 diff -r f3d7307b0ee3 -r 2412c90533d0 ChangeLog --- a/ChangeLog Sat Mar 25 23:42:22 2017 +0900 +++ b/ChangeLog Tue Apr 11 08:08:45 2017 +0900 @@ -1,3 +1,7 @@ +2017-04-10 KUBOTA Yuji + + * Bug 3353: [TEST]Add a test runner for deadlock and thread-recording + 2017-03-25 KUBOTA Yuji * Bug 3342: Replace LDDQU instruction for uncached memory regions diff -r f3d7307b0ee3 -r 2412c90533d0 agent/test/deadlock/testcase.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/test/deadlock/testcase.sh Tue Apr 11 08:08:45 2017 +0900 @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +pushd $(dirname $0) >/dev/null + +if [[ $1 == "--clean" ]]; then + rm -rf *class heapstats_log.csv heapstats_snapshot.dat result.log + exit +fi + +THREAD_NUM=${1:-11} +SLEEP_TIME=${2:-10} +LOGFILE=result.log + +${JAVA_HOME:=/usr/lib/jvm/java-openjdk}/bin/javac DLSample.java + +${JAVA_HOME}/bin/java -agentpath:${HEAPSTATS_LIB:-/usr/lib64/heapstats/libheapstats.so}=./heapstats.conf \ + DLSample $THREAD_NUM 1>$LOGFILE 2>&1 & +TARGET_PID=$! + +sleep $SLEEP_TIME && kill -9 $TARGET_PID + +if [[ "cat $LOGFILE | grep 'heapstats CRIT: ALERT(DEADLOCK): occurred deadlock. threadCount: $THREAD_NUM'" ]]; then + echo "Detected deadlock correctly." + exit 0 +else + echo "Could not detect deadlock or deadlock did not occure." + exit 1 +fi + +popd > /dev/null diff -r f3d7307b0ee3 -r 2412c90533d0 agent/test/thread-recording/testcase.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/test/thread-recording/testcase.sh Tue Apr 11 08:08:45 2017 +0900 @@ -0,0 +1,19 @@ +#!/bin/sh +set -e + +pushd $(dirname $0) >/dev/null + +if [[ $1 == "--clean" ]]; then + rm -rf *class parser/*class heapstats-thread-records.htr test.txt + exit +fi + +${JAVA_HOME:=/usr/lib/jvm/java-openjdk}/bin/javac -cp . *.java parser/*java + +${JAVA_HOME}/bin/java -agentpath:${HEAPSTATS_LIB:=/usr/lib64/heapstats/libheapstats.so}=./heapstats.conf Test +${JAVA_HOME}/bin/java -cp parser ThreadRecordParser heapstats-thread-records.htr + +${JAVA_HOME}/bin/java -agentpath:${HEAPSTATS_LIB}=./heapstats.conf IOTest testcase.sh +${JAVA_HOME}/bin/java -cp parser ThreadRecordParser heapstats-thread-records.htr + +popd > /dev/null