mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-2.2' into cassandra-3.0
This commit is contained in:
commit
1ee18ac22d
|
|
@ -5,6 +5,7 @@
|
|||
* Fix ColumnFilter behaviour to prevent digest mitmatches during upgrades (CASSANDRA-16415)
|
||||
* Avoid pushing schema mutations when setting up distributed system keyspaces locally (CASSANDRA-16387)
|
||||
Merged from 2.2:
|
||||
* Remove ant targets list-jvm-dtests and ant list-jvm-upgrade-dtests (CASSANDRA-16519)
|
||||
* Fix centos packaging for arm64, >=4.0 rpm's now require python3 (CASSANDRA-16477)
|
||||
* Make TokenMetadata's ring version increments atomic (CASSANDRA-16286)
|
||||
|
||||
|
|
|
|||
46
build.xml
46
build.xml
|
|
@ -65,9 +65,6 @@
|
|||
<property name="test.burn.src" value="${test.dir}/burn"/>
|
||||
<property name="test.microbench.src" value="${test.dir}/microbench"/>
|
||||
<property name="test.distributed.src" value="${test.dir}/distributed"/>
|
||||
<property name="test.distributed.listfile" value="ant-jvm-dtest-list"/>
|
||||
<property name="test.distributed.upgrade.listfile" value="ant-jvm-dtest-upgrade-list"/>
|
||||
<property name="test.distributed.upgrade.package" value="org.apache.cassandra.distributed.upgrade"/>
|
||||
<property name="dist.dir" value="${build.dir}/dist"/>
|
||||
<property name="tmp.dir" value="${java.io.tmpdir}"/>
|
||||
|
||||
|
|
@ -1824,27 +1821,6 @@
|
|||
<testparallel testdelegate="testlist-compression"/>
|
||||
</target>
|
||||
|
||||
<!-- In-JVM dtest targets -->
|
||||
<target name="list-jvm-dtests" depends="build-test">
|
||||
<java classname="org.apache.cassandra.distributed.test.TestLocator" fork="no">
|
||||
<classpath>
|
||||
<path refid="cassandra.classpath" />
|
||||
<pathelement location="${test.classes}"/>
|
||||
<pathelement location="${test.conf}"/>
|
||||
<fileset dir="${test.lib}">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
<arg value="${test.distributed.listfile}"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="test-jvm-dtest-forking" depends="list-jvm-dtests" description="Execute In-JVM 'distributed' tests" >
|
||||
<chmod file="${test.distributed.listfile}" perm="+x"/>
|
||||
<exec executable="./${test.distributed.listfile}" failonerror="true"/>
|
||||
<delete file="${test.distributed.listfile}"/>
|
||||
</target>
|
||||
|
||||
<target name="dtest-jar" depends="build-test, build" description="Create dtest-compatible jar, including all dependencies">
|
||||
<jar jarfile="${build.dir}/dtest-${base.version}.jar">
|
||||
<zipgroupfileset dir="${build.lib}" includes="*.jar" excludes="META-INF/*.SF"/>
|
||||
|
|
@ -1864,28 +1840,6 @@
|
|||
</testmacro>
|
||||
</target>
|
||||
|
||||
<!-- In-JVM upgrade dtests -->
|
||||
<target name="list-jvm-upgrade-dtests" depends="build-test">
|
||||
<java classname="org.apache.cassandra.distributed.test.TestLocator" fork="no">
|
||||
<classpath>
|
||||
<path refid="cassandra.classpath" />
|
||||
<pathelement location="${test.classes}"/>
|
||||
<pathelement location="${test.conf}"/>
|
||||
<fileset dir="${test.lib}">
|
||||
<include name="**/*.jar" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
<arg value="${test.distributed.upgrade.listfile}"/>
|
||||
<arg value="${test.distributed.upgrade.package}"/>
|
||||
</java>
|
||||
</target>
|
||||
|
||||
<target name="test-jvm-upgrade-dtest-forking" depends="list-jvm-upgrade-dtests" description="Execute In-JVM 'distributed' upgrade tests" >
|
||||
<chmod file="${test.distributed.upgrade.listfile}" perm="+x"/>
|
||||
<exec executable="./${test.distributed.upgrade.listfile}" failonerror="true"/>
|
||||
<delete file="${test.distributed.upgrade.listfile}"/>
|
||||
</target>
|
||||
|
||||
<target name="test-jvm-upgrade-dtest" depends="build-test" description="Execute in-jvm dtests">
|
||||
<testmacro inputdir="${test.distributed.src}" timeout="${test.distributed.timeout}" forkmode="once" showoutput="true" filter="**/upgrade/*Test.java">
|
||||
<jvmarg value="-Dlogback.configurationFile=test/conf/logback-dtest.xml"/>
|
||||
|
|
|
|||
|
|
@ -1,99 +0,0 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.cassandra.distributed.test;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class TestLocator
|
||||
{
|
||||
private static final String defaultOutputFileName = "run-jvm-dtests";
|
||||
private static final String testPackage = "org.apache.cassandra.distributed.test";
|
||||
private static final String testCommandFormat = "ant testsome -Dtest.name=%s -Dtest.methods=%s";
|
||||
|
||||
public static void main(String[] args) throws Throwable
|
||||
{
|
||||
String outputFileName = defaultOutputFileName;
|
||||
if (args.length >= 1)
|
||||
{
|
||||
outputFileName = args[0];
|
||||
}
|
||||
String testPackage = TestLocator.testPackage;
|
||||
if (args.length == 2)
|
||||
testPackage = args[1];
|
||||
try (FileWriter fileWriter = new FileWriter(outputFileName);
|
||||
PrintWriter printWriter = new PrintWriter(fileWriter))
|
||||
{
|
||||
printWriter.println("#!/bin/bash");
|
||||
printWriter.println("ret=0");
|
||||
for (Class testClass : locateClasses(testPackage))
|
||||
{
|
||||
for (Method method : testClass.getMethods())
|
||||
{
|
||||
if (method.getAnnotation(Test.class) == null)
|
||||
continue;
|
||||
|
||||
printWriter.println(String.format(testCommandFormat,
|
||||
testClass.getName(),
|
||||
method.getName()));
|
||||
printWriter.println("if [ $? -ne 0 ]; then ret=1; fi");
|
||||
}
|
||||
}
|
||||
printWriter.println("exit $ret");
|
||||
}
|
||||
}
|
||||
|
||||
private static List<Class> locateClasses(String packageName) throws ClassNotFoundException, IOException
|
||||
{
|
||||
ClassLoader classLoader = TestLocator.class.getClassLoader();
|
||||
|
||||
Enumeration<URL> resources = classLoader.getResources(packageName.replace('.', '/'));
|
||||
List<Class> classes = new ArrayList<>();
|
||||
while (resources.hasMoreElements())
|
||||
{
|
||||
URL resource = resources.nextElement();
|
||||
loadClassesRecursively(new File(resource.getFile()), packageName, classes);
|
||||
}
|
||||
|
||||
return classes;
|
||||
}
|
||||
|
||||
|
||||
private static void loadClassesRecursively(File directory, String packageName, List<Class> classes) throws ClassNotFoundException
|
||||
{
|
||||
for (File file : directory.listFiles())
|
||||
{
|
||||
if (file.isDirectory())
|
||||
loadClassesRecursively(file, packageName + "." + file.getName(), classes);
|
||||
else if (file.getName().endsWith(".class"))
|
||||
{
|
||||
classes.add(Class.forName(packageName + '.' + file.getName().substring(0, file.getName().length() - 6)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue