Ability to filter community tests from ultimate tests run

This commit is contained in:
Maxim Shafirov
2011-12-13 21:02:43 +04:00
parent b7d1862521
commit eedbc056fd
3 changed files with 22 additions and 1 deletions
@@ -60,6 +60,16 @@ public class ExternalClasspathClassLoader extends URLClassLoader {
final String classPathFilePath = System.getProperty("classpath.file");
return classPathFilePath != null ? parseUrls(classPathFilePath) : null;
}
public static String[] getExcludeRoots() {
try {
final String classPathFilePath = System.getProperty("exclude.tests.roots.file");
return classPathFilePath != null ? parseUrls(classPathFilePath) : null;
}
catch (Exception e) {
return new String[0];
}
}
public static void install() {
try {
@@ -25,6 +25,7 @@
package com.intellij;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.testFramework.*;
@@ -43,7 +44,9 @@ import java.lang.reflect.Modifier;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Arrays;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@SuppressWarnings({"HardCodedStringLiteral", "CallToPrintStackTrace", "UseOfSystemOutOrSystemErr"})
public class TestAll implements Test {
@@ -356,8 +359,15 @@ public class TestAll implements Test {
System.out.println("Collecting tests from roots specified by test.roots property: " + testRoots);
return testRoots.split(";");
}
final String[] roots = ExternalClasspathClassLoader.getRoots();
String[] roots = ExternalClasspathClassLoader.getRoots();
if (roots != null) {
if (Comparing.equal(System.getProperty(TestCaseLoader.SKIP_COMMUNITY_TESTS), "true")) {
System.out.println("Skipping community tests");
Set<String> set = new LinkedHashSet<String>(Arrays.asList(roots));
set.removeAll(Arrays.asList(ExternalClasspathClassLoader.getExcludeRoots()));
roots = set.toArray(new String[set.size()]);
}
System.out.println("Collecting tests from roots specified by classpath.file property: " + Arrays.toString(roots));
return roots;
}
@@ -47,6 +47,7 @@ public class TestCaseLoader {
private static final String TARGET_TEST_PATTERNS = "idea.test.patterns";
public static final String PERFORMANCE_TESTS_ONLY_FLAG = "idea.performance.tests";
public static final String SKIP_COMMUNITY_TESTS = "idea.skip.community.tests";
private final List<Class> myClassList = new ArrayList<Class>();
private Class myFirstTestClass;