Commit ed5bcc0c authored by Lubomir Bulej's avatar Lubomir Bulej

Minor script cleanups that have been lying around for some time already.

parent 8c5534dd
......@@ -6,14 +6,12 @@ if [ -z "${DISL_LIB_P}" ]; then
fi
# test number of arguments
EXPECTED_ARGS=2
if [ $# -lt $EXPECTED_ARGS ]
then
if [ $# -lt 2 ]; then
echo "Usage: `basename $0` instr-lib java-params"
exit
exit 1
fi
# set proper lib depending on OS
# determine libs depending on the OS
OS=`uname`
if [ "${OS}" = "Darwin" ]; then
C_AGENT="${DISL_LIB_P}/libdislagent.jnilib"
......@@ -27,9 +25,9 @@ fi
INSTR_LIB=$1
shift
# start client
java -agentpath:${C_AGENT} \
-agentpath:${RE_AGENT} \
-javaagent:${DISL_LIB_P}/disl-agent.jar \
-Xbootclasspath/a:${DISL_LIB_P}/disl-agent.jar:${INSTR_LIB}:${DISL_LIB_P}/dislre-dispatch.jar \
$*
# start the client
${JAVA_HOME:+$JAVA_HOME/jre/bin/}java \
-agentpath:${C_AGENT} -agentpath:${RE_AGENT} \
-javaagent:${DISL_LIB_P}/disl-agent.jar \
-Xbootclasspath/a:${DISL_LIB_P}/disl-agent.jar:${INSTR_LIB}:${DISL_LIB_P}/dislre-dispatch.jar \
"$@"
......@@ -5,22 +5,27 @@ if [ -z "${DISL_LIB_P}" ]; then
DISL_LIB_P=./build
fi
# available options
# -Ddebug=true \
# -Ddislreserver.port="portNum" \
# test number of arguments
if [ $# -lt 1 ]; then
echo "Usage: `basename $0` instr-lib [java-params]"
exit 1
fi
# get instrumentation library and shift parameters
INSTR_LIB=$1
shift
# start server
java $* \
-Xms1G -Xmx2G \
-cp ${INSTR_LIB}:${DISL_LIB_P}/dislre-server.jar \
ch.usi.dag.dislreserver.DiSLREServer \
&
# start the remote execution server
# options available:
# -Ddebug=true \
# -Ddislreserver.port="portNum" \
${JAVA_HOME:+$JAVA_HOME/jre/bin/}java \
-Xms1G -Xmx2G \
-cp ${INSTR_LIB}:${DISL_LIB_P}/dislre-server.jar \
ch.usi.dag.dislreserver.DiSLREServer \
"$@" &
# print pid to the server file
if [ -n "${RE_SERVER_FILE}" ]; then
echo $! > ${RE_SERVER_FILE}
echo $! > ${RE_SERVER_FILE}
fi
......@@ -5,28 +5,33 @@ if [ -z "${DISL_LIB_P}" ]; then
DISL_LIB_P=./build
fi
# available options
# -Ddebug=true \
# -Ddisl.classes="list of disl classes (: - separator)"
# -Ddisl.noexcepthandler=true \
# -Ddisl.exclusionList="path" \
# -Ddislserver.instrumented="path" \
# -Ddislserver.uninstrumented="path" \
# -Ddislserver.port="portNum" \
# -Ddislserver.timestat=true \
# -Ddislserver.continuous=true \
# test number of arguments
if [ $# -lt 1 ]; then
echo "Usage: `basename $0` instr-lib [java-params]"
exit 1
fi
# get instrumentation library and shift parameters
INSTR_LIB=$1
shift
# start server
java $* \
-cp ${INSTR_LIB}:${DISL_LIB_P}/disl-server.jar \
ch.usi.dag.dislserver.DiSLServer \
&
# start the instrumentation server
# options available:
# -Ddebug=true \
# -Ddisl.classes="list of disl classes (: - separator)"
# -Ddisl.noexcepthandler=true \
# -Ddisl.exclusionList="path" \
# -Ddislserver.instrumented="path" \
# -Ddislserver.uninstrumented="path" \
# -Ddislserver.port="portNum" \
# -Ddislserver.timestat=true \
# -Ddislserver.continuous=true \
${JAVA_HOME:+$JAVA_HOME/jre/bin/}java \
-cp ${INSTR_LIB}:${DISL_LIB_P}/disl-server.jar \
ch.usi.dag.dislserver.DiSLServer \
"$@" &
# print pid to the server file
if [ -n "${SERVER_FILE}" ]; then
echo $! > ${SERVER_FILE}
echo $! > ${SERVER_FILE}
fi
# /bin/sh
EXPECTED_ARGS=1
if [ $# -lt $EXPECTED_ARGS ]
then
echo "Usage: `basename $0` test-case"
exit
#!/bin/bash
TARGET_BASE="ch.usi.dag.disl.test"
TARGET_MAIN="TargetClass"
if [ $# -lt 1 ]; then
echo "Usage: `basename $0` <test-name>"
echo "<test-name> is a package under $TARGET_BASE containing $TARGET_MAIN"
exit 1
fi
SERVER_FILE=.server.pid
export SERVER_FILE
RE_SERVER_FILE=.re_server.pid
export RE_SERVER_FILE
kill_server () {
if [ -f "$1" ]; then
local PID=$(< "$1")
[ -n "$PID" ] && kill -KILL $PID 2> /dev/null
rm -f "$1"
fi
}
# kill running server
if [ -e ${SERVER_FILE} ]
then
kill -KILL `cat ${SERVER_FILE}`
rm ${SERVER_FILE}
fi
# kill running server
if [ -e ${RE_SERVER_FILE} ]
then
kill -KILL `cat ${RE_SERVER_FILE}`
rm ${RE_SERVER_FILE}
fi
#
# Compile the test package to make sure we have up-to-date jars.
# Bail out now if the compilation fails.
#
ant package-test -Dtest.name=$1 > /dev/null || exit 2
# represents the observed program
TARGET_CLASS="ch.usi.dag.disl.test.$1.TargetClass"
#
# Configure server PID files and mop-up any leftover
# instrumentation or remote/analysis servers.
#
export SERVER_FILE=.server.pid
kill_server $SERVER_FILE
# compile the test package - suppress output
ant package-test -Dtest.name=$1 > /dev/null
export RE_SERVER_FILE=.re_server.pid
kill_server $RE_SERVER_FILE
#
# Launch the instrumentation and analysis servers and give them time to start.
# Then run the client with the class representing the observed program.
#
# Include the library containing the instrumentation in their class path.
#
INSTR_LIB=build/disl-instr.jar
# start server and take pid
./runServer.sh ${INSTR_LIB}
# start reserver and take pid
./runREServer.sh ${INSTR_LIB}
# wait for server startup
sleep 3
# run client
./runClient.sh ${INSTR_LIB} -cp bin/ ${TARGET_CLASS}
./runClient.sh ${INSTR_LIB} -cp bin/ "$TARGET_BASE.$1.$TARGET_MAIN"
# wait for server shutdown
#
# Give the servers some time to shut down themselves, before mopping up.
#
sleep 1
# kill server
kill -KILL `cat ${SERVER_FILE}` 2> /dev/null
rm ${SERVER_FILE}
kill -KILL `cat ${RE_SERVER_FILE}` 2> /dev/null
rm ${RE_SERVER_FILE}
kill_server $SERVER_FILE
kill_server $RE_SERVER_FILE
#!/bin/sh
TEST_PATH=src-test/ch/usi/dag/disl/test
TESTS=`ls src-test/ch/usi/dag/disl/test/`
for TEST in ${TESTS}
do
ls -1 $TEST_PATH | sort | while read TEST; do
echo "*** Starting test ${TEST} ***" | tee -a run-all.log
./runTest.sh ${TEST} pkg 2>&1 | tee -a run-all.log
./runTest.sh ${TEST} pkg |& tee -a run-all.log
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment