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.

junitModules.xml 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502
  1. <!-- ============================================================================== -->
  2. <!-- This assumes a complete pre-built eclipse workspace -->
  3. <!-- ============================================================================== -->
  4. <project name="junitModules" default="test-all-but-ajc" basedir=".">
  5. <property name="project.name" value="junitModules"/>
  6. <target name="info">
  7. <echo >
  8. Variables to consider defining:
  9. aspectjrt.path path to release version of runtime
  10. test.classpath use "jar.classpath" or "bin.classpath"
  11. (default is bin if available)
  12. Both require module tests be built with the modules.
  13. bin.classpath: use eclipse bin/ directories
  14. jar.classpath: use build.xml jar files:
  15. cd build
  16. ant clean
  17. ant -Dtrim.testing.default=false build-testing-jars
  18. java13.path: path to jdk 1.3 java.exe command for ajc tests
  19. java14.path: path to jdk 1.4 java.exe command for ajc tests
  20. </echo>
  21. </target>
  22. <target name="init">
  23. <property name="haltOnTestFailure" value="false"/>
  24. <property name="modules.dir"
  25. location="${basedir}/.."/>
  26. <property name="jar.dir"
  27. location="${modules.dir}/aj-build/jars"/>
  28. <property name="tests.module.dir"
  29. location="${modules.dir}/tests"/>
  30. <property name="aspectj.modules.lib.dir"
  31. location="${modules.dir}/lib"/>
  32. <property name="harness.lib.dir"
  33. location="${aspectj.modules.lib.dir}/test"/>
  34. <property name="junitModules.output.dir"
  35. location="${tests.module.dir}/bin/junitXmlOutput" />
  36. <property name="aspectjrt.path"
  37. location="${aspectj.modules.lib.dir}/test/aspectjrt.jar"/>
  38. <property name="ajc.tests.xml.file"
  39. location="${tests.module.dir}/ajcTests.xml"/>
  40. <property name="ajc.tests.output.file"
  41. location="${junitModules.output.dir}/ajc/TEST-ajcTests.xml"/>
  42. <property name="ajc.tests.emacssym.xml.file"
  43. location="${tests.module.dir}/ajcTestsEmacssym.xml"/>
  44. <property name="ajc.tests.emacssym.output.file"
  45. location="${junitModules.output.dir}/ajc/TEST-ajcTestsEmacssym.xml"/>
  46. <mkdir dir="${junitModules.output.dir}"/>
  47. <path id="lib.classpath">
  48. <pathelement location="${aspectj.modules.lib.dir}/bcel/bcel.jar" />
  49. <pathelement location="${aspectj.modules.lib.dir}/jdiff/jdiff.jar" />
  50. <pathelement location="${aspectj.modules.lib.dir}/commons/commons.jar" />
  51. <pathelement location="${aspectj.modules.lib.dir}/ant/lib/ant.jar" />
  52. <pathelement location="${aspectj.modules.lib.dir}/ant/lib/xml-apis.jar" />
  53. <pathelement location="${aspectj.modules.lib.dir}/ant/lib/xercesImpl.jar" />
  54. <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
  55. <pathelement location="${modules.dir}/org.eclipse.jdt.core/jdtcore-for-aspectj.jar" />
  56. </path>
  57. <path id="bin.classpath">
  58. <pathelement location="${modules.dir}/ajde/bin" />
  59. <pathelement location="${modules.dir}/ajbrowser/bin" />
  60. <pathelement location="${modules.dir}/asm/bin" />
  61. <pathelement location="${modules.dir}/bridge/bin" />
  62. <pathelement location="${modules.dir}/build/bin" />
  63. <pathelement location="${modules.dir}/org.aspectj.ajdt.core/bin" />
  64. <pathelement location="${modules.dir}/runtime/bin" />
  65. <pathelement location="${modules.dir}/taskdefs/bin" />
  66. <pathelement location="${modules.dir}/testing/bin" />
  67. <pathelement location="${modules.dir}/testing-client/bin" />
  68. <pathelement location="${modules.dir}/testing-drivers/bin" />
  69. <pathelement location="${modules.dir}/testing-util/bin" />
  70. <pathelement location="${modules.dir}/util/bin" />
  71. <pathelement location="${modules.dir}/weaver/bin" />
  72. <path refid="lib.classpath"/>
  73. </path>
  74. <!-- requires normal build, i.e., with test classes -->
  75. <path id="jar.classpath">
  76. <pathelement location="${jar.dir}/ajde.jar" />
  77. <pathelement location="${jar.dir}/ajbrowser.jar" />
  78. <pathelement location="${jar.dir}/asm.jar" />
  79. <pathelement location="${jar.dir}/bridge.jar" />
  80. <pathelement location="${jar.dir}/build.jar" />
  81. <pathelement location="${jar.dir}/org.aspectj.ajdt.core.jar" />
  82. <pathelement location="${jar.dir}/runtime.jar" />
  83. <pathelement location="${jar.dir}/taskdefs.jar" />
  84. <pathelement location="${jar.dir}/testing.jar" />
  85. <pathelement location="${jar.dir}/testing-client.jar" />
  86. <pathelement location="${jar.dir}/testing-drivers.jar" />
  87. <pathelement location="${jar.dir}/testing-util.jar" />
  88. <pathelement location="${jar.dir}/util.jar" />
  89. <pathelement location="${jar.dir}/weaver.jar" />
  90. <path refid="lib.classpath"/>
  91. </path>
  92. <available property="bin.path.available"
  93. file="${modules.dir}/weaver/bin"/>
  94. <available property="jar.path.available"
  95. file="${jar.dir}/asm.jar"/>
  96. </target>
  97. <target name="select-path"
  98. depends="select-jar,select-bin"
  99. unless="test.classpath"/>
  100. <target name="select-bin" depends="init"
  101. if="bin.path.available">
  102. <property name="test.classpath" value="bin.classpath"/>
  103. </target>
  104. <target name="select-jar" depends="init"
  105. if="jar.path.available" unless="bin.path.available">
  106. <property name="test.classpath" value="jar.classpath"/>
  107. </target>
  108. <target name="clean" depends="init">
  109. <delete dir="${junitModules.output.dir}"/>
  110. </target>
  111. <target name="jdepend" depends="init"
  112. description="run jdepend - untested">
  113. <jdepend format="xml">
  114. <sourcespath>
  115. <pathelement location="${tests.module.dir}/../testing/src" />
  116. </sourcespath>
  117. <classpath>
  118. <pathelement location="${tests.module.dir}/../bin" />
  119. </classpath>
  120. </jdepend>
  121. </target>
  122. <target name="redirect-test-all" depends="init"
  123. description="run from another Ant process to redirect output">
  124. <antcall target="clean"/>
  125. <mkdir dir="${junitModules.output.dir}"/>
  126. <ant dir="${basedir}"
  127. antfile="junitModules.xml"
  128. target="run-test-all"
  129. inheritAll="false"
  130. output="${junitModules.output.dir}/output.txt"/>
  131. <echo message="View log in ${junitModules.output.dir}/output.txt"/>
  132. <property name="fileUrl"
  133. location="${junitModules.output.dir}/html/index.html"/>
  134. <echo message="View results in file:${fileUrl}"/>
  135. </target>
  136. <target name="test-all-at-once" depends="init,select-path"
  137. description="run all module tests (except IDE integrations)">
  138. <echo message="fails - AJDE needs ../ajde-style paths"/>
  139. <mkdir dir="${junitModules.output.dir}"/>
  140. <delete dir="${junitModules.output.dir}"/>
  141. <mkdir dir="${junitModules.output.dir}"/>
  142. <junit fork="on"
  143. includeAntRuntime="off"
  144. dir="${tests.module.dir}"
  145. printsummary="yes"
  146. haltonfailure="${haltOnTestFailure}" >
  147. <classpath>
  148. <path refid="${test.classpath}"/>
  149. </classpath>
  150. <jvmarg value="-Daspectjrt.path=${aspectjrt.path}" />
  151. <formatter type="xml"/>
  152. <batchtest todir="${junitModules.output.dir}">
  153. <formatter type="xml"/>
  154. <fileset dir="${modules.dir}/ajbrowser/testsrc">
  155. <include name="*ModuleTests.java" />
  156. </fileset>
  157. <fileset dir="${modules.dir}/asm/testsrc">
  158. <include name="*ModuleTests.java" />
  159. </fileset>
  160. <fileset dir="${modules.dir}/ajde/testsrc">
  161. <include name="*ModuleTests.java" />
  162. </fileset>
  163. <fileset dir="${modules.dir}/bridge/testsrc">
  164. <include name="*ModuleTests.java" />
  165. </fileset>
  166. <fileset dir="${modules.dir}/build/testsrc">
  167. <include name="*ModuleTests.java" />
  168. </fileset>
  169. <fileset dir="${modules.dir}/org.aspectj.ajdt.core/testsrc">
  170. <include name="*ModuleTests.java" />
  171. </fileset>
  172. <fileset dir="${modules.dir}/runtime/testsrc">
  173. <include name="*ModuleTests.java" />
  174. </fileset>
  175. <fileset dir="${modules.dir}/taskdefs/testsrc">
  176. <include name="*ModuleTests.java" />
  177. </fileset>
  178. <fileset dir="${modules.dir}/testing/testsrc">
  179. <include name="*ModuleTests.java" />
  180. </fileset>
  181. <fileset dir="${modules.dir}/testing-client/testsrc">
  182. <include name="*ModuleTests.java" />
  183. </fileset>
  184. <fileset dir="${modules.dir}/testing-drivers/testsrc">
  185. <include name="*ModuleTests.java" />
  186. </fileset>
  187. <fileset dir="${modules.dir}/testing-util/testsrc">
  188. <include name="*ModuleTests.java" />
  189. </fileset>
  190. <fileset dir="${modules.dir}/util/testsrc">
  191. <include name="*ModuleTests.java" />
  192. </fileset>
  193. <fileset dir="${modules.dir}/weaver/testsrc">
  194. <include name="*ModuleTests.java" />
  195. </fileset>
  196. </batchtest>
  197. </junit>
  198. </target>
  199. <target name="test-ajctest-junit" depends="init,select-path"
  200. description="run JUnit tests">
  201. <antcall target="run-ajctests-junit-tests"/>
  202. <antcall target="report-tests"/>
  203. </target>
  204. <target name="test-all-but-ajc" depends="init,select-path"
  205. description="run all module tests (except IDE integrations)">
  206. <mkdir dir="${junitModules.output.dir}"/>
  207. <delete dir="${junitModules.output.dir}"/>
  208. <mkdir dir="${junitModules.output.dir}"/>
  209. <antcall target="run-module-junit-tests">
  210. <param name="moduleName" value="ajbrowser"/>
  211. </antcall>
  212. <antcall target="run-module-junit-tests">
  213. <param name="moduleName" value="ajde"/>
  214. </antcall>
  215. <antcall target="run-module-junit-tests">
  216. <param name="moduleName" value="asm"/>
  217. </antcall>
  218. <antcall target="run-module-junit-tests">
  219. <param name="moduleName" value="weaver"/>
  220. </antcall>
  221. <antcall target="run-module-junit-tests">
  222. <param name="moduleName" value="bridge"/>
  223. </antcall>
  224. <antcall target="run-module-junit-tests">
  225. <param name="moduleName" value="build"/>
  226. </antcall>
  227. <antcall target="run-module-junit-tests">
  228. <param name="moduleName" value="org.aspectj.ajdt.core"/>
  229. </antcall>
  230. <!-- no JUnit testsrc in org.eclipse.jdt.core -->
  231. <antcall target="run-module-junit-tests">
  232. <param name="moduleName" value="runtime"/>
  233. </antcall>
  234. <antcall target="run-module-junit-tests">
  235. <param name="moduleName" value="taskdefs"/>
  236. </antcall>
  237. <antcall target="run-module-junit-tests">
  238. <param name="moduleName" value="testing"/>
  239. </antcall>
  240. <antcall target="run-module-junit-tests">
  241. <param name="moduleName" value="testing-client"/>
  242. </antcall>
  243. <antcall target="run-module-junit-tests">
  244. <param name="moduleName" value="testing-drivers"/>
  245. </antcall>
  246. <antcall target="run-module-junit-tests">
  247. <param name="moduleName" value="testing-util"/>
  248. </antcall>
  249. <antcall target="run-module-junit-tests">
  250. <param name="moduleName" value="util"/>
  251. </antcall>
  252. <antcall target="report-tests"/>
  253. </target>
  254. <target name="test-all" depends="init,select-path"
  255. description="run all module tests (except IDE integrations)">
  256. <mkdir dir="${junitModules.output.dir}"/>
  257. <delete dir="${junitModules.output.dir}"/>
  258. <mkdir dir="${junitModules.output.dir}"/>
  259. <antcall target="run-module-junit-tests">
  260. <param name="moduleName" value="ajbrowser"/>
  261. </antcall>
  262. <antcall target="run-module-junit-tests">
  263. <param name="moduleName" value="ajde"/>
  264. </antcall>
  265. <antcall target="run-module-junit-tests">
  266. <param name="moduleName" value="asm"/>
  267. </antcall>
  268. <antcall target="run-module-junit-tests">
  269. <param name="moduleName" value="weaver"/>
  270. </antcall>
  271. <antcall target="run-module-junit-tests">
  272. <param name="moduleName" value="bridge"/>
  273. </antcall>
  274. <antcall target="run-module-junit-tests">
  275. <param name="moduleName" value="build"/>
  276. </antcall>
  277. <antcall target="run-module-junit-tests">
  278. <param name="moduleName" value="org.aspectj.ajdt.core"/>
  279. </antcall>
  280. <!-- no JUnit testsrc in org.eclipse.jdt.core -->
  281. <antcall target="run-module-junit-tests">
  282. <param name="moduleName" value="runtime"/>
  283. </antcall>
  284. <antcall target="run-module-junit-tests">
  285. <param name="moduleName" value="taskdefs"/>
  286. </antcall>
  287. <antcall target="run-module-junit-tests">
  288. <param name="moduleName" value="testing"/>
  289. </antcall>
  290. <antcall target="run-module-junit-tests">
  291. <param name="moduleName" value="testing-client"/>
  292. </antcall>
  293. <antcall target="run-module-junit-tests">
  294. <param name="moduleName" value="testing-drivers"/>
  295. </antcall>
  296. <antcall target="run-module-junit-tests">
  297. <param name="moduleName" value="testing-util"/>
  298. </antcall>
  299. <antcall target="run-module-junit-tests">
  300. <param name="moduleName" value="util"/>
  301. </antcall>
  302. <!-- run the ajc tests too...
  303. -->
  304. <antcall target="ajc-tests">
  305. </antcall>
  306. <antcall target="ajc-tests-emacssym">
  307. </antcall>
  308. <antcall target="report-tests"/>
  309. </target>
  310. <target name="init-taskdefs" depends="init"
  311. description="define junit taskdefs" >
  312. <property name="aj.taskdef.package"
  313. value="org.aspectj.internal.tools.ant.taskdefs"/>
  314. <taskdef name="junit"
  315. classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
  316. <classpath>
  317. <pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
  318. <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
  319. </classpath>
  320. </taskdef>
  321. <taskdef name="junitreport"
  322. classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
  323. <classpath>
  324. <pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
  325. <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
  326. </classpath>
  327. </taskdef>
  328. </target>
  329. <target name="run-ajctests-junit-tests" depends="init-taskdefs"
  330. description="run the JUnit harness wrapper tests">
  331. <mkdir dir="${junitModules.output.dir}/ajctest"/>
  332. <delete dir="${junitModules.output.dir}/ajctest"/>
  333. <mkdir dir="${junitModules.output.dir}/ajctest"/>
  334. <!-- fork to load classes, include AntRuntime to get taskdef classes junit.jar -->
  335. <echo message="Starting ajctest JUnit tests..."/>
  336. <junit fork="on"
  337. includeAntRuntime="off"
  338. dir="${modules.dir}/testing-drivers"
  339. printsummary="yes"
  340. haltonfailure="${haltOnTestFailure}" >
  341. <classpath>
  342. <path refid="${test.classpath}"/>
  343. <pathelement location="${aspectjrt.path}"/>
  344. </classpath>
  345. <jvmarg value="-Daspectjrt.path=${aspectjrt.path}" />
  346. <jvmarg value="-Dharness.libdir=${harness.lib.dir}" />
  347. <formatter type="xml"/>
  348. <batchtest todir="${junitModules.output.dir}/ajctest">
  349. <formatter type="xml"/>
  350. <fileset dir="${modules.dir}/testing-drivers/testsrc">
  351. <include name="org/aspectj/testing/drivers/*UsingJUnit.java" />
  352. </fileset>
  353. </batchtest>
  354. </junit>
  355. </target>
  356. <target name="run-module-junit-tests" depends="init-taskdefs"
  357. description="run all junit tests for a module">
  358. <mkdir dir="${junitModules.output.dir}/${moduleName}"/>
  359. <!-- fork to load classes, include AntRuntime to get taskdef classes junit.jar -->
  360. <echo message="Starting ${moduleName} tests..."/>
  361. <junit fork="on"
  362. includeAntRuntime="off"
  363. dir="${modules.dir}/${moduleName}"
  364. printsummary="yes"
  365. haltonfailure="${haltOnTestFailure}" >
  366. <classpath>
  367. <path refid="${test.classpath}"/>
  368. <pathelement location="${aspectjrt.path}"/>
  369. </classpath>
  370. <!-- AMC added this next line, needed when testing release builds,
  371. (those whose version is something other than DEVELOPMENT). The NullIdeAdapter
  372. used for various Ajde tests picks up this property and adds it to the project
  373. classpath, which allows the Ajde version tests to complete.
  374. Having built a release version, use e.g.
  375. ant -Daspectjrt.path=../aj-build/dist/lib/aspectjrt.jar
  376. -->
  377. <jvmarg value="-Daspectjrt.path=${aspectjrt.path}" />
  378. <formatter type="xml"/>
  379. <batchtest todir="${junitModules.output.dir}/${moduleName}">
  380. <formatter type="xml"/>
  381. <fileset dir="${modules.dir}/${moduleName}/testsrc">
  382. <include name="*ModuleTests.java" />
  383. </fileset>
  384. </batchtest>
  385. </junit>
  386. </target>
  387. <target name="report-tests" depends="init-taskdefs">
  388. <mkdir dir="${junitModules.output.dir}/html"/>
  389. <junitreport todir="${junitModules.output.dir}/html"
  390. tofile="results.html">
  391. <fileset dir="${junitModules.output.dir}/">
  392. <include name="**/TEST-*.xml"/>
  393. </fileset>
  394. <report format="frames"
  395. todir="${junitModules.output.dir}/html"/>
  396. </junitreport>
  397. <property name="fileUrl"
  398. location="${junitModules.output.dir}/html/index.html"/>
  399. <echo message="View results in file:${fileUrl}"/>
  400. </target>
  401. <target name="ajc-tests" depends="init-taskdefs">
  402. <mkdir dir="${junitModules.output.dir}/ajc"/>
  403. <java classname="org.aspectj.testing.drivers.Harness"
  404. classpathref="${test.classpath}"
  405. output="${ajc.tests.output.file}"
  406. fork="true">
  407. <arg value="-cruisecontrol"/>
  408. <arg file="${ajc.tests.xml.file}"/>
  409. </java>
  410. </target>
  411. <target name="ajc-tests-emacssym" depends="init-taskdefs">
  412. <mkdir dir="${junitModules.output.dir}/ajc"/>
  413. <copy file="${ajc.tests.xml.file}" tofile="${ajc.tests.emacssym.xml.file}"/>
  414. <java classname="org.aspectj.testing.drivers.Harness"
  415. classpathref="${test.classpath}"
  416. output="${ajc.tests.emacssym.output.file}"
  417. fork="true">
  418. <arg value="-cruisecontrol"/>
  419. <arg value="-emacssym"/>
  420. <arg file="${ajc.tests.emacssym.xml.file}"/>
  421. </java>
  422. <delete file="${ajc.tests.emacssym.xml.file}"/>
  423. </target>
  424. </project>