aboutsummaryrefslogtreecommitdiffstats
path: root/tests/product/product-test.xml
blob: c5f1146d39968ca4ab5bda1f66364560cffec175 (plain)
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
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
<!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-     -->
<!--                                                                                -->
<!-- This file is part of the compiler and core tools for the AspectJ(tm)           -->
<!-- programming language; see http://aspectj.org                                   -->
<!--                                                                                -->
<!-- The contents of this file are subject to the Mozilla Public License            -->
<!-- Version 1.1 (the "License"); you may not use this file except in               -->
<!-- compliance with the License. You may obtain a copy of the License at           -->
<!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.                 -->
<!--                                                                                -->
<!-- Software distributed under the License is distributed on an "AS IS" basis,     -->
<!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License       -->
<!-- for the specific language governing rights and limitations under the           -->
<!-- License.                                                                       -->
<!--                                                                                -->
<!-- The Original Code is AspectJ.                                                  -->
<!--                                                                                -->
<!-- The Initial Developer of the Original Code is Xerox Corporation. Portions      -->
<!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation.   -->
<!-- All Rights Reserved.                                                           -->

<!-- ============================================================================== -->
<!-- To do a build, invoke build/bin/ant.[sh|bat] after defining JDKDIR.            -->
<!-- To customize properties, edit local.properties.examples as local.properties.   -->
<!-- ============================================================================== -->
<!-- todo: non-distribution license?? -->

<!-- This dtd only defines aspectj_initProduct, unlike ../../build.dtd -->
<!DOCTYPE build SYSTEM "build.dtd">

<!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it -->
<project name="product-test" default="test" basedir=".">

    &aspectj_initProduct; 

    <!-- ========================================================================== -->
    <!-- Init                                                                       -->
    <!-- ========================================================================== -->
    <target name="init" depends="init.product,productTest.expect.dir"
     description="init values - launch from install dir or set product.dir variable">
      <echo message="init product-test.xml"/> 
      <property name="productTest.classes.dir"
            location="${productTest.output.dir}/classes"/>
      <property name="script.expect.dir"
            location="${productTest.expect.dir}/bat"/>
      <!-- use .bat scripts if available, shell scripts otherwise -->
      <property name="scriptExtension" value=""/>
      <available file="${product.bin.dir}/ajc.bat"
             property="scriptExtension"
                value=".bat" />
    </target>

    <!-- ========================================================================== -->
    <!-- Clean everything in created dirs                                           -->
    <!-- ========================================================================== -->

    <target name="clean" depends="init"
     description="delete test working dirs (does not clean results)">
     <mkdir  dir="${productTest.output.dir}"/>
     <delete dir="${productTest.output.dir}"/>
     <mkdir  dir="${productTest.output.dir}"/>
    </target>

    <!-- ========================================================================== -->
    <!-- Run product tests                                                          -->
    <!-- ========================================================================== -->
    <target name="test" 
         depends="test.examples.buildscript,test.script.telecom,test.tools.sources"
     description="run available tests"/>

    <target name="test.script.telecom" 
         depends="init,productTest.dir,product.dir,
                  productTest.expect.bat.dir,productTest.output.dir"
     description="ajc/ajdoc/java/ajdb telecom example using bat scripts">
     <!-- antcall target="clean" / -->

     <!-- todo: execon not working - will fail outside windows -->
     <echo message="### file product-test.xml target test.script.telecom"/>
     <!-- ajc -->
     <property name="ajc.out"   location="${productTest.output.dir}/telecom.ajc.txt"/>
     <property name="expect.ajc.out"   location="${script.expect.dir}/telecom.ajc.txt"/>
     <exec dir="${product.examples.dir}"
      executable="${product.bin.dir}/ajc${scriptExtension}"
          output="${ajc.out}">
      <arg value="-d"/>
      <arg value="${productTest.classes.dir}"/>
      <arg value="-argfile"/>
      <arg value="telecom/billing.lst"/>
      <arg value="-classpath"/>
      <arg value="${product.rt.jar}"/>
     </exec>
     <!-- todo this is always failing... -->
     <comparefiles lhsFile="${ajc.out}"
                   rhsFile="${expect.ajc.out}"/>

     <!-- ajdoc -->
     <property name="expect.ajdoc.out" location="${script.expect.dir}/telecom.ajdoc.txt"/>
     <property name="ajdoc.out" location="${productTest.output.dir}/telecom.ajdoc.txt"/>
     <exec dir="${product.examples.dir}"
      executable="${product.bin.dir}/ajdoc${scriptExtension}"
          output="${ajdoc.out}">
      <arg value="-d"/>
      <arg value="${productTest.classes.dir}"/> <!-- todo dump html in classes dir for now -->
      <arg value="-argfile"/>
      <arg value="telecom/billing.lst"/>
      <arg value="-classpath"/>
      <arg value="${product.rt.jar}"/>
      <arg value="telecom"/> <!-- todo (reconsider) had to add packagename -->
     </exec>
     <comparefiles lhsFile="${ajdoc.out}"
                   rhsFile="${expect.ajdoc.out}"/>

     <!-- java -->
     <property name="java.out"  location="${productTest.output.dir}/telecom.java.txt"/>
     <property name="expect.java.out"  location="${script.expect.dir}/telecom.java.txt"/>
     <java classname="telecom.BillingSimulation"
              output="${java.out}">
       <classpath>
         <pathelement location="${productTest.classes.dir}"/>
         <pathelement location="${product.rt.jar}"/>
       </classpath>
     </java>
     <comparefiles lhsFile="${java.out}"
                   rhsFile="${expect.java.out}"/>

     <!-- ajdb -->
     <echo file="${product.examples.dir}/ajdb.in">exit
     </echo>
     <property name="ajdb.out"  location="${productTest.output.dir}/telecom.ajdb.txt"/>
     <property name="expect.ajdb.out"  location="${script.expect.dir}/telecom.ajdb.txt"/>
     <exec dir="${product.examples.dir}"
      executable="${product.bin.dir}/ajdb${scriptExtension}"
          output="${ajdb.out}">
      <arg value="-classpath"/>
      <arg value="${product.rt.jar}${PS}${productTest.classes.dir}"/>
      <arg value="&lt;"/>
      <arg value="${product.examples.dir}/ajdb.in"/>
     </exec>
     <comparefiles lhsFile="${ajdb.out}"
                   rhsFile="${expect.ajdb.out}"/>
   </target>    

   <!-- todo: also depends on jdk.tools.jar -->
   <!-- todo: ignore as duplicating examples/build.xml -->
   <target name="test.examples.antscript" 
         depends="init,productTest.dir,product.dir,
                  product.taskdefs.jar,product.rt.jar,
                  product.tools.jar"
     description="compile/doc/run introduction example using ant taskdefs by delegation to ant-example.xml">
     <echo message="### file product-test.xml target test.examples.antscript"/>
     <ant antfile="${productTest.dir}/ant-example.xml"
               dir="${product.examples.dir}"
            output="${productTest.output.dir}/ant-example.ant.txt">
       <property name="PS"            
                value="${path.separator}"/>
       <property name="product.dir"  
                value="${product.dir}"/>
       <property name="jdk.tools.jar" 
             location="${jdk.tools.jar}"/>
        <property name="jdk.dir" 
             location="${jdk.dir}"/>
     </ant>
   </target>

   <target name="test.examples.buildscript" 
         depends="init,product.dir,
                  product.taskdefs.jar,product.rt.jar,
                  product.tools.jar"
     description="compile/doc/run examples using build.xml script distributed with examples">
     <echo message="### file product-test.xml target test.examples.buildscript"/>
     <copy file="${product.taskdefs.jar}"
          todir="${product.lib.dir}" />

     <!-- XXX if docs come after ajc, then _always_ get OutOfMemoryError... -->
     <antcall target="antcall.test.examples.buildscript">
       <param name="example.target" value="docs" />
     </antcall>

     <antcall target="antcall.test.examples.buildscript.norun">
       <param name="example.target" value="spacewar" />
     </antcall>

     <antcall target="antcall.test.examples.buildscript">
       <param name="example.target" value="nonGui" />
     </antcall>

     <!-- OutOfMemory if including all 
     <antcall target="antcall.test.examples.buildscript.norun">
       <param name="example.target" value="all" />
     </antcall>
     -->
   </target>

   <target name="antcall.test.examples.buildscript.norun" 
         depends="init,product.dir,
                  product.taskdefs.jar,product.rt.jar,
                  product.tools.jar"
     description="invoke ant {example.target} for test.examples.buildscript (with norun)">
     <echo message="### ${example.target} (norun)"/>
     <mkdir dir="${productTest.output.dir}" />
     <ant antfile="${product.examples.dir}/build.xml"
           target="${example.target}"
              dir="${product.examples.dir}"
           output="${productTest.output.dir}/example-build.${example.target}.txt" >
       <property name="JAVA_HOME" 
             location="${jdk.dir}"/> 
       <property name="norun" 
             location="skipRunning"/> 
     </ant>
   </target>

   <target name="antcall.test.examples.buildscript" 
         depends="init,product.dir,
                  product.taskdefs.jar,product.rt.jar,
                  product.tools.jar"
     description="invoke ant {example.target} for test.examples.buildscript (without norun)">
     <echo message="### ${example.target} (run)"/>
     <mkdir dir="${productTest.output.dir}" />
     <ant antfile="${product.examples.dir}/build.xml"
           target="${example.target}"
              dir="${product.examples.dir}"
           output="${productTest.output.dir}/example-build.${example.target}.txt" >
       <property name="JAVA_HOME" 
             location="${jdk.dir}"/> 
     </ant>
   </target>


   <!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh -->
   <target name="test.tools.sources" 
        depends="init,product.tools.jar,product.src.dir"
    description="test source dist using ajc, ajdoc (todo remove - see ant-example)">

     <property name="tools.source.out"   
           location="${productTest.output.dir}/source-tools"/>
     <property name="test.source.classes.dir"
           location="${productTest.output.dir}/source-tools"/>
     <property name="source-tools.jar"
           location="${productTest.output.dir}/source-tools.jar"/>

     <mkdir dir="${test.source.classes.dir}"/>
     <delete dir="${test.source.classes.dir}"/>
     <mkdir dir="${test.source.classes.dir}"/>

     <!-- todo validate product builds by comparison or invocation -->
     <antcall target="build.source.call">
       <param name="target.name" value="runtime" />
     </antcall>
     <antcall target="build.source.call">
       <param name="target.name" value="compiler" />
     </antcall>
     <antcall target="build.source.call">
       <param name="target.name" value="ajde" />
     </antcall>
     <antcall target="build.source.call">
       <param name="target.name" value="ajbrowser" />
     </antcall>
     <antcall target="build.source.call">
       <param name="target.name" value="ajdoc" />
     </antcall>

     <echo message="" file="${tools.source.out}.empty"/>
     <!-- comparefiles lhsFile="${tools.source.out}"
                   rhsFile="${tools.source.out}.empty" / -->

     <jar jarfile="${source-tools.jar}"
          basedir="${test.source.classes.dir}"/>
     <comparefiles lhsFile="${product.tools.jar}"
                   rhsFile="${source-tools.jar}" />

     <delete dir="${test.source.classes.dir}"/>
   </target>

   <target name="build.source.call" >
     <echo message="# building (source) using ajc${scriptExtension} @${product.src.dir}/${target.name}.lst"/>
     <mkdir dir="${test.source.classes.dir}/${target.name}"/>
     <exec dir="${product.src.dir}"
      executable="${product.bin.dir}/ajc${scriptExtension}"
          output="${tools.source.out}.${target.name}.txt">
      <arg value="-d"/>
      <arg value="${test.source.classes.dir}/${target.name}"/>
      <arg value="-classpath"/>
      <arg value="${product.rt.jar}${PS}${jdk.tools.jar}"/> <!-- 1.3 for ajdoc -->
      <arg value="-argfile"/>
      <arg value="${target.name}.lst"/>
     </exec>
     <echo message="# START building (source) ${target.name} output"/>
     <echo message="" file="${tools.source.out}.${target.name}.txt"/>
     <echo message="#   END building (source) ${target.name} output"/>
   </target>

</project>