Skip to content

Instantly share code, notes, and snippets.

@andrioli
Created October 2, 2012 22:53
Show Gist options
  • Save andrioli/19cdb303810f595091ab to your computer and use it in GitHub Desktop.
Save andrioli/19cdb303810f595091ab to your computer and use it in GitHub Desktop.
Scripts to make and run Commons-math-2.1 with InSS
Use with InSS HEAD of branch [task-2377-branch-version3-ipl]
all: compile instrument gxl
compile:
ant compile compile.tests
instrument: compile
mkdir -p target/classes-instrum/
instrumenter --instrument target/classes/ --dest target/classes-instrum/ -verbose
gxl: compile
mkdir -p gxl/
defuse --file target/classes/ --dest gxl/
allusesextractor --file gxl/ --dest gxl/ -stats
clean:
rm -rf target/ lib/ gxl/
#!/bin/bash
TIMES=$1
INSTRUMENTER=$2
TRAVERSER=$3
PWD=`pwd`
PACKAGE='br.usp.each.inss.instrumentation'
LIBS=$MIS_HOME/libs/commons.jar
LIBS=$LIBS:$MIS_HOME/libs/inss.jar
LIBS=$LIBS:$MIS_HOME/libs/opal.jar
LIBS=$LIBS:$MIS_HOME/libs/j2gxl.jar
LIBS=$LIBS:$MIS_HOME/libs/gxl.jar
LIBS=$LIBS:$MIS_HOME/libs/log4j-1.2.16.jar
LIBS=$LIBS:$MIS_HOME/libs/whirlycache-1.0.1.jar
LIBS=$LIBS:$MIS_HOME/libs/commons-logging.jar
LIBS=$LIBS:$MIS_HOME/libs/commons-collections-3.1.jar
LIBS=$LIBS:$MIS_HOME/libs/concurrent-1.3.4.jar
if [ "$TIMES" == "" ]; then
echo "Need times argument!"
exit 1
fi
if [ "$INSTRUMENTER" == "" ]; then
echo "Need a instrumenter"
echo "Bitwise, Bitwise8, Bitwise16, DD, CorrectedDD, Matrix, MatrixImproved, ASSET, Empty, OptimizedDD, NotInstrumented"
exit 1
fi
if [ $2 = Bitwise ]; then
INSTRUMENTER=${PACKAGE}.BitwiseDuaCoverage
elif [ $2 = Bitwise8 ]; then
INSTRUMENTER=${PACKAGE}.BitwiseDuaCoverage8
elif [ $2 = Bitwise16 ]; then
INSTRUMENTER=${PACKAGE}.BitwiseDuaCoverage16
elif [ $2 = DD ]; then
INSTRUMENTER=${PACKAGE}.AllUsesDemandDriven
elif [ $2 = CorrectedDD ]; then
INSTRUMENTER=${PACKAGE}.CorrectedDemandDrivenCloneModified
elif [ $2 = Matrix ]; then
INSTRUMENTER=${PACKAGE}.MatrixBasedDuaCoverage
elif [ $2 = MatrixImproved ]; then
INSTRUMENTER=${PACKAGE}.MatrixBasedDuaCoverageImproved
elif [ $2 = ASSET ]; then
INSTRUMENTER=${PACKAGE}.ASSET
elif [ $2 = Empty ]; then
INSTRUMENTER=${PACKAGE}.EmptyInstrumenter
elif [ $2 = OptimizedDD ]; then
INSTRUMENTER=${PACKAGE}.OptimizedDemandDriven
elif [ $2 = NotInstrumented ]; then
INSTRUMENTER=NotInstrumented
else
echo "Invalid instrumenter"
echo "Bitwise, Bitwise8, Bitwise16, DD, CorrectedDD, Matrix, MatrixImproved, ASSET, Empty, OptimizedDD, NotInstrumented"
exit 1
fi
if [ "$TRAVERSER" == "" ] && [ "$INSTRUMENTER" != "NotInstrumented" ]; then
echo "Need a traverser"
echo "Default, Simple, DoNothing, RemoveCondition"
exit 1
fi
if [ "$TRAVERSER" == "" ]; then
TRAVERSER=DUMMY
fi
if [ $TRAVERSER = Default ]; then
TRAVERSER=${PACKAGE}.traverse.DefaultProbeTraverseStrategy
elif [ $TRAVERSER = Simple ]; then
TRAVERSER=${PACKAGE}.traverse.SimpleProbeTraverseStrategy
elif [ $TRAVERSER = DoNothing ]; then
TRAVERSER=${PACKAGE}.traverse.DoNothingProbeTraverseStrategy
elif [ $TRAVERSER = RemoveCondition ]; then
TRAVERSER=${PACKAGE}.traverse.RemoveConditionProbeTraverseStrategy
elif [ "$INSTRUMENTER" != "NotInstrumented" ]; then
echo "Invalid traverser"
echo "Default, Simple, DoNothing, RemoveCondition"
exit 1
fi
#commons-math-2.1
TESTS=`find ${PWD}/target/test-classes/ -type f \( -name '*Test.class' \) -o \( -name '*TestBinary.class' \) -o \( -name '*TestPermutations.class' \) | grep -v AbstractTest.class`
TESTS=`echo ${TESTS} |sed 's?'"${PWD}"'/??g' | sed 's/target\/test-classes\///g' | sed 's/\//./g' | sed 's/.class//g'`
COMMAND="java -cp ${PWD}/target/classes/:${PWD}/target/test-classes:${PWD}/lib/junit-4.4.jar org.junit.runner.JUnitCore ${TESTS}"
for (( i=0; i<$TIMES; i++ ))
do
if [ "$INSTRUMENTER" != "NotInstrumented" ]; then
COMMAND="java -cp ${PWD}/target/classes-instrum/:${PWD}/target/test-classes:${PWD}/lib/junit-4.4.jar:${LIBS} \
-Xms1536m \
-Dgxl.dir=${PWD}/gxl/ \
-Doutput.file=${INSTRUMENTER}_${i}.ser \
-Dinstrumentation.strategy=${INSTRUMENTER} \
-Drequirement.determination=br.usp.each.opal.requirement.DuaGXLLoader \
-Dtraverse.strategy=${TRAVERSER} \
-Dsimulator.strategy=br.usp.each.inss.executor.CloneSimulator \
org.junit.runner.JUnitCore ${TESTS}"
fi
START_TIME=`date +"%s"`
$COMMAND > ${INSTRUMENTER}_${i}.console # > /dev/null # &>2
END_TIME=`date +"%s"`
echo $END_TIME - $START_TIME | bc
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment