1<!--
2 ! ASM: a very small and fast Java bytecode manipulation framework
3 ! Copyright (c) 2000-2005 INRIA, France Telecom
4 ! All rights reserved.
5 !
6 ! Redistribution and use in source and binary forms, with or without
7 ! modification, are permitted provided that the following conditions
8 ! are met:
9 ! 1. Redistributions of source code must retain the above copyright
10 !    notice, this list of conditions and the following disclaimer.
11 ! 2. Redistributions in binary form must reproduce the above copyright
12 !    notice, this list of conditions and the following disclaimer in the
13 !    documentation and/or other materials provided with the distribution.
14 ! 3. Neither the name of the copyright holders nor the names of its
15 !    contributors may be used to endorse or promote products derived from
16 !    this software without specific prior written permission.
17 !
18 ! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 ! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 ! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 ! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
22 ! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23 ! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24 ! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 ! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26 ! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 ! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 ! THE POSSIBILITY OF SUCH DAMAGE.
29-->
30
31<project name="test" default="test">
32
33  <!-- ==================================== -->
34  <!-- ======== PROPERTY DEFINITION ======= -->
35  <!-- ==================================== -->
36
37  <property name="test.conform"   value="${test}/conform"/>
38  <property name="test.deviance"  value="${test}/deviance"/>
39  <property name="test.thread"    value="${test}/thread"/>
40  <property name="test.stress"    value="${test}/stress"/>
41  <property name="test.perf"      value="${test}/perf"/>
42
43  <target name="properties">
44    <condition property="asm.test" value="${java.home}/lib/rt.jar,test/conform/cases">
45      <not><isset property="asm.test"/></not>
46    </condition>
47
48    <condition property="asm.test.class" value="">
49      <not><isset property="asm.test.class"/></not>
50    </condition>
51
52    <condition property="java5">
53      <available classname="java.lang.annotation.Annotation"/>
54    </condition>
55
56    <condition property="test.conform.exist">
57      <available file="${test.conform}"/>
58    </condition>
59
60    <condition property="test.deviance.exist">
61      <available file="${test.deviance}"/>
62    </condition>
63
64    <condition property="test.thread.exist">
65      <available file="${test.thread}"/>
66    </condition>
67
68    <condition property="test.stress.exist">
69      <available file="${test.stress}"/>
70    </condition>
71
72    <condition property="test.perf.exist">
73      <available file="${test.perf}"/>
74    </condition>
75
76    <condition property="test.all">
77      <and>
78        <not><isset property="test.type"/></not>
79        <not><isset property="test.group"/></not>
80        <not><isset property="test.name"/></not>
81      </and>
82    </condition>
83
84    <condition property="test.paths.configured">
85      <and>
86        <isset property="bcel.path"/>
87        <isset property="serp.path"/>
88        <isset property="javassist.path"/>
89        <isset property="janino.path"/>
90      </and>
91    </condition>
92  </target>
93
94  <!-- ================================== -->
95  <!-- ========  INITIALIZATION   ======= -->
96  <!-- ================================== -->
97
98  <target name="check" unless="test.paths.configured">
99    <echo message="The 'build.properties' file must be configured"/>
100    <fail/>
101  </target>
102
103  <target name="init" depends="properties,check">
104    <mkdir dir="${out.test}"/>
105    <mkdir dir="${out.test}/reports"/>
106    <path id="test.classpath">
107      <pathelement location="${classes}"/>
108      <pathelement location="${out.test}"/>
109      <pathelement path="${bcel.path}"/>
110      <pathelement path="${serp.path}"/>
111      <pathelement path="${javassist.path}"/>
112      <pathelement path="${janino.path}"/>
113      <path refid="cobertura.classpath"/>
114    </path>
115  </target>
116
117  <!-- ==================================== -->
118  <!-- =========== COMPILATION ============ -->
119  <!-- ==================================== -->
120
121  <target name="compile.test.conform" depends="init" if="test.conform.exist">
122    <javac srcdir="${test.conform}" destdir="${out.test}"
123        debug="on" debuglevel="lines,vars,source">
124      <classpath refid="test.classpath"/>
125      <include name="**/*.java"/>
126      <exclude name="annotations/**/*.java" unless="java5"/>
127      <exclude name="**/AnnotationTest.java" unless="java5"/>
128    </javac>
129    <copy todir="${out.test}">
130  	  <fileset dir="${test.conform}">
131        <include name="**/*.txt"/>
132        <include name="**/*.data"/>
133      </fileset>
134    </copy>
135  </target>
136
137  <target name="compile.test.deviance" depends="init" if="test.deviance.exist">
138    <javac srcdir="${test.deviance}" destdir="${out.test}" debug="on" source="1.3" target="1.2">
139      <classpath refid="test.classpath"/>
140      <include name="**/*.java"/>
141    </javac>
142  </target>
143
144  <target name="compile.test.thread" depends="init" if="test.thread.exist">
145    <javac srcdir="${test.thread}" destdir="${out.test}" debug="on" source="1.3" target="1.2">
146      <classpath refid="test.classpath"/>
147      <include name="**/*.java"/>
148    </javac>
149  </target>
150
151  <target name="compile.test.stress" depends="init" if="test.stress.exist">
152    <javac srcdir="${test.stress}" destdir="${out.test}" debug="on" source="1.3" target="1.2">
153      <classpath refid="test.classpath"/>
154      <include name="**/*.java"/>
155    </javac>
156  </target>
157
158  <target name="compile.test.perf" depends="init" if="test.perf.exist">
159    <javac srcdir="${test.perf}" destdir="${out.test}" debug="on" source="1.3" target="1.2">
160      <classpath refid="test.classpath"/>
161      <include name="**/*.java"/>
162      <exclude name="**/xml/*.java"/>
163    </javac>
164  </target>
165
166  <target name="compile" depends="compile.test.conform,compile.test.deviance,compile.test.thread,compile.test.stress,compile.test.perf"/>
167
168  <!-- ============================= -->
169  <!-- =========== TEST ============ -->
170  <!-- ============================= -->
171
172  <target name="testAll" depends="compile" if="test.all">
173    <multipleAnt dir="${test.conform}" inheritRefs="true"/>
174    <!--multipleAnt dir="${test.deviance}" inheritRefs="true"/>
175    <multipleAnt dir="${test.thread}" inheritRefs="true"/>
176    <multipleAnt dir="${test.stress}" inheritRefs="true"/-->
177    <multipleAnt dir="${test.perf}" inheritRefs="true"/>
178  </target>
179
180  <target name="testType" depends="compile" if="test.type">
181    <multipleAnt dir="${test}/${test.type}" inheritRefs="true"/>
182  </target>
183
184  <target name="testGroup" depends="compile" if="test.group">
185    <ant antfile="test/${test.group}.xml" inheritRefs="true"/>
186  </target>
187
188  <target name="testName" depends="compile" if="test.name">
189    <multipleAnt dir="${test.conform}" target="${test.name}" inheritRefs="true"/>
190    <!--multipleAnt dir="${test.deviance}" target="${test.name}" inheritRefs="true"/>
191    <multipleAnt dir="${test.thread}" target="${test.name}" inheritRefs="true"/>
192    <multipleAnt dir="${test.stress}" target="${test.name}" inheritRefs="true"/-->
193    <multipleAnt dir="${test.perf}" target="${test.name}" inheritRefs="true"/>
194  </target>
195
196  <target name="test" depends="testAll,testType,testGroup,testName">
197    <!--junitreport todir="${out.test}/reports">
198      <fileset dir="${out.test}/reports">
199        <include name="TEST-*.xml"/>
200      </fileset>
201      <report todir="${out.test}/reports"/>
202    </junitreport-->
203  </target>
204
205</project>
206