Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/databases/cassandra5/files/maven/build.xml
46591 views
1
<!--
2
Licensed to the Apache Software Foundation (ASF) under one or more
3
contributor license agreements. See the NOTICE file distributed with
4
this work for additional information regarding copyright ownership.
5
The ASF licenses this file to You under the Apache License, Version 2.0
6
(the "License"); you may not use this file except in compliance with
7
the License. You may obtain a copy of the License at
8
9
http://www.apache.org/licenses/LICENSE-2.0
10
11
Unless required by applicable law or agreed to in writing, software
12
distributed under the License is distributed on an "AS IS" BASIS,
13
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
See the License for the specific language governing permissions and
15
limitations under the License.
16
-->
17
<project basedir="." default="check" name="apache-cassandra"
18
xmlns:if="ant:if"
19
xmlns:unless="ant:unless">
20
21
<fail message="You need to use Ant of version at least 1.10 to continue.">
22
<condition>
23
<not>
24
<antversion atleast="1.10"/>
25
</not>
26
</condition>
27
</fail>
28
29
<property environment="env"/>
30
<property file="build.properties" />
31
<property file="build.properties.default" />
32
<property file="${user.home}/.ant/build.properties"/>
33
<property name="debuglevel" value="source,lines,vars"/>
34
35
<!-- default version and SCM information -->
36
<property name="base.version" value="5.0.8"/>
37
<property name="scm.connection" value="scm:https://gitbox.apache.org/repos/asf/cassandra.git"/>
38
<property name="scm.developerConnection" value="scm:https://gitbox.apache.org/repos/asf/cassandra.git"/>
39
<property name="scm.url" value="https://gitbox.apache.org/repos/asf?p=cassandra.git"/>
40
41
<!-- JDKs supported.
42
All releases are built with the default JDK.
43
Builds with non-default JDKs are considered experimental and for development and testing purposes.
44
When building, javac's source and target flags are set to the jdk used, so lower JDKs are not supported at runtime.
45
The use of both CASSANDRA_USE_JDK11 and use-jdk11 is deprecated.
46
-->
47
<property name="java.default" value="11" />
48
<property name="java.supported" value="11,17" />
49
50
<!-- directory details -->
51
<property name="basedir" value="."/>
52
<property name="build.helpers.dir" value="${basedir}/.build"/>
53
<property name="build.src" value="${basedir}/src"/>
54
<property name="build.src.java" value="${basedir}/src/java"/>
55
<property name="build.src.antlr" value="${basedir}/src/antlr"/>
56
<property name="build.src.resources" value="${basedir}/src/resources"/>
57
<property name="build.src.gen-java" value="${basedir}/src/gen-java"/>
58
<property name="build.lib" value="${basedir}/lib"/>
59
<property name="build.dir" value="${basedir}/build"/>
60
<property name="build.dir.lib" value="${build.dir}/lib"/>
61
<property name="build.test.dir" value="${build.dir}/test"/>
62
<property name="build.test.output.dir" value="${build.test.dir}/output"/>
63
<property name="build.test.report.dir" value="${build.test.dir}/reports" />
64
<property name="build.classes" value="${build.dir}/classes"/>
65
<property name="build.classes.main" value="${build.classes}/main" />
66
<property name="javadoc.dir" value="${build.dir}/javadoc"/>
67
<property name="interface.dir" value="${basedir}/interface"/>
68
<property name="test.dir" value="${basedir}/test"/>
69
<property name="test.resources" value="${test.dir}/resources"/>
70
<property name="test.lib" value="${build.dir}/test/lib"/>
71
<property name="test.classes" value="${build.dir}/test/classes"/>
72
<property name="test.conf" value="${test.dir}/conf"/>
73
<property name="test.data" value="${test.dir}/data"/>
74
<property name="test.name" value="*Test"/>
75
<property name="test.classlistfile" value="testlist.txt"/>
76
<property name="test.classlistprefix" value="unit"/>
77
<property name="benchmark.name" value=""/>
78
<property name="jmh.args" value=""/>
79
<property name="test.methods" value=""/>
80
<property name="test.anttasks.src" value="${test.dir}/anttasks"/>
81
<property name="test.unit.src" value="${test.dir}/unit"/>
82
<property name="test.long.src" value="${test.dir}/long"/>
83
<property name="test.burn.src" value="${test.dir}/burn"/>
84
<property name="test.memory.src" value="${test.dir}/memory"/>
85
<property name="test.microbench.src" value="${test.dir}/microbench"/>
86
<property name="test.distributed.src" value="${test.dir}/distributed"/>
87
<property name="test.compression.algo" value="LZ4"/>
88
<property name="test.simulator.src" value="${test.dir}/simulator/main"/>
89
<property name="test.simulator-asm.src" value="${test.dir}/simulator/asm"/>
90
<property name="test.simulator-bootstrap.src" value="${test.dir}/simulator/bootstrap"/>
91
<property name="test.simulator-test.src" value="${test.dir}/simulator/test"/>
92
<property name="test.driver.connection_timeout_ms" value="10000"/>
93
<property name="test.driver.read_timeout_ms" value="24000"/>
94
<property name="test.jvm.args" value="" />
95
<property name="testtag.extra" value="" />
96
<property name="dist.dir" value="${build.dir}/dist"/>
97
98
<!-- Use build/tmp for temp files if not otherwise specified. Because Ant properties are immutable, this has no effect if
99
the user specifies the tmp.dir property -->
100
<property name="tmp.dir" value="${build.dir}/tmp"/>
101
102
<property name="doc.dir" value="${basedir}/doc"/>
103
104
<condition property="version" value="${base.version}">
105
<isset property="release"/>
106
</condition>
107
<property name="version" value="${base.version}-SNAPSHOT"/>
108
<property name="version.properties.dir"
109
value="${build.src.resources}/org/apache/cassandra/config/" />
110
<property name="final.name" value="${ant.project.name}-${version}"/>
111
112
<property name="local.repository" value="${user.home}/.m2/repository" />
113
114
<!-- details of how and which Maven repository we publish to -->
115
<property name="maven.version" value="3.0.3" />
116
<condition property="maven-repository-url" value="https://repository.apache.org/service/local/staging/deploy/maven2">
117
<isset property="release"/>
118
</condition>
119
<condition property="maven-repository-id" value="apache.releases.https">
120
<isset property="release"/>
121
</condition>
122
<property name="maven-repository-url" value="https://repository.apache.org/content/repositories/snapshots"/>
123
<property name="maven-repository-id" value="apache.snapshots.https"/>
124
125
<property name="test.timeout" value="480000" />
126
<property name="test.memory.timeout" value="480000" />
127
<property name="test.long.timeout" value="600000" />
128
<property name="test.burn.timeout" value="60000000" />
129
<property name="test.distributed.timeout" value="900000" />
130
<property name="test.simulation.timeout" value="1800000" />
131
132
<!-- default for cql tests. Can be overridden by -Dcassandra.test.use_prepared=false -->
133
<property name="cassandra.test.use_prepared" value="true" />
134
135
<!-- The number of active processors seen by JVM -->
136
<property name="cassandra.test.processorCount" value="2"/>
137
138
<!-- skip flushing schema tables during tests -->
139
<property name="cassandra.test.flush_local_schema_changes" value="false" />
140
141
<!-- fast shutdown of messaging service -->
142
<property name="cassandra.test.messagingService.nonGracefulShutdown" value="true"/>
143
144
<!-- https://www.eclemma.org/jacoco/ -->
145
<property name="jacoco.version" value="0.8.8"/>
146
<property name="jacoco.export.dir" value="${build.dir}/jacoco/" />
147
<property name="jacoco.partials.dir" value="${jacoco.export.dir}/partials" />
148
<property name="jacoco.partialexecfile" value="${jacoco.partials.dir}/partial.exec" />
149
<property name="jacoco.finalexecfile" value="${jacoco.export.dir}/jacoco.exec" />
150
151
<condition property="isMac" value="true">
152
<os family="mac"/>
153
</condition>
154
<condition property="isLinux" value="true">
155
<and>
156
<os family="unix"/>
157
<not>
158
<os family="mac"/>
159
</not>
160
</and>
161
</condition>
162
163
<property name="jflex.version" value="1.8.2"/>
164
<property name="jamm.version" value="0.4.0"/>
165
<property name="ecj.version" value="3.33.0"/>
166
<!-- When updating ASM, please, do consider whether you might need to update also FBUtilities#ASM_BYTECODE_VERSION
167
and the simulator InterceptClasses#BYTECODE_VERSION, in particular if we are looking to provide Cassandra support
168
for newer JDKs (CASSANDRA-17873). -->
169
<property name="asm.version" value="9.4"/>
170
<property name="allocation-instrumenter.version" value="3.1.0"/>
171
172
<condition property="is.source.artifact">
173
<available file="${build.src.java}" type="dir" />
174
</condition>
175
176
<condition property="cassandra.use_nix_recursive_delete" value="false" else="true">
177
<os family="windows" />
178
</condition>
179
180
<condition property="withoutMethods">
181
<and>
182
<equals arg1="${test.methods}" arg2=""/>
183
<not>
184
<contains string="${test.name}" substring="*"/>
185
</not>
186
</and>
187
</condition>
188
<condition property="withMethods">
189
<and>
190
<not>
191
<equals arg1="${test.methods}" arg2=""/>
192
</not>
193
<not>
194
<contains string="${test.name}" substring="*"/>
195
</not>
196
</and>
197
</condition>
198
199
<!-- Check if all tests are being run or just one (check testclasslist target). If it's all tests don't spam the
200
console with test output.
201
If it's an individual test print the output from the test under the assumption someone is debugging the test
202
and wants to know what is going on without having to context switch to the log file that is generated.
203
Debug level output still needs to be retrieved from the log file. -->
204
<macrodef name="set-keepbrief-property">
205
<attribute name="test-name" />
206
<sequential>
207
<condition property="cassandra.keepBriefBrief" value="false" else="true">
208
<not>
209
<equals arg1="@{test-name}" arg2="*Test"/>
210
</not>
211
</condition>
212
</sequential>
213
</macrodef>
214
<set-keepbrief-property test-name="${test.name}" />
215
216
<fail message="Unsupported JDK version used: ${ant.java.version}">
217
<condition><not><contains string="${java.supported}" substring="${ant.java.version}"/></not></condition>
218
</fail>
219
<condition property="is.java.default"><equals arg1="${ant.java.version}" arg2="${java.default}"/></condition>
220
<echo unless:true="${is.java.default}" message="Non default JDK version used: ${ant.java.version}"/>
221
222
<condition property="arch_x86">
223
<equals arg1="${os.arch}" arg2="x86" />
224
</condition>
225
<!-- On non-X86 JDK 8 (such as M1 Mac) the smallest allowed Xss is 384k; so need a larger value
226
when on these platforms. -->
227
<condition property="jvm_xss" value="-Xss256k" else="-Xss384k">
228
<isset property="arch_x86" />
229
</condition>
230
231
<resources id="_jvm11_arg_items">
232
<string>-Djdk.attach.allowAttachSelf=true</string>
233
<string>-XX:+UseConcMarkSweepGC</string>
234
<string>-XX:+CMSParallelRemarkEnabled</string>
235
<string>-XX:SurvivorRatio=8</string>
236
<string>-XX:MaxTenuringThreshold=1</string>
237
<string>-XX:CMSInitiatingOccupancyFraction=75</string>
238
<string>-XX:+UseCMSInitiatingOccupancyOnly</string>
239
<string>-XX:CMSWaitDuration=10000</string>
240
<string>-XX:+CMSParallelInitialMarkEnabled</string>
241
<string>-XX:+CMSEdenChunksRecordAlways</string>
242
243
244
<string>--add-exports java.base/jdk.internal.misc=ALL-UNNAMED</string>
245
<string>--add-exports java.base/jdk.internal.ref=ALL-UNNAMED</string>
246
<string>--add-exports java.base/sun.nio.ch=ALL-UNNAMED</string>
247
<string>--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED</string>
248
<string>--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED</string>
249
<string>--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED</string>
250
<string>--add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED</string>
251
<string>--add-exports java.sql/java.sql=ALL-UNNAMED</string>
252
253
<string>--add-opens java.base/java.lang.module=ALL-UNNAMED</string>
254
<string>--add-opens java.base/java.net=ALL-UNNAMED</string>
255
<string>--add-opens java.base/jdk.internal.loader=ALL-UNNAMED</string>
256
<string>--add-opens java.base/jdk.internal.ref=ALL-UNNAMED</string>
257
<string>--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</string>
258
<string>--add-opens java.base/jdk.internal.math=ALL-UNNAMED</string>
259
<string>--add-opens java.base/jdk.internal.module=ALL-UNNAMED</string>
260
<string>--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED</string>
261
<string>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
262
</resources>
263
<pathconvert property="_jvm11_args_concat" refid="_jvm11_arg_items" pathsep=" "/>
264
<condition property="java-jvmargs" value="${_jvm11_args_concat}">
265
<equals arg1="${ant.java.version}" arg2="11"/>
266
</condition>
267
268
<resources id="_jvm17_arg_items">
269
<string>-Djdk.attach.allowAttachSelf=true</string>
270
<string>-XX:+UseG1GC</string>
271
<string>-XX:+ParallelRefProcEnabled</string>
272
<string>-XX:MaxTenuringThreshold=1</string>
273
<string>-XX:G1HeapRegionSize=16m</string>
274
275
<string>--add-exports java.base/jdk.internal.misc=ALL-UNNAMED</string>
276
<string>--add-exports java.management.rmi/com.sun.jmx.remote.internal.rmi=ALL-UNNAMED</string>
277
<string>--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED</string>
278
<string>--add-exports java.rmi/sun.rmi.server=ALL-UNNAMED</string>
279
<string>--add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED</string>
280
<string>--add-exports java.sql/java.sql=ALL-UNNAMED</string>
281
<string>--add-exports java.base/java.lang.ref=ALL-UNNAMED</string>
282
<string>--add-exports jdk.unsupported/sun.misc=ALL-UNNAMED</string>
283
<string>--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</string>
284
<string>--add-exports jdk.attach/sun.tools.attach=ALL-UNNAMED</string>
285
286
<string>--add-opens java.base/java.lang.module=ALL-UNNAMED</string>
287
<string>--add-opens java.base/jdk.internal.loader=ALL-UNNAMED</string>
288
<string>--add-opens java.base/jdk.internal.ref=ALL-UNNAMED</string>
289
<string>--add-opens java.base/jdk.internal.reflect=ALL-UNNAMED</string>
290
<string>--add-opens java.base/jdk.internal.math=ALL-UNNAMED</string>
291
<string>--add-opens java.base/jdk.internal.module=ALL-UNNAMED</string>
292
<string>--add-opens java.base/jdk.internal.util.jar=ALL-UNNAMED</string>
293
<string>--add-opens jdk.management/com.sun.management.internal=ALL-UNNAMED</string>
294
<string>--add-opens java.base/sun.nio.ch=ALL-UNNAMED</string>
295
<string>--add-opens java.base/java.io=ALL-UNNAMED</string>
296
<string>--add-opens java.base/java.lang.reflect=ALL-UNNAMED</string>
297
<string>--add-opens jdk.compiler/com.sun.tools.javac=ALL-UNNAMED</string>
298
<string>--add-opens java.base/java.lang=ALL-UNNAMED</string>
299
<string>--add-opens java.base/java.util=ALL-UNNAMED</string>
300
<string>--add-opens java.base/java.nio=ALL-UNNAMED</string>
301
302
<string>--add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED</string>
303
</resources>
304
<pathconvert property="_jvm17_args_concat" refid="_jvm17_arg_items" pathsep=" "/>
305
<condition property="java-jvmargs" value="${_jvm17_args_concat}">
306
<equals arg1="${ant.java.version}" arg2="17"/>
307
</condition>
308
309
<!--
310
JVM arguments for tests.
311
312
There is a race condition bug in java 11 (see CASSANDRA-15981) which causes a crash of the
313
JVM; this race is between CMS and class unloading. In java 8 we can cap the metaspace to
314
make tests stable on low resource environments, but in java 11 we need to make it unlimited
315
(don't define MaxMetaspaceSize) and disable class unloading in CMS outside of a
316
stop-the-world pause.
317
318
In java 11 we also need to set a system property to enable netty to use Unsafe direct byte
319
buffer construction (see CASSANDRA-16493)
320
-->
321
<resources id="_jvm11_test_arg_items">
322
<string>-XX:-CMSClassUnloadingEnabled</string>
323
<string>-Dio.netty.tryReflectionSetAccessible=true</string>
324
</resources>
325
<pathconvert property="_jvm11_test_arg_items_concat" refid="_jvm11_test_arg_items" pathsep=" "/>
326
<resources id="_jvm17_test_arg_items">
327
<string>-Dio.netty.tryReflectionSetAccessible=true</string>
328
</resources>
329
<pathconvert property="_jvm17_test_arg_items_concat" refid="_jvm17_test_arg_items" pathsep=" "/>
330
<condition property="_std-test-jvmargs" value="${_jvm11_test_arg_items_concat}">
331
<equals arg1="${ant.java.version}" arg2="11"/>
332
</condition>
333
<condition property="_std-test-jvmargs" value="${_jvm17_test_arg_items_concat}">
334
<equals arg1="${ant.java.version}" arg2="17"/>
335
</condition>
336
337
<!-- needed to compile org.apache.cassandra.utils.JMXServerUtils -->
338
<!-- needed to compile org.apache.cassandra.distributed.impl.Instance-->
339
<!-- needed to compile org.apache.cassandra.utils.memory.BufferPool -->
340
<property name="jdk11plus-javac-exports" value="--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED --add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports java.base/jdk.internal.ref=ALL-UNNAMED --add-exports java.base/sun.nio.ch=ALL-UNNAMED" />
341
342
<!--
343
Add all the dependencies.
344
-->
345
<path id="cassandra.classpath">
346
<pathelement location="${build.classes.main}" />
347
<fileset dir="${build.dir.lib}">
348
<include name="**/*.jar" />
349
</fileset>
350
</path>
351
<path id="cassandra.classpath.test">
352
<file file="${build.dir}/${final.name}.jar"/> <!-- we need the jar for tests and benchmarks (multi-version jar) -->
353
<fileset dir="${build.dir.lib}">
354
<include name="**/*.jar" />
355
</fileset>
356
<fileset dir="${test.lib}/jars">
357
<include name="**/*.jar" />
358
<exclude name="**/ant-*.jar"/>
359
</fileset>
360
</path>
361
362
<macrodef name="create-javadoc">
363
<attribute name="destdir"/>
364
<element name="filesets"/>
365
<sequential>
366
<javadoc destdir="@{destdir}" author="true" version="true" use="true"
367
windowtitle="${ant.project.name} API" classpathref="cassandra.classpath"
368
bottom="Copyright &amp;copy; 2009- The Apache Software Foundation"
369
useexternalfile="yes" encoding="UTF-8" failonerror="false"
370
maxmemory="1024m" additionalparam="${jdk11plus-javac-exports}">
371
<filesets/>
372
</javadoc>
373
<fail message="javadoc failed">
374
<condition>
375
<not>
376
<available file="@{destdir}/index-all.html" />
377
</not>
378
</condition>
379
</fail>
380
</sequential>
381
</macrodef>
382
383
<!--
384
Setup the output directories.
385
-->
386
<target name="init" >
387
<fail unless="is.source.artifact"
388
message="Not a source artifact, stopping here." />
389
<mkdir dir="${build.classes.main}"/>
390
<mkdir dir="${test.lib}"/>
391
<mkdir dir="${test.classes}"/>
392
<mkdir dir="${stress.test.classes}"/>
393
<mkdir dir="${fqltool.test.classes}"/>
394
<mkdir dir="${build.src.gen-java}"/>
395
<mkdir dir="${build.dir.lib}"/>
396
<mkdir dir="${jacoco.export.dir}"/>
397
<mkdir dir="${jacoco.partials.dir}"/>
398
399
<!-- Set up jdk specific properties -->
400
<javac includes="**/JdkProperties.java,**/SetSystemProperty.java" srcdir="test/anttasks" destdir="${test.classes}" includeantruntime="true" source="${java.default}" target="${java.default}">
401
<compilerarg value="-Xlint:-options"/>
402
</javac>
403
<taskdef name="JdkProperties" classname="org.apache.cassandra.anttasks.JdkProperties" classpath="${test.classes}"/>
404
<taskdef name="SetSystemProperty" classname="org.apache.cassandra.anttasks.SetSystemProperty" classpath="${test.classes}"/>
405
406
<JdkProperties/>
407
408
<!-- https://issues.apache.org/jira/browse/CASSANDRA-16391?focusedCommentId=17310803&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17310803 -->
409
<SetSystemProperty name="jmc5.path" value="/tmp"/>
410
<SetSystemProperty name="jmc6.path" value="/tmp"/>
411
<SetSystemProperty name="visualvm.path" value="/tmp"/>
412
</target>
413
414
<target name="clean" description="Remove all locally created artifacts">
415
<delete dir="${build.test.dir}" />
416
<delete dir="${build.dir}/tmp" />
417
<delete dir="${build.classes}" />
418
<delete dir="${build.src.gen-java}" />
419
<delete dir="${version.properties.dir}" />
420
<delete dir="${jacoco.export.dir}" />
421
<delete dir="${jacoco.partials.dir}"/>
422
</target>
423
<target depends="clean" name="cleanall"/>
424
425
<target name="realclean" depends="clean" description="Remove the entire build directory and all downloaded artifacts">
426
<delete>
427
<fileset dir="${build.lib}" excludes="cassandra-driver-internal-only-*,puresasl-internal-only-*"/>
428
</delete>
429
<delete dir="${build.dir}" />
430
<delete dir="${doc.dir}/build" />
431
<delete dir="${doc.dir}/source/tools/nodetool" />
432
</target>
433
434
<!--
435
This generates the CQL grammar files from Cql.g
436
-->
437
<target name="check-gen-cql3-grammar">
438
<uptodate property="cql3current"
439
targetfile="${build.src.gen-java}/org/apache/cassandra/cql3/Cql.tokens">
440
<srcfiles dir="${build.src.antlr}">
441
<include name="*.g"/>
442
</srcfiles>
443
</uptodate>
444
</target>
445
446
<target name="gen-cql3-grammar" depends="check-gen-cql3-grammar" unless="cql3current">
447
<echo>Building Grammar ${build.src.antlr}/Cql.g ...</echo>
448
<java classname="org.antlr.Tool"
449
classpathref="cql3-grammar.classpath"
450
failonerror="true">
451
<arg value="-Xconversiontimeout" />
452
<arg value="10000" />
453
<arg value="${build.src.antlr}/Cql.g" />
454
<arg value="-fo" />
455
<arg value="${build.src.gen-java}/org/apache/cassandra/cql3/" />
456
<arg value="-Xmaxinlinedfastates"/>
457
<arg value="10"/> <!-- default is 60 -->
458
</java>
459
</target>
460
461
<target name="generate-cql-html" depends="resolver-init" description="Generate HTML from textile source">
462
<taskdef classpathref="wikitext.classpath" resource="wikitexttasks.properties" />
463
<wikitext-to-html markupLanguage="Textile">
464
<fileset dir="${basedir}">
465
<include name="doc/cql3/*.textile"/>
466
</fileset>
467
</wikitext-to-html>
468
</target>
469
470
<target name="gen-asciidoc" description="Generate dynamic asciidoc pages" depends="jar" unless="ant.gen-doc.skip">
471
<exec executable="make" osfamily="unix" dir="${doc.dir}" failonerror="true">
472
<arg value="gen-asciidoc"/>
473
</exec>
474
</target>
475
476
<target name="gen-doc" description="Generate documentation" depends="gen-asciidoc,generate-cql-html" unless="ant.gen-doc.skip">
477
<exec executable="make" osfamily="unix" dir="${doc.dir}" failonerror="true">
478
<arg value="html"/>
479
</exec>
480
</target>
481
482
<!--
483
Generates Java sources for tokenization support from jflex
484
grammar files
485
-->
486
<target name="generate-jflex-java" description="Generate Java from jflex grammar">
487
<taskdef classname="jflex.anttask.JFlexTask" classpathref="jflex.classpath" name="jflex" />
488
<jflex file="${build.src.java}/org/apache/cassandra/index/sasi/analyzer/StandardTokenizerImpl.jflex" destdir="${build.src.gen-java}/" />
489
</target>
490
491
<!-- create properties file with C version -->
492
<target name="_createVersionPropFile" depends="_get-git-sha,set-cqlsh-version">
493
<taskdef name="propertyfile" classname="org.apache.tools.ant.taskdefs.optional.PropertyFile"/>
494
<mkdir dir="${version.properties.dir}"/>
495
<propertyfile file="${version.properties.dir}/version.properties">
496
<entry key="CassandraVersion" value="${version}"/>
497
<entry key="GitSHA" value="${git.sha}"/>
498
</propertyfile>
499
</target>
500
501
<target name="test-run" depends="jar"
502
description="Run in test mode. Not for production use!">
503
<java classname="org.apache.cassandra.service.CassandraDaemon" fork="true">
504
<classpath>
505
<path refid="cassandra.classpath.test"/>
506
<pathelement location="${test.conf}"/>
507
</classpath>
508
<jvmarg value="-Dstorage-config=${test.conf}"/>
509
<jvmarg value="-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true" /> <!-- enable defensive checks -->
510
<jvmarg value="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar" />
511
<jvmarg value="-ea"/>
512
<jvmarg line="${java-jvmargs}"/>
513
</java>
514
</target>
515
516
<!--
517
The build target builds all the .class files
518
-->
519
<target name="build" depends="resolver-retrieve-build,build-project" description="Compile Cassandra classes"/>
520
<target name="codecoverage" depends="jacoco-run,jacoco-report" description="Create code coverage report"/>
521
522
<target name="_build_java">
523
<!-- Note: we cannot use javac's 'release' option, as that does not allow accessing sun.misc.Unsafe nor
524
Nashorn's ClassFilter class as any javac modules option is invalid for release 8. -->
525
<echo message="Compiling for Java ${ant.java.version}..."/>
526
<javac
527
debug="true" debuglevel="${debuglevel}" encoding="utf-8"
528
destdir="${build.classes.main}" includeantruntime="false" source="${ant.java.version}" target="${ant.java.version}">
529
<src path="${build.src.java}"/>
530
<src path="${build.src.gen-java}"/>
531
<compilerarg value="-XDignore.symbol.file"/>
532
<compilerarg line="${jdk11plus-javac-exports}"/>
533
<classpath>
534
<path refid="cassandra.classpath"/>
535
</classpath>
536
</javac>
537
</target>
538
539
<target depends="init,gen-cql3-grammar,generate-cql-html,generate-jflex-java"
540
name="build-project">
541
<echo message="${ant.project.name}: ${ant.file}"/>
542
<!-- Order matters! -->
543
<antcall target="_build_java"/>
544
<antcall target="_createVersionPropFile"/>
545
<copy todir="${build.classes.main}">
546
<fileset dir="${build.src.resources}" />
547
</copy>
548
<copy todir="${basedir}/conf" file="${build.classes.main}/META-INF/hotspot_compiler"/>
549
</target>
550
551
<target name="check" depends="_main-jar,build-test,gen-doc" description="Verifies the source code and dependencies. This task is intended to run on pre-commit and locally. It should verify mostly modified files compared to the upstream base branch." unless="check.skip">
552
<antcall target="rat-check" inheritrefs="true"/>
553
<antcall target="checkstyle" inheritrefs="true"/>
554
<antcall target="checkstyle-test" inheritrefs="true"/>
555
</target>
556
557
<!-- Stress build file -->
558
<property name="stress.build.src" value="${basedir}/tools/stress/src" />
559
<property name="stress.build.resources" value="${basedir}/tools/stress/resources" />
560
<property name="stress.test.src" value="${basedir}/tools/stress/test/unit" />
561
<property name="stress.build.classes" value="${build.classes}/stress" />
562
<property name="stress.test.classes" value="${build.dir}/test/stress-classes" />
563
<property name="stress.manifest" value="${stress.build.classes}/MANIFEST.MF" />
564
565
<target name="stress-build-test" depends="stress-build" description="Compile stress tests">
566
<javac debug="true" debuglevel="${debuglevel}" destdir="${stress.test.classes}"
567
source="${ant.java.version}" target="${ant.java.version}"
568
includeantruntime="false" encoding="utf-8">
569
<classpath>
570
<path refid="cassandra.classpath.test"/>
571
<pathelement location="${stress.build.classes}" />
572
</classpath>
573
<src path="${stress.test.src}"/>
574
</javac>
575
</target>
576
577
<target name="stress-build" depends="build" description="build stress tool">
578
<antcall target="_stress_build"/>
579
</target>
580
581
<target name="_stress_build">
582
<mkdir dir="${stress.build.classes}" />
583
<javac compiler="modern" debug="true" debuglevel="${debuglevel}"
584
source="${ant.java.version}" target="${ant.java.version}"
585
encoding="utf-8" destdir="${stress.build.classes}" includeantruntime="true">
586
<src path="${stress.build.src}"/>
587
<classpath>
588
<path refid="cassandra.classpath" />
589
</classpath>
590
</javac>
591
<copy todir="${stress.build.classes}">
592
<fileset dir="${stress.build.resources}" />
593
</copy>
594
</target>
595
596
<target name="stress-test" depends="maybe-build-test" description="Runs stress tests">
597
<testmacro inputdir="${stress.test.src}"
598
timeout="${test.timeout}">
599
</testmacro>
600
</target>
601
602
<!-- Use this with an FQDN for test class, and an optional csv list of methods like this:
603
ant stress-test-some -Dtest.name=org.apache.cassandra.stress.generate.DistributionGaussianTest
604
ant stress-test-some -Dtest.name=org.apache.cassandra.stress.generate.DistributionGaussianTest -Dtest.methods=simpleGaussian
605
-->
606
<target name="stress-test-some" depends="maybe-build-test" description="Runs stress tests">
607
<testmacro inputdir="${stress.test.src}" timeout="${test.timeout}">
608
<test unless:blank="${test.methods}" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
609
<test if:blank="${test.methods}" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
610
</testmacro>
611
</target>
612
613
<!--
614
fqltool build file
615
-->
616
<property name="fqltool.build.src" value="${basedir}/tools/fqltool/src" />
617
<property name="fqltool.test.src" value="${basedir}/tools/fqltool/test/unit" />
618
<property name="fqltool.build.classes" value="${build.classes}/fqltool" />
619
<property name="fqltool.test.classes" value="${build.dir}/test/fqltool-classes" />
620
<property name="fqltool.manifest" value="${fqltool.build.classes}/MANIFEST.MF" />
621
622
<target name="fqltool-build-test" depends="fqltool-build" description="Compile fqltool tests">
623
<javac debug="true" debuglevel="${debuglevel}" destdir="${fqltool.test.classes}"
624
source="${ant.java.version}" target="${ant.java.version}"
625
includeantruntime="false" encoding="utf-8">
626
<classpath>
627
<path refid="cassandra.classpath.test"/>
628
<pathelement location="${fqltool.build.classes}" />
629
</classpath>
630
<src path="${fqltool.test.src}"/>
631
</javac>
632
</target>
633
634
<target name="fqltool-build" depends="build" description="build fqltool">
635
<antcall target="_fqltool_build"/>
636
</target>
637
638
<target name="_fqltool_build">
639
<mkdir dir="${fqltool.build.classes}" />
640
<javac compiler="modern" debug="true" debuglevel="${debuglevel}"
641
source="${ant.java.version}" target="${ant.java.version}"
642
encoding="utf-8" destdir="${fqltool.build.classes}" includeantruntime="true">
643
<src path="${fqltool.build.src}" />
644
<classpath>
645
<path refid="cassandra.classpath" />
646
</classpath>
647
</javac>
648
</target>
649
650
<target name="fqltool-test" depends="fqltool-build-test, maybe-build-test" description="Runs fqltool tests">
651
<testmacro inputdir="${fqltool.test.src}"
652
timeout="${test.timeout}">
653
</testmacro>
654
</target>
655
656
<!--
657
simulator asm build file
658
-->
659
<property name="simulator-asm.build.src" value="${test.simulator-asm.src}" />
660
<property name="simulator-asm.build.classes" value="${build.classes}/simulator-asm" />
661
<property name="simulator-asm.manifest" value="${simulator-asm.build.classes}/MANIFEST.MF" />
662
663
<property name="simulator-bootstrap.build.src" value="${test.simulator-bootstrap.src}" />
664
<property name="simulator-bootstrap.build.classes" value="${build.classes}/simulator-bootstrap" />
665
<property name="simulator-bootstrap.manifest" value="${simulator-bootstrap.build.classes}/MANIFEST.MF" />
666
667
<target name="simulator-asm-build" depends="build" description="build simulator-asm">
668
<antcall target="_simulator-asm_build"/>
669
</target>
670
671
<target name="simulator-bootstrap-build" depends="build" description="build simulator-bootstrap">
672
<antcall target="_simulator-bootstrap_build"/>
673
</target>
674
675
<target name="_simulator-asm_build">
676
<mkdir dir="${simulator-asm.build.classes}" />
677
<javac compiler="modern" debug="true" debuglevel="${debuglevel}"
678
source="${ant.java.version}" target="${ant.java.version}"
679
encoding="utf-8" destdir="${simulator-asm.build.classes}" includeantruntime="true">
680
<src path="${simulator-asm.build.src}" />
681
<classpath>
682
<fileset dir="${test.lib}">
683
<include name="**/asm-*${asm.version}.jar" />
684
</fileset>
685
<fileset dir="${build.lib}">
686
<include name="**/asm-*${asm.version}.jar" />
687
</fileset>
688
</classpath>
689
</javac>
690
</target>
691
692
<target name="_simulator-bootstrap_build">
693
<mkdir dir="${simulator-bootstrap.build.classes}" />
694
<javac compiler="modern" debug="true" debuglevel="${debuglevel}"
695
source="${ant.java.version}" target="${ant.java.version}"
696
encoding="utf-8" destdir="${simulator-bootstrap.build.classes}" includeantruntime="true">
697
<src path="${simulator-bootstrap.build.src}" />
698
<classpath>
699
<fileset dir="${test.lib}">
700
<include name="**/asm-*${asm.version}.jar" />
701
</fileset>
702
<fileset dir="${build.lib}">
703
<include name="**/asm-*${asm.version}.jar" />
704
</fileset>
705
</classpath>
706
<compilerarg value="-XDignore.symbol.file"/>
707
</javac>
708
</target>
709
710
<target name="write-poms" unless="without.maven">
711
<filterset id="pom-template">
712
<filter token="version" value="${version}"/>
713
<filter token="final.name" value="${final.name}"/>
714
<filter token="jamm.version" value="${jamm.version}"/>
715
<filter token="allocation-instrumenter.version" value="${allocation-instrumenter.version}"/>
716
<filter token="ecj.version" value="${ecj.version}"/>
717
<filter token="asm.version" value="${asm.version}"/>
718
<filter token="jacoco.version" value="${jacoco.version}"/>
719
<filter token="jflex.version" value="${jflex.version}"/>
720
</filterset>
721
722
<copy file=".build/cassandra-deps-template.xml" tofile="${build.dir}/${final.name}.pom">
723
<filterset refid="pom-template"/>
724
</copy>
725
<copy file=".build/parent-pom-template.xml" tofile="${build.dir}/${final.name}-parent.pom">
726
<filterset refid="pom-template"/>
727
</copy>
728
<copy file=".build/cassandra-build-deps-template.xml" tofile="${build.dir}/tmp-${final.name}-deps.pom">
729
<filterset refid="pom-template"/>
730
</copy>
731
</target>
732
733
<!--
734
The jar target makes cassandra.jar output.
735
-->
736
<target name="_main-jar"
737
depends="build"
738
description="Assemble Cassandra JAR files">
739
<mkdir dir="${build.classes.main}/META-INF" />
740
<copy file="LICENSE.txt"
741
tofile="${build.classes.main}/META-INF/LICENSE.txt"/>
742
<copy file="NOTICE.txt"
743
tofile="${build.classes.main}/META-INF/NOTICE.txt"/>
744
745
<!-- Main Jar -->
746
<jar jarfile="${build.dir}/${final.name}.jar">
747
<fileset dir="${build.classes.main}">
748
</fileset>
749
<manifest>
750
<!-- <section name="org/apache/cassandra/infrastructure"> -->
751
<attribute name="Multi-Release" value="true"/>
752
<attribute name="Implementation-Title" value="Cassandra"/>
753
<attribute name="Implementation-Version" value="${version}"/>
754
<attribute name="Implementation-Vendor" value="Apache"/>
755
<attribute name="Implementation-Git-SHA" value="${git.sha}"/>
756
<!-- </section> -->
757
</manifest>
758
</jar>
759
</target>
760
761
<target name="stress-jar"
762
depends="stress-build"
763
description="Assemble Cassandra JAR files">
764
<!-- Stress jar -->
765
<manifest file="${stress.manifest}">
766
<attribute name="Built-By" value="Pavel Yaskevich"/>
767
<attribute name="Main-Class" value="org.apache.cassandra.stress.Stress"/>
768
</manifest>
769
<mkdir dir="${stress.build.classes}/META-INF" />
770
<mkdir dir="${build.dir}/tools/lib/" />
771
<jar destfile="${build.dir}/tools/lib/stress.jar" manifest="${stress.manifest}">
772
<fileset dir="${stress.build.classes}"/>
773
</jar>
774
</target>
775
776
<target name="fqltool-jar"
777
depends="fqltool-build"
778
description="Assemble Cassandra JAR files">
779
780
<!-- fqltool jar -->
781
<manifest file="${fqltool.manifest}">
782
<attribute name="Built-By" value="Marcus Eriksson"/>
783
<attribute name="Main-Class" value="org.apache.cassandra.fqltool.FullQueryLogTool"/>
784
</manifest>
785
<mkdir dir="${fqltool.build.classes}/META-INF" />
786
<mkdir dir="${build.dir}/tools/lib/" />
787
<jar destfile="${build.dir}/tools/lib/fqltool.jar" manifest="${fqltool.manifest}">
788
<fileset dir="${fqltool.build.classes}"/>
789
</jar>
790
</target>
791
792
<target name="simulator-jars"
793
depends="simulator-asm-build,simulator-bootstrap-build"
794
description="Assemble Cassandra JAR files">
795
796
<!-- simulator asm jar -->
797
<manifest file="${simulator-asm.manifest}">
798
<attribute name="Built-By" value="Benedict Elliott Smith"/>
799
<attribute name="Premain-Class" value="org.apache.cassandra.simulator.asm.InterceptAgent"/>
800
<attribute name="Agent-Class" value="org.apache.cassandra.simulator.asm.InterceptAgent"/>
801
<attribute name="Can-Redefine-Classes" value="true"/>
802
<attribute name="Can-Retransform-Classes" value="true"/>
803
</manifest>
804
<mkdir dir="${simulator-asm.build.classes}/META-INF" />
805
<mkdir dir="${test.lib}/jars/" />
806
<jar destfile="${test.lib}/jars/simulator-asm.jar" manifest="${simulator-asm.manifest}">
807
<fileset dir="${simulator-asm.build.classes}"/>
808
<fileset dir="${test.lib}/jars">
809
<include name="**/asm-*${asm.version}.jar" />
810
</fileset>
811
</jar>
812
813
<!-- simulator bootstrap jar -->
814
<manifest file="${simulator-bootstrap.manifest}">
815
<attribute name="Built-By" value="Benedict Elliott Smith"/>
816
</manifest>
817
<mkdir dir="${simulator-bootstrap.build.classes}/META-INF" />
818
<mkdir dir="${test.lib}/jars/" />
819
<jar destfile="${test.lib}/jars/simulator-bootstrap.jar" manifest="${simulator-bootstrap.manifest}">
820
<fileset dir="${simulator-bootstrap.build.classes}"/>
821
<fileset dir="${test.lib}/jars">
822
<include name="**/asm-*${asm.version}.jar" />
823
</fileset>
824
</jar>
825
</target>
826
827
<target name="jar"
828
depends="_main-jar,build-test,stress-jar,fqltool-jar,simulator-jars,write-poms"
829
description="Assemble Cassandra JAR files">
830
</target>
831
832
<!--
833
The javadoc-jar target makes cassandra-javadoc.jar output required for publishing to Maven central repository.
834
-->
835
<target name="javadoc-jar" depends="javadoc" unless="no-javadoc" description="Assemble Cassandra JavaDoc JAR file">
836
<jar jarfile="${build.dir}/${final.name}-javadoc.jar" basedir="${javadoc.dir}"/>
837
<!-- javadoc task always rebuilds so might as well remove the generated docs to prevent
838
being pulled into the distribution by accident -->
839
<delete quiet="true" dir="${javadoc.dir}"/>
840
</target>
841
842
<!--
843
The sources-jar target makes cassandra-sources.jar output required for publishing to Maven central repository.
844
-->
845
<target name="sources-jar" depends="init" description="Assemble Cassandra Sources JAR file">
846
<jar jarfile="${build.dir}/${final.name}-sources.jar">
847
<fileset dir="${build.src.java}" defaultexcludes="yes">
848
<include name="org/apache/**/*.java"/>
849
</fileset>
850
<fileset dir="${build.src.gen-java}" defaultexcludes="yes">
851
<include name="org/apache/**/*.java"/>
852
</fileset>
853
</jar>
854
</target>
855
856
<target name="_artifacts-init" depends="jar">
857
<mkdir dir="${dist.dir}"/>
858
<!-- fix the control linefeed so that builds on windows works on linux -->
859
<fixcrlf srcdir="bin" includes="**/*" eol="lf" eof="remove" />
860
<fixcrlf srcdir="conf" includes="**/*" eol="lf" eof="remove" />
861
<fixcrlf srcdir="tools/bin" includes="**/*" eol="lf" eof="remove" />
862
<copy todir="${dist.dir}/lib">
863
<fileset dir="${build.lib}"/>
864
<fileset dir="${build.dir}">
865
<include name="${final.name}.jar" />
866
</fileset>
867
</copy>
868
<copy todir="${dist.dir}/doc" failonerror="false">
869
<fileset dir="doc">
870
<include name="cql3/CQL.html" />
871
<include name="cql3/CQL.css" />
872
<include name="SASI.md" />
873
</fileset>
874
</copy>
875
<copy todir="${dist.dir}/doc/html" failonerror="false">
876
<fileset dir="doc" />
877
<globmapper from="build/html/*" to="*"/>
878
</copy>
879
<copy todir="${dist.dir}/bin">
880
<fileset dir="bin"/>
881
</copy>
882
<copy todir="${dist.dir}/conf">
883
<fileset dir="conf"/>
884
</copy>
885
<copy todir="${dist.dir}/pylib">
886
<fileset dir="pylib">
887
<include name="**" />
888
<exclude name="**/*.pyc" />
889
</fileset>
890
</copy>
891
<copy todir="${dist.dir}/">
892
<fileset dir="${basedir}">
893
<include name="*.txt" />
894
<include name=".snyk" />
895
</fileset>
896
</copy>
897
<copy todir="${dist.dir}/tools/bin">
898
<fileset dir="${basedir}/tools/bin"/>
899
</copy>
900
<copy todir="${dist.dir}/tools/">
901
<fileset dir="${basedir}/tools/">
902
<include name="*.yaml"/>
903
</fileset>
904
</copy>
905
<copy todir="${dist.dir}/tools/lib">
906
<fileset dir="${build.dir}/tools/lib/">
907
<include name="*.jar" />
908
</fileset>
909
</copy>
910
</target>
911
912
<!-- creates release tarballs -->
913
<target name="artifacts" depends="_artifacts-init,check,sources-jar"
914
description="Create Cassandra tarball and maven artifacts">
915
<tar compression="gzip" longfile="gnu"
916
destfile="${build.dir}/${final.name}-bin.tar.gz">
917
918
<!-- Everything but bin/ (default mode) -->
919
<tarfileset dir="${dist.dir}" prefix="${final.name}">
920
<include name="**"/>
921
<exclude name="bin/*" />
922
<exclude name="tools/bin/*"/>
923
</tarfileset>
924
<!-- Shell includes in bin/ (default mode) -->
925
<tarfileset dir="${dist.dir}" prefix="${final.name}">
926
<include name="bin/*.in.sh" />
927
<include name="tools/bin/*.in.sh" />
928
</tarfileset>
929
<!-- Executable scripts in bin/ -->
930
<tarfileset dir="${dist.dir}" prefix="${final.name}" mode="755">
931
<include name="bin/*"/>
932
<include name="tools/bin/*"/>
933
<exclude name="bin/*.in.sh" />
934
<exclude name="tools/bin/*.in.sh" />
935
</tarfileset>
936
</tar>
937
938
<tar compression="gzip" longfile="gnu"
939
destfile="${build.dir}/${final.name}-src.tar.gz">
940
941
<tarfileset dir="${basedir}"
942
prefix="${final.name}-src">
943
<include name="**"/>
944
<exclude name="build/**" />
945
<exclude name="lib/**" />
946
<exclude name="src/gen-java/**" />
947
<exclude name=".git/**" />
948
<exclude name="venv/**" />
949
<exclude name="src/resources/org/apache/cassandra/config/version.properties" />
950
<exclude name="conf/hotspot_compiler" />
951
<exclude name="doc/cql3/CQL.html" />
952
<exclude name="doc/build/**" />
953
<exclude name="bin/*" /> <!-- handled separately below -->
954
<exclude name="tools/bin/*" /> <!-- handled separately below -->
955
<!-- exclude python generated files -->
956
<exclude name="**/__pycache__/**" />
957
<!-- exclude Eclipse files -->
958
<exclude name=".project" />
959
<exclude name=".classpath" />
960
<exclude name=".settings/**" />
961
<exclude name=".externalToolBuilders/**" />
962
<!-- exclude NetBeans files -->
963
<exclude name="ide/nbproject/private/**" />
964
</tarfileset>
965
966
<!-- python driver -->
967
<tarfileset dir="${basedir}" prefix="${final.name}-src">
968
<include name="lib/cassandra-driver-internal-only-**" />
969
</tarfileset>
970
971
<!-- Shell includes in bin/ and tools/bin/ -->
972
<tarfileset dir="${basedir}" prefix="${final.name}-src">
973
<include name="bin/*.in.sh" />
974
<include name="tools/bin/*.in.sh" />
975
</tarfileset>
976
<!-- Everything else (assumed to be scripts), is executable -->
977
<tarfileset dir="${basedir}" prefix="${final.name}-src" mode="755">
978
<include name="bin/*"/>
979
<exclude name="bin/*.in.sh" />
980
<include name="tools/bin/*"/>
981
<exclude name="tools/bin/*.in.sh" />
982
<include name=".build/**/*.sh"/>
983
<include name="doc/scripts/process-native-protocol-specs-in-docker.sh"/>
984
</tarfileset>
985
</tar>
986
987
<checksum forceOverwrite="yes" todir="${build.dir}" fileext=".sha256" algorithm="SHA-256">
988
<fileset dir="${build.dir}">
989
<include name="${final.name}-bin.tar.gz" />
990
<include name="${final.name}-src.tar.gz" />
991
</fileset>
992
</checksum>
993
<checksum forceOverwrite="yes" todir="${build.dir}" fileext=".sha512" algorithm="SHA-512">
994
<fileset dir="${build.dir}">
995
<include name="${final.name}-bin.tar.gz" />
996
<include name="${final.name}-src.tar.gz" />
997
</fileset>
998
</checksum>
999
</target>
1000
1001
<!-- Wrapper of build-test without dependencies, so both that target and its dependencies are skipped if the property
1002
no-build-test is true. This is meant to be used to run tests without actually building them, provided that they have
1003
been built before. All test targets depend on this, so one can run them using the no-build-test property.
1004
For example:
1005
1006
ant test -Dno-build-test=true
1007
ant test -Dtest.name=StorageServiceServerTest -Dno-build-test=true
1008
ant testsome -Dtest.name=org.apache.cassandra.service.StorageServiceServerTest -Dno-build-test=true
1009
1010
The property is false by default, so if it's not specified the tests would be built with all their dependencies.
1011
See CASSANDRA-16625 and CASSANDRA-18000 for further details.
1012
-->
1013
<target name="maybe-build-test" unless="no-build-test">
1014
<antcall target="build-test" inheritRefs="true"/>
1015
</target>
1016
1017
<target name="build-test" depends="_main-jar,stress-build-test,fqltool-build,resolver-dist-lib,simulator-jars"
1018
description="Compile test classes">
1019
<antcall target="_build-test"/>
1020
<antcall target="_check-test-names"/>
1021
</target>
1022
1023
<target name="_build-test">
1024
<javac
1025
compiler="modern"
1026
debug="true"
1027
debuglevel="${debuglevel}"
1028
destdir="${test.classes}"
1029
includeantruntime="true"
1030
source="${ant.java.version}"
1031
target="${ant.java.version}"
1032
encoding="utf-8">
1033
<classpath>
1034
<path refid="cassandra.classpath.test"/>
1035
<pathelement location="${fqltool.build.classes}"/>
1036
</classpath>
1037
<compilerarg value="-XDignore.symbol.file"/>
1038
<!-- needed to compile org.apache.cassandra.utils.memory.BufferPoolTest -->
1039
<compilerarg line="${jdk11plus-javac-exports}"/>
1040
<src path="${test.anttasks.src}"/>
1041
<src path="${test.unit.src}"/>
1042
<src path="${test.long.src}"/>
1043
<src path="${test.burn.src}"/>
1044
<src path="${test.memory.src}"/>
1045
<src path="${test.microbench.src}"/>
1046
<src path="${test.distributed.src}"/>
1047
<src path="${test.simulator.src}"/>
1048
<src path="${test.simulator-asm.src}"/>
1049
<src path="${test.simulator-bootstrap.src}"/>
1050
<src path="${test.simulator-test.src}"/>
1051
<compilerarg line="${jdk11plus-javac-exports}"/>
1052
</javac>
1053
1054
<!-- Non-java resources needed by the test suite -->
1055
<copy todir="${test.classes}">
1056
<fileset dir="${test.resources}"/>
1057
</copy>
1058
</target>
1059
1060
<macrodef name="check-test-names">
1061
<attribute name="annotationName"/>
1062
<attribute name="regex"/>
1063
<attribute name="scanClassPath" default="${test.classes}:${fqltool.test.classes}:${stress.test.classes}"/>
1064
<attribute name="packageName" default="org.apache.cassandra"/>
1065
<attribute name="expand" default="true"/>
1066
<attribute name="normalize" default="true"/>
1067
<attribute name="verbose" default="false"/>
1068
1069
<sequential>
1070
<java taskname="check-test-names" fork="true" failonerror="yes" classname="org.apache.cassandra.anttasks.TestNameCheckTask">
1071
<classpath>
1072
<path refid="cassandra.classpath.test"/>
1073
<pathelement location="${fqltool.build.classes}"/>
1074
<pathelement location="${stress.build.classes}"/>
1075
<pathelement location="${test.classes}"/>
1076
<pathelement location="${fqltool.test.classes}"/>
1077
<pathelement location="${stress.test.classes}"/>
1078
</classpath>
1079
<jvmarg line="${java-jvmargs}"/>
1080
<jvmarg value="-DscanClassPath=@{scanClassPath}"/>
1081
<jvmarg value="-DpackageName=@{packageName}"/>
1082
<jvmarg value="-DannotationName=@{annotationName}"/>
1083
<jvmarg value="-Dexpand=@{expand}"/>
1084
<jvmarg value="-Dnormalize=@{normalize}"/>
1085
<jvmarg value="-Dverbose=@{verbose}"/>
1086
<jvmarg value="-Dregex=@{regex}"/>
1087
</java>
1088
</sequential>
1089
</macrodef>
1090
1091
<target name="_check-test-names">
1092
<check-test-names annotationName="org.junit.Test" regex=".*Test$"/>
1093
<check-test-names annotationName="org.openjdk.jmh.annotations.Benchmark" regex=".*(Bench|_jmhType.*)$"/>
1094
</target>
1095
1096
<!-- Run tests separately and report errors after and generate a junit report -->
1097
<macrodef name="testhelper">
1098
<attribute name="testdelegate"/>
1099
<sequential>
1100
<taskdef name="testhelper_" classname="org.apache.cassandra.anttasks.TestHelper" classpath="${test.classes}"/>
1101
<testhelper_ property="@{testdelegate}"/>
1102
<fail message="Some test(s) failed.">
1103
<condition>
1104
<and>
1105
<isset property="testfailed"/>
1106
<not>
1107
<isset property="ant.test.failure.ignore"/>
1108
</not>
1109
</and>
1110
</condition>
1111
</fail>
1112
</sequential>
1113
</macrodef>
1114
1115
<!-- Run a list of junit tasks but don't track errors or generate a report after
1116
If a test fails the testfailed property will be set. All the tests are run using the testdelegate
1117
macro that is specified as an attribute and they will be run sequentially in this ant process -->
1118
1119
<!-- Defines how to run a set of tests. If you change the defaults for attributes
1120
you should also update them in testmacro.,
1121
The two are split because the helper doesn't generate
1122
a junit report or fail on errors -->
1123
<macrodef name="testmacrohelper">
1124
<attribute name="inputdir" />
1125
<attribute name="timeout" default="${test.timeout}" />
1126
<attribute name="forkmode" default="perTest"/>
1127
<element name="optjvmargs" implicit="true" optional="true" />
1128
<attribute name="filter" default="**/${test.name}.java"/>
1129
<attribute name="exclude" default="" />
1130
<attribute name="filelist" default="" />
1131
<attribute name="testtag" default=""/>
1132
<attribute name="usejacoco" default="no"/>
1133
<attribute name="showoutput" default="false"/>
1134
1135
<sequential>
1136
<fail message="testing with build.test.dir (${build.test.dir}) not pointing to 'build/test/' will fail, test configurations are hardcoded.">
1137
<condition><not><equals arg1="${build.test.dir}" arg2="${basedir}/build/test"/></not></condition>
1138
</fail>
1139
<condition property="additionalagent"
1140
value="-javaagent:${build.dir.lib}/jars/jacocoagent.jar=destfile=${jacoco.partialexecfile}"
1141
else="">
1142
<istrue value="${usejacoco}"/>
1143
</condition>
1144
<taskdef name="junit-timeout" classname="org.apache.cassandra.JStackJUnitTask">
1145
<classpath>
1146
<pathelement location="${test.classes}"/>
1147
</classpath>
1148
</taskdef>
1149
<mkdir dir="${build.test.dir}/cassandra"/>
1150
<mkdir dir="${build.test.output.dir}"/>
1151
<mkdir dir="${build.test.output.dir}/@{testtag}"/>
1152
<mkdir dir="${tmp.dir}"/>
1153
<junit-timeout fork="on" forkmode="@{forkmode}" failureproperty="testfailed" maxmemory="1024m" timeout="@{timeout}" showoutput="@{showoutput}">
1154
<formatter classname="org.apache.cassandra.CassandraXMLJUnitResultFormatter" extension=".xml" usefile="true"/>
1155
<formatter classname="org.apache.cassandra.CassandraBriefJUnitResultFormatter" usefile="false"/>
1156
<jvmarg value="-Dstorage-config=${test.conf}"/>
1157
<jvmarg value="-Djava.awt.headless=true"/>
1158
<!-- Cassandra 3.0+ needs <jvmarg line="... ${additionalagent}" /> here! (not value=) -->
1159
<jvmarg line="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar ${additionalagent}" />
1160
<jvmarg value="-ea"/>
1161
<jvmarg value="-Djava.io.tmpdir=${tmp.dir}"/>
1162
<jvmarg value="-Dcassandra.debugrefcount=true"/>
1163
<jvmarg value="${jvm_xss}"/>
1164
<!-- When we do classloader manipulation SoftReferences can cause memory leaks
1165
that can OOM our test runs. The next two settings informs our GC
1166
algorithm to limit the metaspace size and clean up SoftReferences
1167
more aggressively rather than waiting. See CASSANDRA-14922 for more details.
1168
-->
1169
<jvmarg value="-XX:SoftRefLRUPolicyMSPerMB=0" />
1170
<jvmarg value="-XX:ActiveProcessorCount=${cassandra.test.processorCount}" />
1171
<jvmarg value="-XX:HeapDumpPath=${build.test.dir}" />
1172
<jvmarg value="-Dcassandra.test.driver.connection_timeout_ms=${test.driver.connection_timeout_ms}"/>
1173
<jvmarg value="-Dcassandra.test.driver.read_timeout_ms=${test.driver.read_timeout_ms}"/>
1174
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1175
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1176
<jvmarg value="-Dcassandra.test.sstableformatdevelopment=true"/>
1177
<!-- The first time SecureRandom initializes can be slow if it blocks on /dev/random -->
1178
<jvmarg value="-Djava.security.egd=file:/dev/urandom" />
1179
<jvmarg value="-Dcassandra.testtag=@{testtag}_jdk${ant.java.version}${testtag.extra}"/>
1180
<jvmarg value="-Dcassandra.keepBriefBrief=${cassandra.keepBriefBrief}" />
1181
<jvmarg value="-Dcassandra.strict.runtime.checks=true" />
1182
<jvmarg value="-Dcassandra.reads.thresholds.coordinator.defensive_checks_enabled=true" /> <!-- enable defensive checks -->
1183
<jvmarg value="-Dcassandra.test.flush_local_schema_changes=${cassandra.test.flush_local_schema_changes}"/>
1184
<jvmarg value="-Dcassandra.test.messagingService.nonGracefulShutdown=${cassandra.test.messagingService.nonGracefulShutdown}"/>
1185
<jvmarg value="-Dcassandra.use_nix_recursive_delete=${cassandra.use_nix_recursive_delete}"/>
1186
<jvmarg value="-Dio.netty.allocator.useCacheForAllThreads=true"/>
1187
<jvmarg value="-Dio.netty.allocator.maxOrder=11"/>
1188
<jvmarg line="${java-jvmargs}"/>
1189
<!-- disable shrinks in quicktheories CASSANDRA-15554 -->
1190
<jvmarg value="-DQT_SHRINKS=0"/>
1191
<jvmarg line="${_std-test-jvmargs} " />
1192
<jvmarg line="${test.jvm.args}" />
1193
<optjvmargs/>
1194
<!-- Uncomment to debug unittest, attach debugger to port 1416 -->
1195
<!--
1196
<jvmarg line="-agentlib:jdwp=transport=dt_socket,address=localhost:1416,server=y,suspend=y" />
1197
-->
1198
<classpath>
1199
<pathelement path="${java.class.path}"/>
1200
<pathelement location="${stress.build.classes}"/>
1201
<pathelement location="${fqltool.build.classes}"/>
1202
<pathelement location="${test.classes}"/>
1203
<path refid="cassandra.classpath.test" />
1204
<pathelement location="${stress.test.classes}"/>
1205
<pathelement location="${fqltool.test.classes}"/>
1206
<pathelement location="${test.conf}"/>
1207
<pathelement path="${java.class.path}"/>
1208
<path refid="cassandra.classpath" />
1209
<fileset dir="${test.lib}">
1210
<include name="**/*.jar" />
1211
<exclude name="**/ant-*.jar"/>
1212
</fileset>
1213
</classpath>
1214
<batchtest todir="${build.test.output.dir}/@{testtag}">
1215
<fileset dir="@{inputdir}" includes="@{filter}" excludes="@{exclude}"/>
1216
<filelist dir="@{inputdir}" files="@{filelist}"/>
1217
</batchtest>
1218
</junit-timeout>
1219
1220
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/commitlog"/>
1221
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/cdc_raw"/>
1222
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/data"/>
1223
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/ssl_upload_tables"/>
1224
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/system_data"/>
1225
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/saved_caches"/>
1226
<delete quiet="true" failonerror="false" dir="${build.test.dir}/cassandra/hints"/>
1227
</sequential>
1228
</macrodef>
1229
1230
<target name="testold" depends="maybe-build-test" description="Execute unit tests">
1231
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
1232
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1233
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1234
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1235
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1236
<jvmarg value="-Dcassandra.skip_sync=true" />
1237
</testmacro>
1238
<fileset dir="${test.unit.src}" />
1239
</target>
1240
1241
<!-- Will not generate a junit report or fail on error -->
1242
<macrodef name="testlist">
1243
<attribute name="test.file.list"/>
1244
<sequential>
1245
<condition property="maxMemory" value="8G" else="4G">
1246
<equals arg1="${test.classlistprefix}" arg2="distributed"/>
1247
</condition>
1248
<testmacrohelper inputdir="${test.dir}/${test.classlistprefix}" filelist="@{test.file.list}" exclude="**/*.java" timeout="${test.timeout}">
1249
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1250
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1251
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1252
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1253
<jvmarg value="-Dcassandra.skip_sync=true" />
1254
<!-- total memory must fit within the pod constraints, see comments in .jenkins/Jenkinsfile and dind's container resourceRequestMemory in .jenkins/k8s/jenkins-deployment.yaml -->
1255
<jvmarg value="-Xmx${maxMemory}"/>
1256
</testmacrohelper>
1257
</sequential>
1258
</macrodef>
1259
1260
<!-- Will not generate a junit report -->
1261
<macrodef name="testlist-compression">
1262
<attribute name="test.file.list" />
1263
<sequential>
1264
<property name="compressed_yaml" value="${build.test.dir}/cassandra.compressed.yaml"/>
1265
<concat destfile="${compressed_yaml}">
1266
<fileset file="${test.conf}/cassandra.yaml"/>
1267
<fileset file="${test.conf}/commitlog_compression_${test.compression.algo}.yaml"/>
1268
</concat>
1269
<testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
1270
exclude="**/*.java" timeout="${test.timeout}" testtag="compression">
1271
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1272
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1273
<jvmarg value="-Dcassandra.test.compression=true"/>
1274
<jvmarg value="-Dcassandra.test.compression.algo=${test.compression.algo}"/>
1275
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1276
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1277
<jvmarg value="-Dcassandra.config=file:///${compressed_yaml}"/>
1278
<jvmarg value="-Dcassandra.skip_sync=true" />
1279
</testmacrohelper>
1280
</sequential>
1281
</macrodef>
1282
1283
<macrodef name="testlist-cdc">
1284
<attribute name="test.file.list" />
1285
<sequential>
1286
<property name="cdc_yaml" value="${build.test.dir}/cassandra.cdc.yaml"/>
1287
<concat destfile="${cdc_yaml}">
1288
<fileset file="${test.conf}/cassandra.yaml"/>
1289
<fileset file="${test.conf}/cdc.yaml"/>
1290
</concat>
1291
<testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
1292
exclude="**/*.java" timeout="${test.timeout}" testtag="cdc">
1293
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1294
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1295
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1296
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1297
<jvmarg value="-Dcassandra.config=file:///${cdc_yaml}"/>
1298
<jvmarg value="-Dcassandra.skip_sync=true" />
1299
</testmacrohelper>
1300
</sequential>
1301
</macrodef>
1302
1303
<macrodef name="testlist-latest">
1304
<attribute name="test.file.list" />
1305
<sequential>
1306
<property name="latest_yaml" value="${build.test.dir}/cassandra.latest.yaml"/>
1307
<concat destfile="${latest_yaml}">
1308
<fileset file="${test.conf}/cassandra.yaml"/>
1309
<fileset file="${test.conf}/latest_diff.yaml"/>
1310
<fileset file="${test.conf}/storage_compatibility_mode_none.yaml"/>
1311
</concat>
1312
<testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
1313
exclude="**/*.java" timeout="${test.timeout}" testtag="latest">
1314
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1315
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1316
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1317
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1318
<jvmarg value="-Dcassandra.config=file:///${latest_yaml}"/>
1319
<jvmarg value="-Dcassandra.test.storage_compatibility_mode=NONE"/>
1320
<jvmarg value="-Dcassandra.skip_sync=true" />
1321
</testmacrohelper>
1322
</sequential>
1323
</macrodef>
1324
1325
<macrodef name="testlist-oa">
1326
<attribute name="test.file.list"/>
1327
<sequential>
1328
<property name="scm_none_yaml" value="${build.test.dir}/cassandra.scm_none.yaml"/>
1329
<concat destfile="${scm_none_yaml}">
1330
<fileset file="${test.conf}/cassandra.yaml"/>
1331
<fileset file="${test.conf}/storage_compatibility_mode_none.yaml"/>
1332
</concat>
1333
<testmacrohelper inputdir="${test.dir}/${test.classlistprefix}" filelist="@{test.file.list}"
1334
exclude="**/*.java" timeout="${test.timeout}" testtag="oa">
1335
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1336
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1337
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1338
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1339
<jvmarg value="-Dcassandra.config=file:///${scm_none_yaml}"/>
1340
<jvmarg value="-Dcassandra.test.storage_compatibility_mode=NONE"/>
1341
<jvmarg value="-Dcassandra.skip_sync=true" />
1342
</testmacrohelper>
1343
</sequential>
1344
</macrodef>
1345
1346
<macrodef name="testlist-system-keyspace-directory">
1347
<attribute name="test.file.list" />
1348
<sequential>
1349
<property name="system_keyspaces_directory_yaml" value="${build.test.dir}/cassandra.system.yaml"/>
1350
<concat destfile="${system_keyspaces_directory_yaml}">
1351
<fileset file="${test.conf}/cassandra.yaml"/>
1352
<fileset file="${test.conf}/system_keyspaces_directory.yaml"/>
1353
</concat>
1354
<testmacrohelper inputdir="${test.unit.src}" filelist="@{test.file.list}"
1355
exclude="**/*.java" timeout="${test.timeout}" testtag="system_keyspace_directory">
1356
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1357
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1358
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1359
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1360
<jvmarg value="-Dcassandra.config=file:///${system_keyspaces_directory_yaml}"/>
1361
<jvmarg value="-Dcassandra.skip_sync=true" />
1362
</testmacrohelper>
1363
</sequential>
1364
</macrodef>
1365
1366
<!--
1367
Run named ant task with jacoco, such as "ant jacoco-run -Dtaskname=test"
1368
the target run must enable the jacoco agent if usejacoco is 'yes' -->
1369
<target name="jacoco-run" description="run named task with jacoco instrumentation">
1370
<condition property="runtask" value="${taskname}" else="test">
1371
<isset property="taskname"/>
1372
</condition>
1373
<antcall target="${runtask}">
1374
<param name="usejacoco" value="yes"/>
1375
</antcall>
1376
</target>
1377
1378
<!-- Use this with an FQDN for test class, and an optional csv list of methods like this:
1379
ant testsome -Dtest.name=org.apache.cassandra.service.StorageServiceServerTest
1380
ant testsome -Dtest.name=org.apache.cassandra.service.StorageServiceServerTest -Dtest.methods=testRegularMode,testGetAllRangesEmpty
1381
-->
1382
<target name="testsome" depends="maybe-build-test" description="Execute specific unit tests" >
1383
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}">
1384
<test if="withMethods" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
1385
<test if="withoutMethods" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
1386
<jvmarg value="-Dlegacy-sstable-root=${test.data}/legacy-sstables"/>
1387
<jvmarg value="-Dinvalid-legacy-sstable-root=${test.data}/invalid-legacy-sstables"/>
1388
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1389
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1390
<jvmarg value="-Dcassandra.skip_sync=true" />
1391
</testmacro>
1392
</target>
1393
1394
<!-- Use this with an FQDN for test class, and an optional csv list of methods like this:
1395
ant long-testsome -Dtest.name=org.apache.cassandra.cql3.ManyRowsTest
1396
ant long-testsome -Dtest.name=org.apache.cassandra.cql3.ManyRowsTest -Dtest.methods=testLargeCount
1397
-->
1398
<target name="long-testsome" depends="maybe-build-test" description="Execute specific long unit tests" >
1399
<testmacro inputdir="${test.long.src}" timeout="${test.long.timeout}">
1400
<test if="withMethods" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
1401
<test if="withoutMethods" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
1402
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1403
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1404
</testmacro>
1405
</target>
1406
1407
<!-- Use this with an FQDN for test class, and an optional csv list of methods like this:
1408
ant burn-testsome -Dtest.name=org.apache.cassandra.utils.memory.LongBufferPoolTest
1409
ant burn-testsome -Dtest.name=org.apache.cassandra.utils.memory.LongBufferPoolTest -Dtest.methods=testPoolAllocateWithRecyclePartially
1410
-->
1411
<target name="burn-testsome" depends="maybe-build-test" description="Execute specific burn unit tests" >
1412
<testmacro inputdir="${test.burn.src}" timeout="${test.burn.timeout}">
1413
<test if="withMethods" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
1414
<test if="withoutMethods" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
1415
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-burntest.xml"/>
1416
</testmacro>
1417
</target>
1418
1419
<target name="test-compression" depends="maybe-build-test,stress-build" description="Execute unit tests with sstable compression enabled">
1420
<path id="all-test-classes-path">
1421
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1422
<fileset dir="${test.distributed.src}" includes="**/${test.name}.java" />
1423
</path>
1424
<property name="all-test-classes" refid="all-test-classes-path"/>
1425
<testhelper testdelegate="testlist-compression" />
1426
</target>
1427
1428
<target name="test-cdc" depends="maybe-build-test" description="Execute unit tests with change-data-capture enabled">
1429
<path id="all-test-classes-path">
1430
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1431
</path>
1432
<property name="all-test-classes" refid="all-test-classes-path"/>
1433
<testhelper testdelegate="testlist-cdc" />
1434
</target>
1435
1436
<target name="test-latest" depends="maybe-build-test" description="Execute unit tests with configuration matching cassandra_latest.yaml">
1437
<path id="all-test-classes-path">
1438
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1439
</path>
1440
<property name="all-test-classes" refid="all-test-classes-path"/>
1441
<testhelper testdelegate="testlist-latest" />
1442
</target>
1443
1444
<target name="test-oa" depends="maybe-build-test" description="Test Runner for the oa sstable format">
1445
<path id="all-test-classes-path">
1446
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" excludes="**/distributed/test/UpgradeTest*.java" />
1447
</path>
1448
<property name="all-test-classes" refid="all-test-classes-path"/>
1449
<testhelper testdelegate="testlist-oa"/>
1450
</target>
1451
1452
<target name="test-system-keyspace-directory" depends="maybe-build-test" description="Execute unit tests with a system keyspaces directory configured">
1453
<path id="all-test-classes-path">
1454
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" />
1455
</path>
1456
<property name="all-test-classes" refid="all-test-classes-path"/>
1457
<testhelper testdelegate="testlist-system-keyspace-directory" />
1458
</target>
1459
1460
<target name="msg-ser-gen-test" depends="maybe-build-test" description="Generates message serializations">
1461
<testmacro inputdir="${test.unit.src}"
1462
timeout="${test.timeout}" filter="**/SerializationsTest.java">
1463
<jvmarg value="-Dcassandra.test-serialization-writes=True"/>
1464
</testmacro>
1465
</target>
1466
1467
<target name="msg-ser-test" depends="maybe-build-test" description="Tests message serializations">
1468
<testmacro inputdir="${test.unit.src}" timeout="${test.timeout}"
1469
filter="**/SerializationsTest.java"/>
1470
</target>
1471
1472
<target name="msg-ser-test-7" depends="maybe-build-test" description="Generates message serializations">
1473
<testmacro inputdir="${test.unit.src}"
1474
timeout="${test.timeout}" filter="**/SerializationsTest.java">
1475
<jvmarg value="-Dcassandra.version=0.7"/>
1476
</testmacro>
1477
</target>
1478
1479
<target name="msg-ser-test-10" depends="maybe-build-test" description="Tests message serializations on 1.0 messages">
1480
<testmacro inputdir="${test.unit.src}"
1481
timeout="${test.timeout}" filter="**/SerializationsTest.java">
1482
<jvmarg value="-Dcassandra.version=1.0"/>
1483
</testmacro>
1484
</target>
1485
1486
<target name="test-burn" depends="maybe-build-test" description="Execute functional tests">
1487
<testmacro inputdir="${test.burn.src}"
1488
timeout="${test.burn.timeout}">
1489
</testmacro>
1490
</target>
1491
1492
<target name="long-test" depends="maybe-build-test" description="Execute functional tests">
1493
<testmacro inputdir="${test.long.src}"
1494
timeout="${test.long.timeout}">
1495
<jvmarg value="-Dcassandra.ring_delay_ms=1000"/>
1496
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1497
</testmacro>
1498
</target>
1499
1500
<target name="test-memory" depends="maybe-build-test" description="Execute functional tests">
1501
<testmacro inputdir="${test.memory.src}"
1502
timeout="${test.memory.timeout}">
1503
<jvmarg value="-javaagent:${build.dir}/test/lib/jars/java-allocation-instrumenter-${allocation-instrumenter.version}.jar"/>
1504
</testmacro>
1505
</target>
1506
1507
<target name="cql-test" depends="maybe-build-test" description="Execute CQL tests">
1508
<sequential>
1509
<echo message="running CQL tests"/>
1510
<mkdir dir="${build.test.dir}/cassandra"/>
1511
<mkdir dir="${build.test.output.dir}"/>
1512
<junit fork="on" forkmode="once" failureproperty="testfailed" maxmemory="1024m" timeout="${test.timeout}">
1513
<formatter type="brief" usefile="false"/>
1514
<jvmarg value="-Dstorage-config=${test.conf}"/>
1515
<jvmarg value="-Djava.awt.headless=true"/>
1516
<jvmarg value="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar" />
1517
<jvmarg value="-ea"/>
1518
<jvmarg value="${jvm_xss}"/>
1519
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1520
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1521
<jvmarg value="-Dcassandra.skip_sync=true" />
1522
<classpath>
1523
<path refid="cassandra.classpath.test" />
1524
<pathelement location="${test.classes}"/>
1525
<pathelement location="${test.conf}"/>
1526
<fileset dir="${test.lib}">
1527
<include name="**/*.jar" />
1528
</fileset>
1529
</classpath>
1530
<batchtest todir="${build.test.output.dir}">
1531
<fileset dir="${test.unit.src}" includes="**/cql3/*Test.java">
1532
<contains text="CQLTester" casesensitive="yes"/>
1533
</fileset>
1534
</batchtest>
1535
</junit>
1536
<fail message="Some CQL test(s) failed.">
1537
<condition>
1538
<and>
1539
<isset property="testfailed"/>
1540
<not>
1541
<isset property="ant.test.failure.ignore"/>
1542
</not>
1543
</and>
1544
</condition>
1545
</fail>
1546
</sequential>
1547
</target>
1548
1549
<!-- Use this with an simple class name for test class, and an optional csv list of methods like this:
1550
ant cql-test-some -Dtest.name=ListsTest
1551
ant cql-test-some -Dtest.name=ListsTest -Dtest.methods=testPrecisionTime_getNext_simple
1552
-->
1553
<target name="cql-test-some" depends="maybe-build-test" description="Execute specific CQL tests" >
1554
<sequential>
1555
<echo message="running ${test.methods} tests from ${test.name}"/>
1556
<mkdir dir="${build.test.dir}/cassandra"/>
1557
<mkdir dir="${build.test.output.dir}"/>
1558
<junit fork="on" forkmode="once" failureproperty="testfailed" maxmemory="1024m" timeout="${test.timeout}">
1559
<formatter type="brief" usefile="false"/>
1560
<jvmarg value="-Dstorage-config=${test.conf}"/>
1561
<jvmarg value="-Djava.awt.headless=true"/>
1562
<jvmarg value="-javaagent:${build.dir.lib}/jars/jamm-${jamm.version}.jar" />
1563
<jvmarg value="-ea"/>
1564
<jvmarg value="${jvm_xss}"/>
1565
<jvmarg value="-Dcassandra.test.use_prepared=${cassandra.test.use_prepared}"/>
1566
<jvmarg value="-Dcassandra.memtable_row_overhead_computation_step=100"/>
1567
<jvmarg value="-Dcassandra.skip_sync=true" />
1568
<classpath>
1569
<path refid="cassandra.classpath.test" />
1570
<pathelement location="${test.classes}"/>
1571
<pathelement location="${test.conf}"/>
1572
<fileset dir="${test.lib}">
1573
<include name="**/*.jar" />
1574
</fileset>
1575
</classpath>
1576
<test unless:blank="${test.methods}" name="org.apache.cassandra.cql3.${test.name}" methods="${test.methods}" todir="${build.test.output.dir}"/>
1577
<test if:blank="${test.methods}" name="org.apache.cassandra.cql3.${test.name}" todir="${build.test.output.dir}"/>
1578
</junit>
1579
</sequential>
1580
</target>
1581
1582
<!-- Use JaCoCo ant extension without needing externally saved lib -->
1583
<target name="jacoco-init" depends="resolver-init">
1584
<typedef uri="antlib:org.jacoco.ant" classpathref="jacocoant.classpath"/>
1585
</target>
1586
1587
<target name="jacoco-merge" depends="jacoco-init">
1588
<jacoco:merge destfile="${jacoco.finalexecfile}" xmlns:jacoco="antlib:org.jacoco.ant">
1589
<fileset dir="${jacoco.export.dir}" includes="*.exec,**/*.exec"/>
1590
</jacoco:merge>
1591
</target>
1592
1593
<target name="jacoco-report" depends="jacoco-merge">
1594
<jacoco:report xmlns:jacoco="antlib:org.jacoco.ant">
1595
<executiondata>
1596
<file file="${jacoco.finalexecfile}" />
1597
</executiondata>
1598
<structure name="JaCoCo Cassandara Coverage Report">
1599
<classfiles>
1600
<fileset dir="${build.classes.main}">
1601
<include name="**/*.class"/>
1602
</fileset>
1603
</classfiles>
1604
<sourcefiles encoding="UTF-8">
1605
<dirset dir="${build.src}">
1606
<include name="java"/>
1607
<include name="gen-java"/>
1608
</dirset>
1609
</sourcefiles>
1610
</structure>
1611
<!-- to produce reports in different formats. -->
1612
<html destdir="${jacoco.export.dir}" />
1613
<csv destfile="${jacoco.export.dir}/report.csv" />
1614
<xml destfile="${jacoco.export.dir}/report.xml" />
1615
</jacoco:report>
1616
</target>
1617
1618
<target name="jacoco-cleanup" description="Destroy JaCoCo exec data and reports">
1619
<delete file="${jacoco.partialexecfile}"/>
1620
<delete dir="${jacoco.export.dir}"/>
1621
</target>
1622
1623
<target name="javadoc" depends="build" description="Create javadoc" unless="no-javadoc">
1624
<create-javadoc destdir="${javadoc.dir}">
1625
<filesets>
1626
<fileset dir="${build.src.java}" defaultexcludes="yes">
1627
<include name="org/apache/**/*.java"/>
1628
</fileset>
1629
</filesets>
1630
</create-javadoc>
1631
</target>
1632
1633
<!-- Run tests and reports errors and generates a junit report after -->
1634
<macrodef name="testmacro">
1635
<attribute name="inputdir" />
1636
<attribute name="timeout" default="${test.timeout}" />
1637
<attribute name="forkmode" default="perTest"/>
1638
<attribute name="showoutput" default="true"/>
1639
<element name="optjvmargs" implicit="true" optional="true" />
1640
<attribute name="filter" default="**/${test.name}.java"/>
1641
<attribute name="exclude" default="" />
1642
<attribute name="filelist" default="" />
1643
<attribute name="testtag" default=""/>
1644
1645
<sequential>
1646
<testmacrohelper inputdir="@{inputdir}" timeout="@{timeout}"
1647
forkmode="@{forkmode}" filter="@{filter}"
1648
exclude="@{exclude}" filelist="@{filelist}"
1649
testtag="@{testtag}" showoutput="false" >
1650
<optjvmargs/>
1651
</testmacrohelper>
1652
<fail message="Some test(s) failed.">
1653
<condition>
1654
<and>
1655
<isset property="testfailed"/>
1656
<not>
1657
<isset property="ant.test.failure.ignore"/>
1658
</not>
1659
</and>
1660
</condition>
1661
</fail>
1662
</sequential>
1663
</macrodef>
1664
1665
<target name="test" depends="maybe-build-test" description="Test Runner">
1666
<path id="all-test-classes-path">
1667
<fileset dir="${test.unit.src}" includes="**/${test.name}.java" excludes="**/distributed/test/UpgradeTest*.java" />
1668
</path>
1669
<property name="all-test-classes" refid="all-test-classes-path"/>
1670
<testhelper testdelegate="testlist"/>
1671
</target>
1672
1673
<!-- run a list of tests as provided in -Dtest.classlistfile (or default of 'testnames.txt')
1674
The class list file should be one test class per line, with the path starting after test/unit
1675
e.g. org/apache/cassandra/hints/HintMessageTest.java -->
1676
<target name="testclasslist" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1677
<path id="all-test-classes-path">
1678
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1679
</path>
1680
<property name="all-test-classes" refid="all-test-classes-path"/>
1681
<testhelper testdelegate="testlist"/>
1682
</target>
1683
<target name="testclasslist-oa" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1684
<path id="all-test-classes-path">
1685
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1686
</path>
1687
<property name="all-test-classes" refid="all-test-classes-path"/>
1688
<testhelper testdelegate="testlist-oa"/>
1689
</target>
1690
<target name="testclasslist-compression" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1691
<path id="all-test-classes-path">
1692
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1693
</path>
1694
<property name="all-test-classes" refid="all-test-classes-path"/>
1695
<testhelper testdelegate="testlist-compression"/>
1696
</target>
1697
<target name="testclasslist-latest" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1698
<path id="all-test-classes-path">
1699
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1700
</path>
1701
<property name="all-test-classes" refid="all-test-classes-path"/>
1702
<testhelper testdelegate="testlist-latest"/>
1703
</target>
1704
<target name="testclasslist-cdc" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1705
<path id="all-test-classes-path">
1706
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1707
</path>
1708
<property name="all-test-classes" refid="all-test-classes-path"/>
1709
<testhelper testdelegate="testlist-cdc"/>
1710
</target>
1711
<target name="testclasslist-system-keyspace-directory" depends="maybe-build-test" description="Run tests given in file -Dtest.classlistfile (one-class-per-line, e.g. org/apache/cassandra/db/SomeTest.java)">
1712
<path id="all-test-classes-path">
1713
<fileset dir="${test.dir}/${test.classlistprefix}" includesfile="${test.classlistfile}"/>
1714
</path>
1715
<property name="all-test-classes" refid="all-test-classes-path"/>
1716
<testhelper testdelegate="testlist-system-keyspace-directory"/>
1717
</target>
1718
1719
<!-- Build a self-contained jar for e.g. remote execution; not currently used for running burn tests with this build script -->
1720
<target name="burn-test-jar" depends="build-test, build" description="Create dtest-compatible jar, including all dependencies">
1721
<jar jarfile="${build.dir}/burntest.jar">
1722
<zipgroupfileset dir="${build.lib}" includes="*.jar" excludes="META-INF/*.SF"/>
1723
<fileset dir="${build.classes.main}"/>
1724
<fileset dir="${test.classes}"/>
1725
<fileset dir="${test.conf}" excludes="logback*.xml"/>
1726
<fileset dir="${basedir}/conf" includes="logback*.xml"/>
1727
<zipgroupfileset dir="${build.dir.lib}/jars">
1728
<include name="junit*.jar"/>
1729
</zipgroupfileset>
1730
</jar>
1731
</target>
1732
1733
<target name="dtest-jar" depends="build-test, build" description="Create dtest-compatible jar, including all dependencies">
1734
<delete dir="${build.dir}/dtest/**" quiet="true"/>
1735
1736
<copy todir="${build.dir}/dtest" quiet="true" overwrite="false">
1737
<fileset dir="${build.classes.main}"/>
1738
<fileset dir="${test.classes}"/>
1739
<fileset dir="${test.conf}"/>
1740
</copy>
1741
<unzip dest="${build.dir}/dtest" overwrite="false">
1742
<fileset dir="${test.lib}/jars" includes="jimfs-1.1.jar,dtest-api-*.jar,asm-*.jar,javassist-*.jar,reflections-*.jar,semver4j-*.jar"/>
1743
<patternset excludes="META-INF/license/**"/>
1744
</unzip>
1745
<unzip dest="${build.dir}/dtest" overwrite="false">
1746
<fileset dir="${build.dir.lib}/jars" includes="*.jar"/>
1747
<patternset excludes="META-INF/license/**"/>
1748
</unzip>
1749
1750
<jar jarfile="${build.dir}/dtest-${base.version}.jar" duplicate="preserve">
1751
<fileset dir="${build.dir}/dtest">
1752
<exclude name="META-INF/*.SF"/>
1753
<exclude name="META-INF/*.DSA"/>
1754
<exclude name="META-INF/*.RSA"/>
1755
<exclude name="META-INF/license/**"/>
1756
</fileset>
1757
</jar>
1758
1759
<delete dir="${build.dir}/dtest" quiet="true"/>
1760
</target>
1761
1762
<target name="test-jvm-dtest" depends="maybe-build-test" description="Execute in-jvm dtests">
1763
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true" filter="**/test/${test.name}.java">
1764
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
1765
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1766
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1767
<jvmarg value="-Dcassandra.skip_sync=true" />
1768
<!-- total memory must fit within the pod constraints, see comments in .jenkins/Jenkinsfile and dind's container resourceRequestMemory in .jenkins/k8s/jenkins-deployment.yaml -->
1769
<jvmarg value="-Xmx8G"/>
1770
</testmacro>
1771
</target>
1772
1773
<target name="test-jvm-dtest-latest" depends="maybe-build-test" description="Execute in-jvm dtests with latest configuration">
1774
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true" filter="**/test/${test.name}.java">
1775
<jvmarg value="-Djvm_dtests.latest=true"/>
1776
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
1777
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1778
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1779
<jvmarg value="-Dcassandra.skip_sync=true" />
1780
</testmacro>
1781
</target>
1782
1783
<property name="simulator.asm.print" value="none"/> <!-- Supports: NONE, CLASS_SUMMARY, CLASS_DETAIL, METHOD_SUMMARY, METHOD_DETAIL, ASM; see org.apache.cassandra.simulator.asm.MethodLogger.Level -->
1784
<target name="test-simulator-dtest" depends="maybe-build-test" description="Execute simulator dtests">
1785
<testmacro inputdir="${test.simulator-test.src}" timeout="${test.simulation.timeout}" forkmode="perTest" showoutput="true" filter="**/test/${test.name}.java">
1786
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-simulator.xml"/>
1787
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1788
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1789
<jvmarg value="-Dcassandra.skip_sync=true" />
1790
<jvmarg value="-Dcassandra.debugrefcount=false"/>
1791
<jvmarg value="-Dcassandra.test.simulator.determinismcheck=strict"/>
1792
<jvmarg value="-Dcassandra.test.simulator.print_asm=${simulator.asm.print}" />
1793
<!-- Support Simulator Tests -->
1794
<jvmarg line="-javaagent:${test.lib}/jars/simulator-asm.jar"/>
1795
<jvmarg line="-Xbootclasspath/a:${test.lib}/jars/simulator-bootstrap.jar"/>
1796
<jvmarg line="-XX:ActiveProcessorCount=4"/>
1797
<jvmarg line="-XX:-TieredCompilation"/>
1798
<jvmarg line="-XX:-BackgroundCompilation"/>
1799
<jvmarg line="-XX:CICompilerCount=1"/>
1800
<jvmarg line="-XX:Tier4CompileThreshold=1000"/>
1801
<jvmarg line="-XX:ReservedCodeCacheSize=256M"/>
1802
<!-- total memory must fit within the pod constraints, see comments in .jenkins/Jenkinsfile and dind's container resourceRequestMemory in .jenkins/k8s/jenkins-deployment.yaml -->
1803
<jvmarg line="-Xmx8G"/>
1804
</testmacro>
1805
</target>
1806
1807
<!-- To run them you'll need to:
1808
- `ant dtest-jar` on each version involved, including your current feature branch
1809
- copy the build/dtest-*.jar for each version into your feature branch build folder
1810
- You can use 'test-jvm-dtest-some' if you only need to run one -->
1811
<target name="test-jvm-upgrade-dtest" depends="maybe-build-test" description="Execute in-jvm dtests">
1812
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true" filter="**/upgrade/*Test.java">
1813
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
1814
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1815
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1816
<jvmarg value="-Dcassandra.skip_sync=true" />
1817
<!-- total memory must fit within the pod constraints, see comments in .jenkins/Jenkinsfile and dind's container resourceRequestMemory in .jenkins/k8s/jenkins-deployment.yaml -->
1818
<jvmarg value="-Xmx8G"/>
1819
</testmacro>
1820
</target>
1821
1822
<!-- Use this with an FQDN for test class or upgrade test, and an optional csv list of methods like this:
1823
ant test-jvm-dtest-some -Dtest.name=org.apache.cassandra.distributed.test.ResourceLeakTest
1824
ant test-jvm-dtest-some -Dtest.name=org.apache.cassandra.distributed.test.ResourceLeakTest -Dtest.methods=looperTest
1825
-->
1826
<target name="test-jvm-dtest-some" depends="maybe-build-test" description="Execute some in-jvm dtests">
1827
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true">
1828
<test unless:blank="${test.methods}" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
1829
<test if:blank="${test.methods}" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
1830
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
1831
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1832
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1833
<jvmarg value="-Dcassandra.skip_sync=true" />
1834
<!-- total memory must fit within the pod constraints, see comments in .jenkins/Jenkinsfile and dind's container resourceRequestMemory in .jenkins/k8s/jenkins-deployment.yaml -->
1835
<jvmarg value="-Xmx8G"/>
1836
</testmacro>
1837
</target>
1838
1839
<target name="test-jvm-dtest-latest-some" depends="maybe-build-test" description="Execute some in-jvm dtests with latest configuration">
1840
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true">
1841
<test unless:blank="${test.methods}" name="${test.name}" methods="${test.methods}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}-${test.methods}"/>
1842
<test if:blank="${test.methods}" name="${test.name}" todir="${build.test.output.dir}/" outfile="TEST-${test.name}"/>
1843
<jvmarg value="-Djvm_dtests.latest=true"/>
1844
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
1845
<jvmarg value="-Dcassandra.ring_delay_ms=10000"/>
1846
<jvmarg value="-Dcassandra.tolerate_sstable_size=true"/>
1847
<jvmarg value="-Dcassandra.skip_sync=true" />
1848
</testmacro>
1849
</target>
1850
1851
<target name="generate-test-report" description="Merge all unit xml files into one, generate html pages, and print summary test numbers">
1852
<echo message="Generating Test Summary for test files found under ${build.test.output.dir}" />
1853
<mkdir dir="${build.test.report.dir}/unitTestReport"/>
1854
<junitreport todir="${build.test.report.dir}/unitTestReport">
1855
<fileset dir="${build.test.output.dir}">
1856
<include name="**/TEST-*.xml"/>
1857
<include name="**/cqlshlib*.xml"/>
1858
<include name="**/nosetests*.xml"/>
1859
</fileset>
1860
<report todir="${build.test.report.dir}/unitTestReport/html" unless:true="${print-summary.skip}" />
1861
</junitreport>
1862
<!-- concat the report through a filter chain to extract a single line summary -->
1863
<concat unless:true="${print-summary.skip}">
1864
<fileset file="${build.test.report.dir}/unitTestReport/html/overview-summary.html" />
1865
<filterchain>
1866
<linecontainsregexp>
1867
<regexp pattern='title="Display all tests"' />
1868
</linecontainsregexp>
1869
<tokenfilter>
1870
<!-- escaped values of < and > are "&gt;" and "&lt;" -->
1871
<replaceregex pattern='.*all tests.*&gt;(\d+)&lt;.*all failures.*&gt;(\d+)&lt;.*all errors.*&gt;(\d+)&lt;.*all skipped test.*&gt;(\d+)&lt;.*$' replace="[Test Summary] Run: \1, Failed: \2, Errors: \3, Skipped: \4" />
1872
</tokenfilter>
1873
</filterchain>
1874
</concat>
1875
</target>
1876
1877
<!-- run arbitrary mains in tests, for example to run the long running memory tests with lots of memory pressure
1878
ant run-main -Dmainclass=org.apache.cassandra.utils.memory.LongBufferPoolTest -Dvmargs="-Xmx30m -XX:-UseGCOverheadLimit"
1879
-->
1880
<target name="run-main" depends="maybe-build-test">
1881
<property name="mainclass" value="" />
1882
<property name="vmargs" value="" />
1883
<property name="args" value="" />
1884
<java classname="${mainclass}"
1885
fork="true"
1886
failonerror="true">
1887
<jvmarg value="-server" />
1888
<jvmarg value="-ea" />
1889
<jvmarg line="${vmargs}" />
1890
<arg line="${args}" />
1891
<classpath>
1892
<path refid="cassandra.classpath" />
1893
<pathelement location="${test.classes}"/>
1894
<pathelement location="${test.conf}"/>
1895
<fileset dir="${test.lib}">
1896
asm-<include name="**/*.jar" />
1897
</fileset>
1898
</classpath>
1899
</java>
1900
</target>
1901
1902
<target name="_maybe_update_idea_to_java11plus" depends="init">
1903
<replace file="${eclipse.project.name}.iml" token="JDK_11" value="JDK_${ant.java.version}"/>
1904
<replace file=".idea/misc.xml" token="JDK_11" value="JDK_${ant.java.version}"/>
1905
<replace file=".idea/misc.xml" token="11" value="${ant.java.version}"/>
1906
<replaceregexp file=".idea/workspace.xml"
1907
match="name=&quot;VM_PARAMETERS&quot; value=&quot;(.*)"
1908
replace="name=&quot;VM_PARAMETERS&quot; value=&quot;\1 ${java-jvmargs} ${_std-test-jvmargs}"
1909
byline="true"/>
1910
1911
<echo file=".idea/compiler.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1912
<project version="4">
1913
<component name="JavacSettings">
1914
<option name="ADDITIONAL_OPTIONS_STRING" value="--add-exports java.rmi/sun.rmi.registry=ALL-UNNAMED
1915
--add-exports java.rmi/sun.rmi.transport=ALL-UNNAMED
1916
--add-exports java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED
1917
--add-exports java.base/jdk.internal.ref=ALL-UNNAMED
1918
--add-exports java.base/sun.nio.ch=ALL-UNNAMED" />
1919
</component>
1920
</project>]]></echo>
1921
</target>
1922
1923
<!-- Generate IDEA project description files -->
1924
<target name="generate-idea-files" depends="init,resolver-dist-lib,gen-cql3-grammar,generate-jflex-java,_createVersionPropFile" description="Generate IDEA files">
1925
<delete dir=".idea"/>
1926
<delete file="${eclipse.project.name}.iml"/>
1927
<mkdir dir=".idea"/>
1928
<mkdir dir=".idea/libraries"/>
1929
<copy todir=".idea" overwrite="true">
1930
<fileset dir="ide/idea"/>
1931
</copy>
1932
<replace file=".idea/workspace.xml" token="trunk" value="${eclipse.project.name}"/>
1933
<replace file=".idea/workspace.xml" token="-Dcassandra.use_nix_recursive_delete=true" value="-Dcassandra.use_nix_recursive_delete=${cassandra.use_nix_recursive_delete}"/>
1934
<copy tofile="${eclipse.project.name}.iml" file="ide/idea-iml-file.xml"/>
1935
<echo file=".idea/.name">Apache Cassandra ${eclipse.project.name}</echo>
1936
<echo file=".idea/modules.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1937
<project version="4">
1938
<component name="ProjectModuleManager">
1939
<modules>
1940
<module fileurl="file://$PROJECT_DIR$/]]>${eclipse.project.name}<![CDATA[.iml" filepath="$PROJECT_DIR$/]]>${eclipse.project.name}<![CDATA[.iml" />
1941
</modules>
1942
</component>
1943
</project>]]></echo>
1944
<antcall target="_maybe_update_idea_to_java11plus"/>
1945
<echo>
1946
IDE configuration in .idea/ updated for use with JDK${ant.java.version}.
1947
1948
In IntelliJ verify that the SDK is ${ant.java.version}, and its path is valid.
1949
This can be verified in 'Project Structure/Project Setting/Project' and 'Project Structure/Platform Setting/SDKs'.
1950
</echo>
1951
</target>
1952
1953
<!-- Generate Eclipse project description files -->
1954
<target name="generate-eclipse-files" depends="build-test" description="Generate eclipse files">
1955
<echo file=".project"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1956
<projectDescription>
1957
<name>${eclipse.project.name}</name>
1958
<comment></comment>
1959
<projects>
1960
</projects>
1961
<buildSpec>
1962
<buildCommand>
1963
<name>org.eclipse.jdt.core.javabuilder</name>
1964
</buildCommand>
1965
</buildSpec>
1966
<natures>
1967
<nature>org.eclipse.jdt.core.javanature</nature>
1968
</natures>
1969
</projectDescription>]]>
1970
</echo>
1971
<path id="eclipse-project-libs-path">
1972
<fileset dir="lib">
1973
<include name="**/*.jar" />
1974
</fileset>
1975
<fileset dir="${build.dir.lib}/jars">
1976
<include name="**/*.jar" />
1977
</fileset>
1978
<fileset dir="${test.lib}/jars">
1979
<include name="**/*.jar" />
1980
</fileset>
1981
</path>
1982
<pathconvert property="eclipse-libs-list" refid="eclipse-project-libs-path" pathsep="${line.separator}">
1983
<mapper>
1984
<regexpmapper from="^(.*)$$" to='&lt;classpathentry kind="lib" path="\1" /&gt;'/>
1985
</mapper>
1986
</pathconvert>
1987
<property name="eclipse-project-libs" refid="eclipse-project-libs-path"/>
1988
<echo file=".classpath"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
1989
<classpath>
1990
<classpathentry kind="src" path="src/java"/>
1991
<classpathentry kind="src" path="src/resources"/>
1992
<classpathentry kind="src" path="src/gen-java"/>
1993
<classpathentry kind="src" path="conf" including="hotspot_compiler"/>
1994
<classpathentry kind="src" output="${test.classes}" path="test/unit"/>
1995
<classpathentry kind="src" output="${test.classes}" path="test/long"/>
1996
<classpathentry kind="src" output="${test.classes}" path="test/distributed"/>
1997
<classpathentry kind="src" output="${test.classes}" path="test/simulator/asm"/>
1998
<classpathentry kind="src" output="${test.classes}" path="test/simulator/main"/>
1999
<classpathentry kind="src" output="${test.classes}" path="test/resources" />
2000
<classpathentry kind="src" path="tools/stress/src"/>
2001
<classpathentry kind="src" path="tools/fqltool/src"/>
2002
<classpathentry kind="src" output="build/test/stress-classes" path="tools/stress/test/unit" />
2003
<classpathentry kind="src" output="build/test/fqltool-classes" path="tools/fqltool/test/unit" />
2004
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
2005
<classpathentry kind="output" path="build/classes/eclipse"/>
2006
<classpathentry kind="lib" path="test/conf"/>
2007
<classpathentry kind="lib" path="${java.home}/../lib/tools.jar"/>
2008
${eclipse-libs-list}
2009
</classpath>
2010
]]>
2011
</echo>
2012
<taskdef name="echoeclipseprojectslibs" classname="org.apache.cassandra.anttasks.EchoEclipseProjectLibs" classpath="${test.classes}">
2013
<classpath>
2014
<path refid="cassandra.classpath"/>
2015
<path refid="cassandra.classpath.test"/>
2016
</classpath>
2017
</taskdef>
2018
<mkdir dir=".settings" />
2019
</target>
2020
2021
<pathconvert property="eclipse.project.name">
2022
<path path="${basedir}" />
2023
<regexpmapper from="^.*/([^/]+)$$" to="\1" handledirsep="yes" />
2024
</pathconvert>
2025
2026
<!-- Clean Eclipse project description files -->
2027
<target name="clean-eclipse-files">
2028
<delete file=".project" />
2029
<delete file=".classpath" />
2030
<delete dir=".settings" />
2031
<delete dir=".externalToolBuilders" />
2032
<delete dir="build/eclipse-classes" />
2033
</target>
2034
2035
<!-- Empty fake task until we remove it from Jenkins. eclipse-warnings removed in favor of using CheckerFramework
2036
For more information - CASSANDRA-18190 and CASSANDDRA-18239-->
2037
<target name="eclipse-warnings" depends="build" description="Run eclipse compiler code analysis" if="java.version.8"> </target>
2038
2039
<!-- Installs artifacts to local Maven repository -->
2040
<target name="mvn-install"
2041
depends="jar,sources-jar,javadoc-jar"
2042
description="Installs the artifacts in the Maven Local Repository">
2043
2044
<!-- the parent -->
2045
<install pomFile="${build.dir}/${final.name}-parent.pom"
2046
file="${build.dir}/${final.name}-parent.pom"
2047
packaging="pom"/>
2048
2049
<!-- the cassandra-all jar -->
2050
<install pomFile="${build.dir}/${final.name}.pom"
2051
file="${build.dir}/${final.name}.jar"/>
2052
<install pomFile="${build.dir}/${final.name}.pom"
2053
file="${build.dir}/${final.name}-sources.jar"
2054
classifier="sources"/>
2055
<install pomFile="${build.dir}/${final.name}.pom"
2056
file="${build.dir}/${final.name}-javadoc.jar"
2057
classifier="javadoc"/>
2058
</target>
2059
2060
<!-- Publish artifacts to remote Maven repository -->
2061
<target name="publish"
2062
depends="mvn-install,artifacts"
2063
description="Publishes the artifacts to the Maven repository">
2064
2065
<!-- the parent -->
2066
<deploy pomFile="${build.dir}/${final.name}-parent.pom"
2067
file="${build.dir}/${final.name}-parent.pom"
2068
packaging="pom"/>
2069
2070
<!-- the cassandra-all jar -->
2071
<deploy pomFile="${build.dir}/${final.name}.pom"
2072
file="${build.dir}/${final.name}.jar"/>
2073
<deploy pomFile="${build.dir}/${final.name}.pom"
2074
file="${build.dir}/${final.name}-sources.jar"
2075
classifier="sources"/>
2076
<deploy pomFile="${build.dir}/${final.name}.pom"
2077
file="${build.dir}/${final.name}-javadoc.jar"
2078
classifier="javadoc"/>
2079
2080
<!-- the distribution -->
2081
<sign-dist file="${build.dir}/${final.name}-bin.tar.gz" />
2082
<sign-dist file="${build.dir}/${final.name}-src.tar.gz" />
2083
2084
</target>
2085
2086
<import file="${build.helpers.dir}/build-resolver.xml"/>
2087
<import file="${build.helpers.dir}/build-rat.xml"/>
2088
<import file="${build.helpers.dir}/build-owasp.xml"/>
2089
<import file="${build.helpers.dir}/build-git.xml"/>
2090
<import file="${build.helpers.dir}/build-checkstyle.xml"/>
2091
<import file="${build.helpers.dir}/build-cqlsh.xml"/>
2092
<import file="${build.helpers.dir}/build-bench.xml"/>
2093
<import file="${build.helpers.dir}/build-sonar.xml"/>
2094
</project>
2095
2096