aboutsummaryrefslogtreecommitdiffstats
path: root/tests/junitModules.xml
blob: f1584904aba3d6095b230c4c3d77fee135b7f42d (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
<!-- -*- 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) 2002 Xerox Corporation.         -->
<!-- All Rights Reserved.                                                           -->

<!-- ============================================================================== -->
<!-- This assumes a complete pre-built eclipse workspace                            -->
<!-- ============================================================================== -->

<project name="junitModules" default="test-all" basedir=".">
  <property name="project.name" value="junitModules"/>

    <target name="init">
      <property name="haltOnTestFailure" value="false"/>
      <property name="modules.dir"
            location="${basedir}/.."/>
      <property name="tests.module.dir"
            location="${modules.dir}/tests"/>
      <property name="aspectj.modules.lib.dir"
            location="${modules.dir}/lib"/>
      <property name="junitModules.output.dir"
            location="${tests.module.dir}/bin/junitXmlOutput" />
      <mkdir dir="${junitModules.output.dir}"/>
    </target>

    <target name="clean" depends="init">
      <delete dir="${junitModules.output.dir}"/>
    </target>
    

    <target name="jdepend" depends="init"
     description="run jdepend">
	  <jdepend format="xml">
	    <sourcespath>
	        <pathelement location="${tests.module.dir}/../testing/src" />
	    </sourcespath>
	    <classpath>
	        <pathelement location="${tests.module.dir}/../bin" />
	    </classpath>
      </jdepend>
    </target>

    <target name="redirect-test-all" depends="init"
     description="run from another Ant process to redirect output">
      <antcall target="clean"/>
      <mkdir dir="${junitModules.output.dir}"/>
      <ant dir="${basedir}" 
       antfile="junitModules.xml"
        target="run-test-all" 
    inheritAll="false"
        output="${junitModules.output.dir}/output.txt"/>
      <echo message="View log in ${junitModules.output.dir}/output.txt"/>
      <property name="fileUrl"
            location="${junitModules.output.dir}/html/index.html"/>
      <echo message="View results in file:${fileUrl}"/>
    </target>

    <target name="test-all" depends="init"
     description="run all module tests (except IDE integrations)">
      <!-- not running bridgeImpl, compiler, netbeans, jbuilder tests -->
     
      <mkdir dir="${junitModules.output.dir}"/>
      <delete dir="${junitModules.output.dir}"/>
      <mkdir dir="${junitModules.output.dir}"/>
 
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="ajbrowser"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="ajde"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="asm"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="weaver"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="bridge"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="build"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="org.aspectj.ajdt.core"/>
      </antcall>
      <!-- no JUnit testsrc in org.eclipse.jdt.core -->
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="testing"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="runtime"/>
      </antcall>

      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="taskdefs"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="testing"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="testing-client"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="testing-drivers"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="testing-util"/>
      </antcall>
      <antcall target="run-module-junit-tests">
         <param name="moduleName" value="util"/>
      </antcall>   

      <antcall target="report-tests"/>

    </target>

    <target name="init-taskdefs" depends="init"
     description="define junit taskdefs" >    
        <property name="aj.taskdef.package"
                  value="org.aspectj.internal.tools.ant.taskdefs"/>

        <taskdef name="junit"             
            classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask">
            <classpath>
              <pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
              <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
            </classpath>
        </taskdef>
        <taskdef name="junitreport"             
            classname="org.apache.tools.ant.taskdefs.optional.junit.XMLResultAggregator">
            <classpath>
              <pathelement location="${aspectj.modules.lib.dir}/ant/xlib/optional.jar" />
              <pathelement location="${aspectj.modules.lib.dir}/junit/junit.jar" />
            </classpath>
        </taskdef>

    </target>

    <target name="run-module-junit-tests" depends="init-taskdefs" 
     description="run all junit tests for a module">
      <mkdir dir="${junitModules.output.dir}/${moduleName}"/>
      <!-- fork to load classes, include AntRuntime to get taskdef classes junit.jar -->
      <echo message="Starting ${moduleName} tests..."/>
      <junit fork="on" includeAntRuntime="on" dir="${modules.dir}/${moduleName}"
           printsummary="yes" haltonfailure="${haltOnTestFailure}" >
        <classpath>
          <pathelement location="${modules.dir}/ajde/bin" />
          <pathelement location="${modules.dir}/ajbrowser/bin" />
          <pathelement location="${modules.dir}/asm/bin" />
          <pathelement location="${modules.dir}/bridge/bin" />
          <pathelement location="${modules.dir}/build/bin" />
          <pathelement location="${modules.dir}/org.aspectj.ajdt.core/bin" />
          <pathelement location="${modules.dir}/org.eclipse.jdt.core/bin" />
          <pathelement location="${modules.dir}/runtime/bin" />
          <pathelement location="${modules.dir}/taskdefs/bin" />
          <pathelement location="${modules.dir}/testing/bin" />
          <pathelement location="${modules.dir}/testing-client/bin" />
          <pathelement location="${modules.dir}/testing-drivers/bin" />
          <pathelement location="${modules.dir}/testing-util/bin" />
          <pathelement location="${modules.dir}/util/bin" />
          <pathelement location="${modules.dir}/weaver/bin" />
          <pathelement location="${aspectj.modules.lib.dir}/eclipse2.0/jdtDepends.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/bcel/bcel.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/jdiff/jdiff.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/commons/commons.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/ant/lib/ant.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/ant/lib/xml-apis.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/ant/lib/xercesImpl.jar" />
          <pathelement location="${aspectj.modules.lib.dir}/test/aspectjrt.jar" />
        </classpath>

        <formatter type="xml"/>

        <batchtest todir="${junitModules.output.dir}/${moduleName}">
          <formatter type="xml"/>
          <fileset dir="${modules.dir}/${moduleName}/testsrc">
            <include name="*ModuleTests.java" />
          </fileset>
        </batchtest>        
      </junit>        
    </target>

    <target name="report-tests" depends="init-taskdefs">
      <mkdir dir="${junitModules.output.dir}/html"/>
      <junitreport todir="${junitModules.output.dir}/html"
                  tofile="results.html">
        <fileset dir="${junitModules.output.dir}/">
          <include name="**/TEST-*.xml"/>
        </fileset>
        <report format="frames" 
                 todir="${junitModules.output.dir}/html"/>
      </junitreport>     
      <property name="fileUrl"
            location="${junitModules.output.dir}/html/index.html"/>
      <echo message="View results in file:${fileUrl}"/>
    </target>
</project>