You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

product-test.xml 13KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. <!-- -*- Mode: SGML; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -->
  2. <!-- -->
  3. <!-- This file is part of the compiler and core tools for the AspectJ(tm) -->
  4. <!-- programming language; see http://aspectj.org -->
  5. <!-- -->
  6. <!-- The contents of this file are subject to the Mozilla Public License -->
  7. <!-- Version 1.1 (the "License"); you may not use this file except in -->
  8. <!-- compliance with the License. You may obtain a copy of the License at -->
  9. <!-- either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/. -->
  10. <!-- -->
  11. <!-- Software distributed under the License is distributed on an "AS IS" basis, -->
  12. <!-- WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License -->
  13. <!-- for the specific language governing rights and limitations under the -->
  14. <!-- License. -->
  15. <!-- -->
  16. <!-- The Original Code is AspectJ. -->
  17. <!-- -->
  18. <!-- The Initial Developer of the Original Code is Xerox Corporation. Portions -->
  19. <!-- created by Xerox Corporation are Copyright (C) 1999, 2000 Xerox Corporation. -->
  20. <!-- All Rights Reserved. -->
  21. <!-- ============================================================================== -->
  22. <!-- To do a build, invoke build/bin/ant.[sh|bat] after defining JDKDIR. -->
  23. <!-- To customize properties, edit local.properties.examples as local.properties. -->
  24. <!-- ============================================================================== -->
  25. <!-- todo: non-distribution license?? -->
  26. <!-- This dtd only defines aspectj_initProduct, unlike ../../build.dtd -->
  27. <!DOCTYPE build SYSTEM "build.dtd">
  28. <!-- This only runs from ../../test-product.xml b/c it uses comparefiles w/o defining it -->
  29. <project name="product-test" default="test" basedir=".">
  30. &aspectj_initProduct;
  31. <!-- ========================================================================== -->
  32. <!-- Init -->
  33. <!-- ========================================================================== -->
  34. <target name="init" depends="init.product,productTest.expect.dir"
  35. description="init values - launch from install dir or set product.dir variable">
  36. <echo message="init product-test.xml"/>
  37. <property name="productTest.classes.dir"
  38. location="${productTest.output.dir}/classes"/>
  39. <property name="script.expect.dir"
  40. location="${productTest.expect.dir}/bat"/>
  41. <!-- use .bat scripts if available, shell scripts otherwise -->
  42. <property name="scriptExtension" value=""/>
  43. <available file="${product.bin.dir}/ajc.bat"
  44. property="scriptExtension"
  45. value=".bat" />
  46. </target>
  47. <!-- ========================================================================== -->
  48. <!-- Clean everything in created dirs -->
  49. <!-- ========================================================================== -->
  50. <target name="clean" depends="init"
  51. description="delete test working dirs (does not clean results)">
  52. <mkdir dir="${productTest.output.dir}"/>
  53. <delete dir="${productTest.output.dir}"/>
  54. <mkdir dir="${productTest.output.dir}"/>
  55. </target>
  56. <!-- ========================================================================== -->
  57. <!-- Run product tests -->
  58. <!-- ========================================================================== -->
  59. <target name="test"
  60. depends="test.examples.buildscript,test.script.telecom,test.tools.sources"
  61. description="run available tests"/>
  62. <target name="test.script.telecom"
  63. depends="init,productTest.dir,product.dir,
  64. productTest.expect.bat.dir,productTest.output.dir"
  65. description="ajc/ajdoc/java/ajdb telecom example using bat scripts">
  66. <!-- antcall target="clean" / -->
  67. <!-- todo: execon not working - will fail outside windows -->
  68. <echo message="### file product-test.xml target test.script.telecom"/>
  69. <!-- ajc -->
  70. <property name="ajc.out" location="${productTest.output.dir}/telecom.ajc.txt"/>
  71. <property name="expect.ajc.out" location="${script.expect.dir}/telecom.ajc.txt"/>
  72. <exec dir="${product.examples.dir}"
  73. executable="${product.bin.dir}/ajc${scriptExtension}"
  74. output="${ajc.out}">
  75. <arg value="-d"/>
  76. <arg value="${productTest.classes.dir}"/>
  77. <arg value="-argfile"/>
  78. <arg value="telecom/billing.lst"/>
  79. <arg value="-classpath"/>
  80. <arg value="${product.rt.jar}"/>
  81. </exec>
  82. <!-- todo this is always failing... -->
  83. <comparefiles lhsFile="${ajc.out}"
  84. rhsFile="${expect.ajc.out}"/>
  85. <!-- ajdoc -->
  86. <property name="expect.ajdoc.out" location="${script.expect.dir}/telecom.ajdoc.txt"/>
  87. <property name="ajdoc.out" location="${productTest.output.dir}/telecom.ajdoc.txt"/>
  88. <exec dir="${product.examples.dir}"
  89. executable="${product.bin.dir}/ajdoc${scriptExtension}"
  90. output="${ajdoc.out}">
  91. <arg value="-d"/>
  92. <arg value="${productTest.classes.dir}"/> <!-- todo dump html in classes dir for now -->
  93. <arg value="-argfile"/>
  94. <arg value="telecom/billing.lst"/>
  95. <arg value="-classpath"/>
  96. <arg value="${product.rt.jar}"/>
  97. <arg value="telecom"/> <!-- todo (reconsider) had to add packagename -->
  98. </exec>
  99. <comparefiles lhsFile="${ajdoc.out}"
  100. rhsFile="${expect.ajdoc.out}"/>
  101. <!-- java -->
  102. <property name="java.out" location="${productTest.output.dir}/telecom.java.txt"/>
  103. <property name="expect.java.out" location="${script.expect.dir}/telecom.java.txt"/>
  104. <java classname="telecom.BillingSimulation"
  105. output="${java.out}">
  106. <classpath>
  107. <pathelement location="${productTest.classes.dir}"/>
  108. <pathelement location="${product.rt.jar}"/>
  109. </classpath>
  110. </java>
  111. <comparefiles lhsFile="${java.out}"
  112. rhsFile="${expect.java.out}"/>
  113. <!-- ajdb -->
  114. <echo file="${product.examples.dir}/ajdb.in">exit
  115. </echo>
  116. <property name="ajdb.out" location="${productTest.output.dir}/telecom.ajdb.txt"/>
  117. <property name="expect.ajdb.out" location="${script.expect.dir}/telecom.ajdb.txt"/>
  118. <exec dir="${product.examples.dir}"
  119. executable="${product.bin.dir}/ajdb${scriptExtension}"
  120. output="${ajdb.out}">
  121. <arg value="-classpath"/>
  122. <arg value="${product.rt.jar}${PS}${productTest.classes.dir}"/>
  123. <arg value="&lt;"/>
  124. <arg value="${product.examples.dir}/ajdb.in"/>
  125. </exec>
  126. <comparefiles lhsFile="${ajdb.out}"
  127. rhsFile="${expect.ajdb.out}"/>
  128. </target>
  129. <!-- todo: also depends on jdk.tools.jar -->
  130. <!-- todo: ignore as duplicating examples/build.xml -->
  131. <target name="test.examples.antscript"
  132. depends="init,productTest.dir,product.dir,
  133. product.taskdefs.jar,product.rt.jar,
  134. product.tools.jar"
  135. description="compile/doc/run introduction example using ant taskdefs by delegation to ant-example.xml">
  136. <echo message="### file product-test.xml target test.examples.antscript"/>
  137. <ant antfile="${productTest.dir}/ant-example.xml"
  138. dir="${product.examples.dir}"
  139. output="${productTest.output.dir}/ant-example.ant.txt">
  140. <property name="PS"
  141. value="${path.separator}"/>
  142. <property name="product.dir"
  143. value="${product.dir}"/>
  144. <property name="jdk.tools.jar"
  145. location="${jdk.tools.jar}"/>
  146. <property name="jdk.dir"
  147. location="${jdk.dir}"/>
  148. </ant>
  149. </target>
  150. <target name="test.examples.buildscript"
  151. depends="init,product.dir,
  152. product.taskdefs.jar,product.rt.jar,
  153. product.tools.jar"
  154. description="compile/doc/run examples using build.xml script distributed with examples">
  155. <echo message="### file product-test.xml target test.examples.buildscript"/>
  156. <copy file="${product.taskdefs.jar}"
  157. todir="${product.lib.dir}" />
  158. <!-- XXX if docs come after ajc, then _always_ get OutOfMemoryError... -->
  159. <antcall target="antcall.test.examples.buildscript">
  160. <param name="example.target" value="docs" />
  161. </antcall>
  162. <antcall target="antcall.test.examples.buildscript.norun">
  163. <param name="example.target" value="spacewar" />
  164. </antcall>
  165. <antcall target="antcall.test.examples.buildscript">
  166. <param name="example.target" value="nonGui" />
  167. </antcall>
  168. <!-- OutOfMemory if including all
  169. <antcall target="antcall.test.examples.buildscript.norun">
  170. <param name="example.target" value="all" />
  171. </antcall>
  172. -->
  173. </target>
  174. <target name="antcall.test.examples.buildscript.norun"
  175. depends="init,product.dir,
  176. product.taskdefs.jar,product.rt.jar,
  177. product.tools.jar"
  178. description="invoke ant {example.target} for test.examples.buildscript (with norun)">
  179. <echo message="### ${example.target} (norun)"/>
  180. <mkdir dir="${productTest.output.dir}" />
  181. <ant antfile="${product.examples.dir}/build.xml"
  182. target="${example.target}"
  183. dir="${product.examples.dir}"
  184. output="${productTest.output.dir}/example-build.${example.target}.txt" >
  185. <property name="JAVA_HOME"
  186. location="${jdk.dir}"/>
  187. <property name="norun"
  188. location="skipRunning"/>
  189. </ant>
  190. </target>
  191. <target name="antcall.test.examples.buildscript"
  192. depends="init,product.dir,
  193. product.taskdefs.jar,product.rt.jar,
  194. product.tools.jar"
  195. description="invoke ant {example.target} for test.examples.buildscript (without norun)">
  196. <echo message="### ${example.target} (run)"/>
  197. <mkdir dir="${productTest.output.dir}" />
  198. <ant antfile="${product.examples.dir}/build.xml"
  199. target="${example.target}"
  200. dir="${product.examples.dir}"
  201. output="${productTest.output.dir}/example-build.${example.target}.txt" >
  202. <property name="JAVA_HOME"
  203. location="${jdk.dir}"/>
  204. </ant>
  205. </target>
  206. <!-- see also more recent devenv/dev/bin/aj/testToolsSrc.sh -->
  207. <target name="test.tools.sources"
  208. depends="init,product.tools.jar,product.src.dir"
  209. description="test source dist using ajc, ajdoc (todo remove - see ant-example)">
  210. <property name="tools.source.out"
  211. location="${productTest.output.dir}/source-tools"/>
  212. <property name="test.source.classes.dir"
  213. location="${productTest.output.dir}/source-tools"/>
  214. <property name="source-tools.jar"
  215. location="${productTest.output.dir}/source-tools.jar"/>
  216. <mkdir dir="${test.source.classes.dir}"/>
  217. <delete dir="${test.source.classes.dir}"/>
  218. <mkdir dir="${test.source.classes.dir}"/>
  219. <!-- todo validate product builds by comparison or invocation -->
  220. <antcall target="build.source.call">
  221. <param name="target.name" value="runtime" />
  222. </antcall>
  223. <antcall target="build.source.call">
  224. <param name="target.name" value="compiler" />
  225. </antcall>
  226. <antcall target="build.source.call">
  227. <param name="target.name" value="ajde" />
  228. </antcall>
  229. <antcall target="build.source.call">
  230. <param name="target.name" value="ajdoc" />
  231. </antcall>
  232. <echo message="" file="${tools.source.out}.empty"/>
  233. <!-- comparefiles lhsFile="${tools.source.out}"
  234. rhsFile="${tools.source.out}.empty" / -->
  235. <jar jarfile="${source-tools.jar}"
  236. basedir="${test.source.classes.dir}"/>
  237. <comparefiles lhsFile="${product.tools.jar}"
  238. rhsFile="${source-tools.jar}" />
  239. <delete dir="${test.source.classes.dir}"/>
  240. </target>
  241. <target name="build.source.call" >
  242. <echo message="# building (source) using ajc${scriptExtension} @${product.src.dir}/${target.name}.lst"/>
  243. <mkdir dir="${test.source.classes.dir}/${target.name}"/>
  244. <exec dir="${product.src.dir}"
  245. executable="${product.bin.dir}/ajc${scriptExtension}"
  246. output="${tools.source.out}.${target.name}.txt">
  247. <arg value="-d"/>
  248. <arg value="${test.source.classes.dir}/${target.name}"/>
  249. <arg value="-classpath"/>
  250. <arg value="${product.rt.jar}${PS}${jdk.tools.jar}"/> <!-- 1.3 for ajdoc -->
  251. <arg value="-argfile"/>
  252. <arg value="${target.name}.lst"/>
  253. </exec>
  254. <echo message="# START building (source) ${target.name} output"/>
  255. <echo message="" file="${tools.source.out}.${target.name}.txt"/>
  256. <echo message="# END building (source) ${target.name} output"/>
  257. </target>
  258. </project>