diff --git a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/DaemonRespondToChangesTest.java b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/DaemonRespondToChangesTest.java index d39b18bf704c..a7171b2eb751 100644 --- a/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/DaemonRespondToChangesTest.java +++ b/java/java-tests/testSrc/com/intellij/java/codeInsight/daemon/impl/DaemonRespondToChangesTest.java @@ -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/"; diff --git a/platform/testFramework/core/src/com/intellij/TestCaseLoader.java b/platform/testFramework/core/src/com/intellij/TestCaseLoader.java index 9ec37b026e1d..6176a7b23539 100644 --- a/platform/testFramework/core/src/com/intellij/TestCaseLoader.java +++ b/platform/testFramework/core/src/com/intellij/TestCaseLoader.java @@ -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; diff --git a/platform/testFramework/core/src/com/intellij/idea/HardwareAgentRequired.java b/platform/testFramework/core/src/com/intellij/idea/HardwareAgentRequired.java new file mode 100644 index 000000000000..2686e90da105 --- /dev/null +++ b/platform/testFramework/core/src/com/intellij/idea/HardwareAgentRequired.java @@ -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 { +} \ No newline at end of file