-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
257 lines (220 loc) · 9.56 KB
/
build.xml
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<!-- Specifies tasks that may need to be performed when using Proteja.
Jonathan Miller Kauffman -->
<project name="proteja" basedir=".">
<!-- The locations of the program source code, program bytecode, and test suite bytecode. If you want to
change these locations, modify these properties in 'build.xml' or set them on the command line when
running the proteja ant task. -->
<property name="programSource" value="apps/SK/src/sudoku/" />
<property name="programBytecode" value="apps/SK/bin/" />
<property name="testSuiteBytecode" value="apps/SK/bin/" />
<property name="src" value="src/"/>
<property name="build" value="build/classes/"/>
<!-- Cobertura will not run unless the argument '-Dcobertura=true' is supplied on the command-line. -->
<property name="cobertura" value="false" />
<!-- Per-test case timing information will not be captured unless '-DtestTimer=true' is supplied on the command-line. -->
<property name="testTimer" value="false" />
<!-- The name of the application being run. -->
<property name="applicationName" value="default" />
<!-- The filename of the matrix to be compressed or decompressed. -->
<property name="matrixFile" value="matrix.dat" />
<!-- The name of the file holding a list of test cases to run. -->
<property name="modificationFile" value="data.dat" />
<!-- Classpath setting needed to run proteja in any configuration. -->
<property name="classpath" value="./${build}:./${testSuiteBytecode}:./${programBytecode}:./lib/junit-4.6.jar:./lib/ant.jar:./lib/ant-launcher.jar:./lib/asm-3.0.jar:./lib/asm-tree-3.0.jar:./lib/cobertura.jar:./lib/commons-beanutils-1.8.0.jar:./lib/commons-digester-2.0.jar:./lib/commons-logging-1.1.1.jar:./lib/jakarta-oro-2.0.8.jar:./lib/log4j-1.2.9.jar:./lib/xpp3-1.1.3.4d_b4_min.jar:./lib/xstream-1.1.3.jar:." />
<!-- Runs proteja with the cobertura and testTimer commmand-line args. -->
<target name="proteja">
<java classname="proteja.TestProcessor" fork="true">
<arg value="${cobertura}" />
<arg value="${testTimer}" />
<arg value="${applicationName}" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<!-- Uses AnnotationAdder to add annotations to all the classes specified in settings.out -->
<target name="addAnnotations">
<java classname="proteja.ReadClassesAddAnnotations" fork="true">
<arg value="${testSuiteBytecode}" />
<!--<arg value="${classpath}" />-->
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<!-- Creates a new settings file if the old one has been damaged or destroyed. -->
<target name="createSettings">
<java classname="proteja.CreateSettings" fork="true">
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
<echo>"Settings created."</echo>
</target>
<!-- Modifies the settings.out file based on a reduction/prioritization. -->
<target name="modifyTestSuite">
<java classname="proteja.ModifyTestSuite" fork="true">
<arg value="${modificationFile}" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<!-- Compresses a coverage matrix. -->
<target name="compressMatrix">
<java classname="proteja.CompressMatrix" fork="true">
<arg value="${matrixFile}" />
<arg value="${summaryInfo}" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<!-- Deompresses a coverage matrix. -->
<target name="decompressMatrix">
<java classname="proteja.DecompressMatrix" fork="true">
<arg value="${matrixFile}" />
<arg value="${summaryInfo}" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<target name="build">
<javac srcdir="src" destdir="${build}">
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</javac>
</target>
<target name="clean">
<delete dir="${build}"/>
</target>
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
</target>
<!-- properties for test JVM (for this to work you need to un-comment the jvmarg tag in the run target.)-->
<property name="properties" value="-Xmx9m" />
<!-- variables (please do not modify)-->
<property name="groupNumber" value="default" />
<property name="numberOfGroups" value="default" />
<property name="booleanCobertura" value="default" />
<!-- define paths -->
<property name="instCode" location="instrumentedClasses" />
<property name="proteja" location="build/classes" />
<property name="junit" location="lib/junit-4.6.jar:." />
<property name="xstream" location="lib/xstream-1.1.3.jar:lib/xpp3-1.1.3.4d_b4_min.jar:." />
<property name="lib" location="lib/" />
<property name="digester" location="lib/commons-digester-2.0.jar" />
<property name="beanutils" location="lib/commons-beanutils-1.8.0.jar" />
<property name="logging" location="lib/commons-logging-1.1.1.jar" />
<property name="log4j" location="lib/log4j-1.2.9.jar" />
<property name="cobertura" location="lib/cobertura.jar" />
<!-- set classpath -->
<path id="run.classpath">
<pathelement path="${instCode}" />
<pathelement path="${junit}" />
<pathelement path="${xstream}" />
<pathelement path="${proteja}" />
<pathelement path="${testSuiteBytecode}" />
<pathelement path="${digester}" />
<pathelement path="${logging}" />
<pathelement path="${beanutils}" />
<pathelement path="${log4j}" />
<pathelement path="${testSuiteBytecode}" />
<pathelement path="${cobertura}" />
<pathelement path="${programBytecode}" />
<pathelement path="${build}" />
</path>
<!-- targets -->
<target name="run" >
<java classname="proteja.InstructionReader" fork="yes" >
<arg value="${booleanCobertura}" />
<arg value="${testTimer}" />
<arg value="${batchFactor}" />
<arg value="${coverageType}" />
<arg value="${resetJVMOnBatch}" />
<arg value="${applicationName}" />
<classpath refid="run.classpath" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
<!--
<jvmarg value="${properties}" />
-->
</java>
</target>
<!-- Cobertura Targets -->
<!-- Setting Classpath for Cobertura -->
<path id="cobertura.classpath">
<fileset dir="${lib}">
<include name="**/*.jar" />
</fileset>
</path>
<!-- importing cobertura -->
<taskdef classpathref="cobertura.classpath" resource="tasks.properties" />
<target name="inst" description="Instruments the .class Files">
<mkdir dir="instrumentedClasses"/>
<cobertura-instrument todir="instrumentedClasses">
<fileset dir="${programBytecode}">
<include name="**/*.class"/>
<include name="**/*.jar" />
<exclude name="**/*Test.class" />
<exclude name="**/TestSudoku.class" />
</fileset>
</cobertura-instrument>
</target>
<target name="coberturaFileManip">
<move file="cobertura.ser" tofile="${groupNumber}.ser" />
<move file="${groupNumber}.ser" todir="temp" />
</target>
<target name="coberturaReportGeneration">
<mkdir dir="coverageReports" />
<cobertura-report format="xml" datafile="temp/${groupNumber}.ser" destdir="coverageReports/" >
<fileset dir="${programSource}">
<include name="**/*.java" />
<exclude name="**/TestSudoku.java" />
</fileset>
<classpath refid="cobertura.classpath" />
</cobertura-report>
<move file="coverageReports/coverage.xml" tofile="coverageReports/${groupNumber}.xml" />
</target>
<target name="createCopy" >
<mkdir dir="temp" />
<copy file="cobertura.ser" todir="temp" />
</target>
<target name="moveToHome" >
<copy file="temp/cobertura.ser" todir="."/>
</target>
<target name="coberturaReportParser">
<java classname="coberturaParsing.XmlParser" >
<arg value="coverageReports/${groupNumber}" />
<arg value="rules.xml" />
<arg value="${numberOfGroups}" />
<classpath refid="run.classpath" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
<target name="cleanup">
<delete dir="temp" />
<delete dir="instrumentedClasses" />
<delete file="cobertura.ser" />
<delete file="instructions.out" />
</target>
<target name="constructMatrix" >
<java classname="coberturaParsing.ConstructMatrix">
<arg value="${numberOfGroups}" />
<arg value="${batchFactor}" />
<arg value="${coverageType}" />
<arg value="${resetJVMOnBatch}" />
<arg value="${applicationName}" />
<classpath refid="run.classpath" />
<classpath>
<pathelement path="${classpath}"></pathelement>
</classpath>
</java>
</target>
</project>