File: test.xml

package info (click to toggle)
jruby 1.7.26-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 84,572 kB
  • sloc: ruby: 669,910; java: 253,056; xml: 35,152; ansic: 9,187; yacc: 7,267; cpp: 5,244; sh: 1,036; makefile: 345; jsp: 48; tcl: 40
file content (327 lines) | stat: -rw-r--r-- 14,811 bytes parent folder | download
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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="..">
    <import file="../build.xml"/>
    
    <regexp id="no-maxperm-java-versions" pattern="^1\.8"/>
    <condition property="maxpermgen.arg" value="-XX:MaxPermSize=${jruby.test.memory.permgen}">
      <not>
        <matches string="${java.version}">
          <regexp refid="no-maxperm-java-versions"/>
        </matches>
      </not>
    </condition>
    <condition property="maxpermgen.arg" value="">
      <matches string="${java.version}">
        <regexp refid="no-maxperm-java-versions"/>
      </matches>
    </condition>

	<target name="compile-test" depends="jar" description="Compile the unit tests">
        <javac destdir="${test.classes.dir}" deprecation="true" encoding="UTF-8" debug="true"
               source="${javac.version}" target="${javac.version}" includeantruntime="false">
            <classpath>
                <path refid="jruby.execute.classpath"/>
                <pathelement path="${lib.dir}/jruby.jar"/>
            </classpath>
            <src path="${test.dir}"/>
            <src path="${spec.dir}"/>
            <patternset refid="java.src.pattern"/>
        </javac>
    </target>

    <target name="copy-test-files" depends="compile-test"
            description="Make tests fails available as resources">
        <copy todir="${test.classes.dir}">
            <fileset dir="${test.dir}" includes="org/**/*.rb"/>
        </copy>
    </target>

    <target name="test" depends="test-extended"/>

    <target name="test-extended">
        <!-- First, ensure we're bootstrapped -->
        <exec executable="mvn">
            <arg line="-q"/>
            <arg line="-Pbootstrap"/>
            <arg line="package"/>
        </exec>
        
        <!-- Then run Ruby tests from Rake -->
        <java classname="org.jruby.Main" fork="true" failonerror="true">
            <classpath refid="test.class.path"/>
            <jvmarg line="${java.opts}"/>
            <jvmarg line="-Djruby.home=${basedir}"/>
            <arg line="-S rake test:extended"/>
        </java>
    </target>

    <target name="test-dist">
        <!-- First, ensure we're bootstrapped -->
        <exec executable="mvn">
            <arg line="-q"/>
            <arg line="-Pbootstrap"/>
            <arg line="package"/>
        </exec>

        <java classname="org.jruby.Main" fork="true" failonerror="true">
            <classpath refid="test.class.path"/>
            <jvmarg line="${java.opts}"/>
            <jvmarg line="-Djruby.home=${basedir}"/>
            <arg line="-S rake test:dist"/>
        </java>
    </target>

    <target name="test-compiled" depends="copy-test-files,run-junit-compiled,run-junit-precompiled"/>
    <target name="test-precompiled" depends="copy-test-files,run-junit-precompiled"/>
    <target name="test-interpreted" depends="copy-test-files,run-junit-interpreted"/>
    <target name="test-reflected"
            depends="copy-test-files,run-junit-reflected-compiled,run-junit-reflected-precompiled,run-junit-reflected-interpreted"/>
    <target name="test-threadpool"
            depends="copy-test-files,run-junit-compiled-threadpool,run-junit-precompiled-threadpool,run-junit-interpreted-threadpool"/>

    <!-- Run tests jitted and with all indy stuff enabled -->
    <target name="test-compiled-indy" depends="copy-test-files,run-junit-compiled-indy"/>

    <target name="test-all" depends="
      copy-test-files,
      bootstrap,
      test-security-manager,
      run-junit-interpreted,
      run-junit-embed,
      run-junit-compiled,
      run-junit-precompiled,
      run-junit-reflected-precompiled,
      run-junit-interpreted-threadpool,
      compile-stdlib"
            description="Runs unit tests in all modes."/>

    <!-- All junit permutations for 1.8 and 1.9 support -->
    <target name="run-junit-interpreted">
        <run-junit-1.8/>
    </target>
    <target name="run-junit-reflected-interpreted">
        <run-junit-1.8 reflection="true"/>
    </target>
    <target name="run-junit-compiled">
        <run-junit-1.8 compile.mode="JIT" jit.threshold="0"/>
    </target>
    <target name="run-junit-compiled-indy">
        <run-junit-1.8 compile.mode="JIT" jit.threshold="0" jvm.flags="-Djruby.invokedynamic.all=true"/>
    </target>
    <target name="run-junit-compiled-short">
        <run-junit-1.8-short compile.mode="JIT" jit.threshold="0"/>
    </target>
    <target name="run-junit-interpreted-short">
        <run-junit-1.8-short/>
    </target>
    <target name="run-junit-interpreted-short-debug">
        <run-junit-1.8-short jvm.flags="-Xdebug -Xrunjdwp:transport=dt_socket,suspend=n,address=5001"/>
    </target>
    <target name="run-junit-reflected-compiled">
        <run-junit-1.8 compile.mode="JIT" jit.threshold="0" reflection="true"/>
    </target>
    <target name="run-junit-precompiled">
        <run-junit-1.8 compile.mode="FORCE" jit.threshold="0"/>
    </target>
    <target name="run-junit-reflected-precompiled">
        <run-junit-1.8 compile.mode="FORCE" jit.threshold="0" reflection="true"/>
    </target>
    <target name="run-junit-threadpool" depends="run-junit-interpreted-threadpool,run-junit-compiled-threadpool"/>
    <target name="run-junit-interpreted-threadpool">
        <run-junit-1.8 thread.pooling="true"/>
    </target>
    <target name="run-junit-compiled-threadpool">
        <run-junit-1.8 compile.mode="JIT" jit.threshold="0" thread.pooling="true"/>
    </target>
    <target name="run-junit-precompiled-threadpool">
        <run-junit-1.8 compile.mode="FORCE" jit.threshold="0" thread.pooling="true"/>
    </target>
    <target name="run-junit-embed" depends="copy-test-files" description="Runs unit embedding API tests.">
        <run-junit-embed-all/>
    </target>

    <path id="test.class.path">
        <pathelement path="${build.lib.dir}/junit.jar"/>
        <pathelement path="${build.lib.dir}/livetribe-jsr223-2.0.6.jar"/>
        <pathelement path="${build.lib.dir}/bsf.jar"/>
        <pathelement path="${build.lib.dir}/commons-logging-1.1.1.jar"/>
        <pathelement path="${java.class.path}"/>
        <pathelement path="${lib.dir}/jruby.jar"/>
        <pathelement location="${test.classes.dir}"/>
        <pathelement path="${test.dir}/requireTest.jar"/>
        <pathelement location="${test.dir}"/>
    </path>

    <macrodef name="run-junit">
        <attribute name="jruby.version" default="ruby1_8"/>
        <attribute name="compile.mode" default="OFF"/>
        <attribute name="jit.threshold" default="20"/>
        <attribute name="jit.maxsize" default="20"/>
        <attribute name="jit.max" default="-1"/>
        <attribute name="objectspace.enabled" default="false"/>
        <attribute name="thread.pooling" default="false"/>
        <attribute name="reflection" default="false"/>
        <attribute name="jvm.flags" default=""/>

        <element name="junit-tests"/>
        <sequential>
          <echo message="compile=@{compile.mode}, jit.threshold=@{jit.threshold}, jit.maxsize=@{jit.maxsize}, jit.max=@{jit.max}, objectspace=@{objectspace.enabled} threadpool=@{thread.pooling} reflection=@{reflection} version=@{jruby.version} maxpermgen.arg=${maxpermgen.arg} ant.version=${ant.version} java.version=${java.version}"/>
            <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
                     classpath="${build.lib.dir}/junit.jar"/>

            <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}"
                   maxmemory="${jruby.test.memory}" showoutput="true" timeout="1800000">
                <env key="RUBYOPT" value=""/>
                <env key="JRUBY_OPTS" value=""/>

                <classpath refid="test.class.path"/>

                <sysproperty key="java.awt.headless" value="true"/>
                <sysproperty key="jruby.home" value="${basedir}"/>
                <sysproperty key="jruby.lib" value="${lib.dir}"/>
                <sysproperty key="jruby.compile.mode" value="@{compile.mode}"/>
                <sysproperty key="jruby.jit.threshold" value="@{jit.threshold}"/>
                <sysproperty key="jruby.jit.maxsize" value="@{jit.maxsize}"/>
                <sysproperty key="jruby.jit.max" value="@{jit.max}"/>
                <sysproperty key="jruby.compat.version" value="@{jruby.version}"/>
                <sysproperty key="jruby.objectspace.enabled" value="@{objectspace.enabled}"/>
                <sysproperty key="jruby.thread.pool.enabled" value="@{thread.pooling}"/>
                <sysproperty key="jruby.reflection" value="@{reflection}"/>
                <sysproperty key="jruby.jit.logging.verbose" value="true"/>
                <sysproperty key="jruby.compile.lazyHandles" value="true"/>

                <!-- emma coverage tool properties -->
                <sysproperty key="emma.coverage.out.file" value="${test.results.dir}/coverage.emma"/>
                <sysproperty key="emma.coverage.out.merge" value="true"/>
                <sysproperty key="emma.verbosity.level" value="silent"/>

                <syspropertyset refid="test.sysproperties"/>

                <!-- force client VM to improve test run times AND -->
                <!-- set a larger max permgen, since the tests load a lot of bytecode -->
                <jvmarg line="-ea ${java.opts} -client ${maxpermgen.arg}"/>

                <!-- additional flags -->
                <jvmarg line="@{jvm.flags}"/>

                <formatter type="xml"/>
                <formatter type="brief" usefile="false"/>

                <junit-tests/>
            </junit>

            <junitreport todir="${test.results.dir}">
                <fileset dir="${test.results.dir}" includes="TEST-*.xml"/>
                <report format="frames" todir="${html.test.results.dir}"/>
            </junitreport>
        </sequential>
    </macrodef>

    <!-- runs junit tests for 1.8 functionality -->
    <macrodef name="run-junit-1.8-short">
        <attribute name="compile.mode" default="OFF"/>
        <attribute name="jit.threshold" default="20"/>
        <attribute name="jit.maxsize" default="1000000000"/>
        <attribute name="reflection" default="false"/>
        <attribute name="thread.pooling" default="false"/>
        <attribute name="jvm.flags" default=""/>

        <sequential>
            <run-junit compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"
                       reflection="@{reflection}" thread.pooling="@{thread.pooling}"
                       jit.maxsize="@{jit.maxsize}" jvm.flags="@{jvm.flags}">
                <junit-tests>
                    <test name="${test}" if="test"/>
                    <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}" unless="test"/>
                </junit-tests>
            </run-junit>
        </sequential>
    </macrodef>

    <!-- runs junit tests for 1.8 functionality -->
    <macrodef name="run-junit-1.8">
        <attribute name="compile.mode" default="OFF"/>
        <attribute name="jit.threshold" default="20"/>
        <attribute name="jit.maxsize" default="1000000000"/>
        <attribute name="reflection" default="false"/>
        <attribute name="thread.pooling" default="false"/>
        <attribute name="objectspace.enabled" default="true"/>
        <attribute name="jvm.flags" default=""/>

        <sequential>
            <run-junit compile.mode="@{compile.mode}" jit.threshold="@{jit.threshold}"
                       reflection="@{reflection}" thread.pooling="@{thread.pooling}"
                       jit.maxsize="@{jit.maxsize}" objectspace.enabled="@{objectspace.enabled}"
                       jvm.flags="@{jvm.flags}">
                <junit-tests>
                    <test name="${test}" if="test"/>
                    <test name="org.jruby.test.MainTestSuite" todir="${test.results.dir}" unless="test"/>
                </junit-tests>
            </run-junit>
        </sequential>
    </macrodef>

    <macrodef name="run-junit-embed-all">
        <sequential>
            <taskdef name="junit" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTask"
                     classpath="${build.lib.dir}/junit.jar"/>
            <junit jvm="${jruby.test.jvm}" fork="yes" forkMode="once" haltonfailure="true" dir="${basedir}"
                   maxmemory="${jruby.test.memory}" showoutput="true" timeout="1800000">
                <classpath refid="test.class.path"/>
                <syspropertyset refid="test.sysproperties"/>
                <sysproperty key="jruby.home" value="${basedir}"/>
                <formatter type="xml"/>
                <formatter type="brief" usefile="false"/>
                <batchtest fork="yes" todir="${test.results.dir}">
                    <fileset dir="${test.dir}">
                        <include name="org/jruby/embed/**/*Test*.java"/>
                    </fileset>
                </batchtest>
            </junit>
        </sequential>
    </macrodef>

    <macrodef name="test-security-manager-in">
        <attribute name="compat.mode" default="--1.8"/>
        <sequential>
            <java classname="org.jruby.Main" fork="true" failonerror="true">
                <classpath refid="test.class.path"/>

                <sysproperty key="java.security.manager" value=""/>
                <!-- Note the extra '=' in the value, it *is* intentional -->
                <sysproperty key="java.security.policy" value="=file:test/restricted.policy"/>
                <sysproperty key="java.awt.headless" value="true"/>
                <jvmarg line="${java.opts}"/>
                <arg line="@{compat.mode}"/>
                <arg line="-ve"/>
                <arg value="puts 'Restricted policy looks ok'"/>
            </java>
        </sequential>
    </macrodef>

    <target name="test-security-manager" depends="jar-jruby, -test-security-18, -test-security-19"/>

    <target name="-test-security-18">
        <test-security-manager-in compat.mode="--1.8"/>
    </target>

    <target name="-test-security-19">
        <test-security-manager-in compat.mode="--1.9"/>
    </target>

    <target name="spec-ci-interpreted" depends="init">
        <java classname="org.jruby.Main" fork="true" failonerror="true">
            <classpath refid="test.class.path"/>
            <jvmarg line="${java.opts}"/>
            <jvmarg line="-Djruby.home=${basedir}"/>
            <arg line="-S rake spec:ci_interpreted_19 spec:ci_interpreted_18"/>
        </java>
    </target>

    <target name="test-jar-complete" depends="init,jar-jruby-complete"
            description="Do some sanity checks on the complete jar.">
        <java jar="lib/jruby-complete.jar" fork="true" failonerror="true">
            <arg line="-v test/test_jar_complete.rb"/>
        </java>
    </target>
</project>