Remove ant targets list-jvm-dtests and ant list-jvm-upgrade-dtests

patch by Mick Semb Wever; reviewed by Alex Petrov for CASSANDRA-16519
This commit is contained in:
Mick Semb Wever 2021-03-15 12:22:09 +01:00
parent a7b71eb63e
commit 730e89e229
No known key found for this signature in database
GPG Key ID: E91335D77E3E87CB
3 changed files with 1 additions and 115 deletions

View File

@ -1,4 +1,5 @@
2.2.20
* 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)
* Remove OpenJDK log warning (CASSANDRA-15563)

View File

@ -67,7 +67,6 @@
<property name="test.microbench.src" value="${test.dir}/microbench"/>
<property name="test.pig.src" value="${test.dir}/pig"/>
<property name="test.distributed.src" value="${test.dir}/distributed"/>
<property name="test.distributed.listfile" value = "ant-jvm-dtest-list"/>
<property name="dist.dir" value="${build.dir}/dist"/>
<property name="tmp.dir" value="${java.io.tmpdir}"/>
@ -1868,27 +1867,6 @@
</testmacro>
</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"/>

View File

@ -1,93 +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];
}
try (FileWriter fileWriter = new FileWriter(outputFileName);
PrintWriter printWriter = new PrintWriter(fileWriter))
{
printWriter.println("#!/bin/bash");
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()));
}
}
}
}
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)));
}
}
}
}