introduce HardwareAgentRequired annotation

that allows to move most of performance tests into AWS and keep some of them on hardware agents
This commit is contained in:
sergey.ignatov
2018-12-20 20:46:16 +03:00
parent 41d7315302
commit d007b08a2f
3 changed files with 25 additions and 2 deletions
@@ -33,6 +33,7 @@ import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.ide.GeneralSettings;
import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.idea.HardwareAgentRequired;
import com.intellij.javaee.ExternalResourceManagerExImpl;
import com.intellij.lang.*;
import com.intellij.lang.annotation.AnnotationHolder;
@@ -127,6 +128,7 @@ import java.util.concurrent.atomic.AtomicReference;
* @author cdr
*/
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
@HardwareAgentRequired
@SkipSlowTestLocally
public class DaemonRespondToChangesTest extends DaemonAnalyzerTestCase {
private static final String BASE_PATH = "/codeInsight/daemonCodeAnalyzer/typing/";
@@ -3,6 +3,7 @@ package com.intellij;
import com.intellij.idea.Bombed;
import com.intellij.idea.ExcludeFromTestDiscovery;
import com.intellij.idea.HardwareAgentRequired;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.testFramework.RunFirst;
@@ -33,12 +34,14 @@ public class TestCaseLoader {
public static final String RUN_ONLY_AFFECTED_TEST_FLAG = "idea.run.only.affected.tests";
public static final String TEST_RUNNERS_COUNT_FLAG = "idea.test.runners.count";
public static final String TEST_RUNNER_INDEX_FLAG = "idea.test.runner.index";
public static final String HARDWARE_AGENT_REQUIRED_FLAG = "idea.hardware.agent.required";
private static final boolean PERFORMANCE_TESTS_ONLY = "true".equals(System.getProperty(PERFORMANCE_TESTS_ONLY_FLAG));
private static final boolean INCLUDE_PERFORMANCE_TESTS = "true".equals(System.getProperty(INCLUDE_PERFORMANCE_TESTS_FLAG));
private static final boolean INCLUDE_UNCONVENTIONALLY_NAMED_TESTS = "true".equals(System.getProperty(INCLUDE_UNCONVENTIONALLY_NAMED_TESTS_FLAG));
private static final boolean RUN_ONLY_AFFECTED_TESTS = "true".equals(System.getProperty(RUN_ONLY_AFFECTED_TEST_FLAG));
private static final boolean RUN_WITH_TEST_DISCOVERY = System.getProperty("test.discovery.listener") != null;
private static final boolean HARDWARE_AGENT_REQUIRED = "true".equals(System.getProperty(HARDWARE_AGENT_REQUIRED_FLAG));
private static final int TEST_RUNNERS_COUNT = Integer.valueOf(System.getProperty(TEST_RUNNERS_COUNT_FLAG, "1"));
private static final int TEST_RUNNER_INDEX = Integer.valueOf(System.getProperty(TEST_RUNNER_INDEX_FLAG, "0"));
@@ -161,9 +164,15 @@ public class TestCaseLoader {
myLastTestClass = aClass;
}
private boolean shouldAddTestCase(final Class<?> testCaseClass, String moduleName, boolean testForExcluded) {
private boolean shouldAddTestCase(Class<?> testCaseClass, String moduleName, boolean checkForExclusion) {
if ((testCaseClass.getModifiers() & Modifier.ABSTRACT) != 0) return false;
if (testForExcluded && shouldExcludeTestClass(moduleName, testCaseClass)) return false;
if (checkForExclusion) {
if (shouldExcludeTestClass(moduleName, testCaseClass)) return false;
boolean isHardwareAgentRequired = getAnnotationInHierarchy(testCaseClass, HardwareAgentRequired.class) != null;
if (isHardwareAgentRequired != HARDWARE_AGENT_REQUIRED) return false;
}
if (TestCase.class.isAssignableFrom(testCaseClass) || TestSuite.class.isAssignableFrom(testCaseClass)) {
return true;
@@ -0,0 +1,12 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.idea;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface HardwareAgentRequired {
}