-
Notifications
You must be signed in to change notification settings - Fork 0
/
jacoco.sh
executable file
·71 lines (61 loc) · 1.78 KB
/
jacoco.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env bash
#check args
if [ -z $1 ] || [ -z $2 ]; then
echo "Usage: $0 autId guitar|guicat"
exit
fi
#globals
aut=$1
testMethod=$2
#source config file
. ./conf/$aut/$aut.conf
#logic
if [ "$testMethod" = "guitar" ] ; then
testcaseDir=$AUTTESTCASE
reportDir=$guitarReportDir
reportJacocoExecDir=$guitarReportJacocoExecDir
elif [ "$testMethod" = "guicat" ] ; then
testcaseDir=$autGuicatTestcase
reportDir=$guicatReportDir
reportJacocoExecDir=$guicatReportJacocoExecDir
else
echo "Usage: $0 autId guitar|guicat"
exit
fi
rm -rf $reportDir
if [ ! -d "$guitarReportJacocoExecDir" ]; then
mkdir -p "$guitarReportJacocoExecDir"
fi
if [ ! -d "$guicatReportJacocoExecDir" ]; then
mkdir -p "$guicatReportJacocoExecDir"
fi
if [ ! -d "$AUTSTA" ]; then
mkdir -p "$AUTSTA"
fi
#classpath libs + aut
classpath="."
for jar in `ls lib`
do
if [[ $jar == *.jar ]]
then
classpath=$classpath":./lib/"$jar
fi
done
classpath=$classpath":"$CLASSPATH
for tc in `ls $testcaseDir`
do
testcase_id=${tc%????}
testcase=$testcaseDir"/"$tc
log=$AUTLOG"/"$testcase_id".log"
sta=$AUTSTA"/"$testcase_id".sta"
echo "processing "$testcase
cmd="java -javaagent:./lib/jacocoagent.jar -Dlog4j.configuration=$log4j -cp $classpath edu.umd.cs.guitar.replayer.JFCReplayerMain -c $AUT_MAINCLASS -g $guiFile -e $efgFile -t $testcase -i 500 -d 200 -l $log -gs $sta -cf $configurationFile -ts"
# echo $cmd
eval $cmd
mv ./jacoco.exec $reportJacocoExecDir"/"$tc".jacoco.exec"
done
cp ./conf/jacoco-template.xml $reportDir"/jacoco.xml"
cd $reportDir
chmod u+wx "jacoco.xml"
sed -i "s/<fileset dir=\"\${result.classes.dir\}\"><\/fileset>/<fileset dir=\"\${result.classes.dir\}\"><include name=\"$AUTJAR\"\/><\/fileset>/g" jacoco.xml
ant -f "jacoco.xml"