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.

build-tests.xml 3.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project name="DMDirc-tests" default="default" basedir=".">
  3. <description>Test-related tasks for DMDirc.</description>
  4. <property name="clover.jar" location="/home/dmdirc/clover/clover/lib/clover.jar"/>
  5. <taskdef resource="cloverlib.xml" classpath="${clover.jar}"/>
  6. <taskdef resource="cloverjunitlib.xml" classpath="${clover.jar}"/>
  7. <available property="clover.installed" classname="com.cenqua.clover.CloverInstr" />
  8. <available file="/usr/bin/xvfb-run" property="has.xvfb"/>
  9. <target name="with.clover" depends="clean" if="clover.installed"
  10. description="Set up Clover to instrument tests.">
  11. <clover-clean/>
  12. <clover-env/>
  13. <clover-setup>
  14. <fileset dir="src/com/" includes="**/*.java" />
  15. <fileset dir="test/com/">
  16. <include name="**/*.java" />
  17. <exclude name="**/harness/**/*.java" />
  18. </fileset>
  19. </clover-setup>
  20. </target>
  21. <target name="clover.snapshot" depends="with.clover">
  22. <clover-snapshot/>
  23. </target>
  24. <target name="clover.xml" if="clover.installed"
  25. description="Generate a Clover XML report.">
  26. <mkdir dir="reports/clover" />
  27. <clover-report>
  28. <current outfile="reports/clover/clover.xml"/>
  29. </clover-report>
  30. </target>
  31. <target name="clover.html" if="clover.installed"
  32. description="Generate a Clover HTML report.">
  33. <mkdir dir="reports/clover" />
  34. <mkdir dir="reports/clover/history" />
  35. <clover-historypoint historydir="reports/clover/history" />
  36. <clover-report>
  37. <current outfile="reports/clover">
  38. <format type="html"/>
  39. </current>
  40. <historical outfile="reports/clover" historydir="reports/clover/history" />
  41. </clover-report>
  42. </target>
  43. <property name="test.reports" value="./junitreports" />
  44. <target name="-do-test-reports">
  45. <mkdir dir="${test.reports}" />
  46. <junitreport todir="${test.reports}">
  47. <fileset dir="${build.test.results.dir}">
  48. <include name="TEST-*.xml" />
  49. </fileset>
  50. <report todir="${test.reports}" />
  51. </junitreport>
  52. </target>
  53. <target name="test" depends="check-use-xvfb, -test-xvfb, -test-no-xvfb"/>
  54. <target name="check-use-xvfb">
  55. <condition property="use.xvfb">
  56. <and>
  57. <not>
  58. <equals arg1="${xvfb.disable}" arg2="true" />
  59. </not>
  60. <equals arg1="${has.xvfb}" arg2="true" />
  61. </and>
  62. </condition>
  63. </target>
  64. <target name="-test-xvfb" if="use.xvfb">
  65. <exec executable="/usr/bin/xvfb-run">
  66. <arg value="-a"/>
  67. <arg value="-s"/>
  68. <arg value="-screen 0 1280x1024x24"/>
  69. <arg value="-w"/>
  70. <arg value="-5"/>
  71. <arg value="/usr/bin/ant"/>
  72. <arg value="do-real-test"/>
  73. </exec>
  74. </target>
  75. <target name="-test-no-xvfb" unless="use.xvfb">
  76. <antcall target="do-real-test"/>
  77. </target>
  78. <target name="test-html" depends="with.clover,compile-test,test,clover.html,clover.snapshot"
  79. description="Run tests and generate a Clover HTML report."/>
  80. <target name="test-xml" depends="with.clover,compile-test,test,clover.xml,clover.snapshot"
  81. description="Run tests and generate a Clover XML report."/>
  82. <target name="test-both" depends="test-html,test-xml"
  83. description="Run tests and generate Clover XML and HTML reports."/>
  84. </project>