forked from wmdietl/checker-framework-inference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tests.xml
141 lines (116 loc) · 5.39 KB
/
tests.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
<!-- This should be moved into the build.gradble but I'm strapped for time. Sorry! -->
<project name="checkerframework" basedir="." default="run-tests">
<property environment="env"/>
<property name="dist" value="${basedir}/dist" />
<property name="tests" value="${basedir}/tests" />
<property name="testdata" value="${basedir}/testdata" />
<property name="tests.src" value="${tests}/src" />
<property name="tests.build" value="${tests}/build"/>
<property name="tests.build.outputdir" value="${tests.build}/outputdir"/>
<property name="build.reports" value="${tests.build}/reports"/>
<property name="javac.lib" value="${dist}/javac.jar" />
<!-- Defaults, used if the Ant invocation does not set a value. -->
<property name="halt.on.test.error" value="true" />
<property name="halt.on.test.failure" value="true" />
<pathconvert pathsep=":" property="test.classpath">
<path>
<fileset dir="${dist}">
<include name="*.jar"/>
</fileset>
</path>
</pathconvert>
<pathconvert pathsep=" " property="src.tests">
<path>
<fileset dir="${tests}">
<include name="**/*.java"/>
</fileset>
</path>
</pathconvert>
<condition property="run.dist" value="false" else="true">
<isset property="no.dist"/>
</condition>
<target name="dist" if="${run.dist}">
<exec executable="${gradle}" failonerror="true">
<arg value="dist"/>
</exec>
</target>
<condition property="gradle" value="${gradle.executable}" else="gradle">
<isset property="gradle.executable" />
</condition>
<target name="prep" depends="dist">
<mkdir dir="${tests.build}"/>
<mkdir dir="${tests.build.outputdir}"/>
<mkdir dir="${build.reports}"/>
<condition property="cfi.jar.exists">
<available file="${dist}/checker-framework-inference.jar"/>
</condition>
<echo message="${cfi.jar.exists}"/>
<fail unless="${cfi.jar.exists}" message="Checker Framework Inference must be built"/>
<delete dir="${testdata}/tmp"/>
</target>
<target name="build-tests" description="Compile tests" depends="prep">
<java fork="true"
failonerror="true"
classpath="${test.classpath}"
classname="com.sun.tools.javac.Main">
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<arg value="-g"/>
<!-- Make sure we only have Java 7 source code and generate Java 7 bytecode. -->
<arg value="-source"/>
<arg value="7"/>
<arg value="-target"/>
<arg value="7"/>
<!-- To not get a warning about bootstrap classpath -->
<arg value="-Xlint:-options"/>
<arg line="-sourcepath ${tests}"/>
<arg line="-d ${tests.build}"/>
<arg line="${src.tests}"/>
</java>
</target>
<target name="run-tests" depends="build-tests"
description="Run tests for all checkers, WITHOUT building anything">
<!-- set this on the command line for like -Dtest.filter="**/TargetedTest.java" to target specific tests-->
<property name="test.filter" value="**/*Test.java"/>
<condition property="should.emit.debug.str" value="true" else="false">
<isset property="emit.test.debug"/>
</condition>
<condition property="debugger.str" value="-Xnoagent -Djava.compiler=NONE -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" else="">
<isset property="debugger.on"/>
</condition>
<condition property="use.hacks.str" value="-Duse.hacks=true">
<isset property="use.hacks"/>
</condition>
<condition property="path.afu.scripts.str" value="${path.afu.scripts}" else="">
<isset property="path.afu.scripts"/>
</condition>
<condition property="path.inference.script.str" value="${path.inference.script}" else="./scripts/inference">
<isset property="path.inference.script"/>
</condition>
<!-- Copied from -run-tests target -->
<mkdir dir="${build.reports}"/>
<junit fork="true"
dir="${basedir}"
printsummary="false"
haltonerror="${halt.on.test.error}"
haltonfailure="${halt.on.test.failure}">
<!--Set JAVAC_JAR so the insert-annotations-to-source can use it-->
<env key="JAVAC_JAR" value="${javac.lib}"/>
<classpath path="${test.classpath}:${tests.build}"/>
<jvmarg line="-Xbootclasspath/p:${javac.lib}"/>
<jvmarg line="-ea"/>
<jvmarg line="${debugger.str}"/>
<sysproperty key="use.hacks" value="${use.hacks.str}"/>
<sysproperty key="emit.test.debug" value="${should.emit.debug.str}"/>
<sysproperty key="path.afu.scripts" value="${path.afu.scripts.str}"/>
<sysproperty key="path.inference.script" value="${path.inference.script.str}"/>
<formatter type="xml"/>
<formatter type="brief" usefile="false"/>
<batchtest todir="${build.reports}">
<fileset dir="${tests}">
<include name="${test.filter}"/>
<exclude name="**/CFInferenceTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>