File: test-jar.xml

package info (click to toggle)
commons-math 2.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 9,736 kB
  • sloc: java: 97,410; xml: 6,776; makefile: 18
file content (130 lines) | stat: -rw-r--r-- 4,942 bytes parent folder | download | duplicates (4)
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
<?xml version="1.0" encoding="UTF-8"?>

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->

<!--
   Compiles and runs unit tests against distribution jar(s).  Use .antrc or the 
   command line to control the jdk used to execute this build file.  
   
   Assumes that the distribution jar to be tested is in the base directory. 
   Use the "jardir" property to specify the path to the directory containing
   the jar. Any other jars in this directory will also be added to the
   classpath.  
   
   The default target, "test," executes clean as a dependency.
-->
  
<project default="test" name="commons-math" basedir=".">
  <!-- JDK level -->
  <property name="compile.source"          value="1.5"/>
  <property name="compile.target"          value="1.5"/>

  <property name="defaulttargetdir" value="target"/>
  <property name="testclassesdir" value="target/test-classes"/>
  <property name="testreportdir" value="target/test-reports"/>
  <property name="jardir" value="${basedir}"/>
  <path id="build.classpath">
    <fileset dir="${jardir}">
      <include name="*.jar">
      </include>
    </fileset>
  </path>

  <target name="clean" description="o Clean up the generated directories">
    <delete dir="${defaulttargetdir}"/>
  </target>

  <target name="init" description="o Initializes some properties">
    <echo>
    JAVA ENVIRONMENT
    **************************Java runtime version*****************************
    ${java.runtime.version}
    **************************Java class path**********************************
    ${java.class.path}
    **************************Java home****************************************
    ${java.home}
     *************************Java library path*******************************
    Java library path: ${java.library.path}
    ===========================================================================
    </echo>
    <!--Test if JUNIT is present in ANT classpath-->
    <available property="Junit.present" classname="junit.framework.Test">
    </available>
  </target>

  <target name="test" description="o Run the test cases" if="test.failure" depends="internal-test">
    <fail message="There were test failures.">
    </fail>
  </target>

  <target name="internal-test" if="Junit.present" depends="clean,junit-present,compile-tests,test-only"/>

  <target name="test-only">
    <mkdir dir="${testreportdir}"/>
    <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="false">
      <sysproperty key="basedir" value="."/>
      <formatter usefile="true" type="brief"/>
      <classpath>
        <path refid="build.classpath"/>
        <pathelement path="${testclassesdir}"/>
      </classpath>
      <batchtest todir="${testreportdir}">
        <fileset dir="src/test/java">
          <include name="**/*Test.java"/>
          <include name="**/*TestBinary.java"/> 
          <include name="**/*TestPermutations.java"/> 
          <exclude name="**/*AbstractTest.java"/>
        </fileset>
      </batchtest>
    </junit>
  </target>

  <target name="junit-present" unless="Junit.present" depends="init">
  <echo>
    ================================= WARNING ================================
    Junit isn't present in your ${ANT_HOME}/lib directory. Tests not executed.
    ==========================================================================
  </echo>
  </target>

  <target name="compile-tests" if="Junit.present" depends="junit-present">
    <mkdir dir="${testclassesdir}"/>
    <!--  includeantruntime="true" because JUnit may be provided by Ant -->
    <javac destdir="${testclassesdir}" 
            deprecation="false" 
            debug="true"
            includeantruntime="true"
            source="${compile.source}"
            target="${compile.target}"
            optimize="false" 
            excludes="**/package.html">
      <src>
        <pathelement location="src/test"/>
      </src>
      <classpath>
        <path refid="build.classpath"/>
      </classpath>
    </javac>
    <copy todir="${testclassesdir}">
      <fileset dir="src/test/resources">
        <include name="**/*.xml"/>
        <include name="**/*.txt"/>
      </fileset>
    </copy>
  </target>
</project>