From 76c4c117c4365123cd5cd4ad7c99a1a3826c20ac Mon Sep 17 00:00:00 2001 From: Alena Laskavaia Date: Tue, 15 Mar 2016 14:32:01 -0400 Subject: [PATCH] adding repeater to some intermittent tests Change-Id: Idd1610e9c753951a974e336a65441b752e667e00 --- ...mittentRule.java => IntermittentRule.java} | 30 ++++++++++++++----- .../GDBMultiNonStopRunControlTest_7_0.java | 6 ++++ 2 files changed, 29 insertions(+), 7 deletions(-) rename dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/{InterimittentRule.java => IntermittentRule.java} (75%) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/InterimittentRule.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/IntermittentRule.java similarity index 75% rename from dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/InterimittentRule.java rename to dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/IntermittentRule.java index 5db48656ba9..9c7d23d8ba2 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/InterimittentRule.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/IntermittentRule.java @@ -16,18 +16,34 @@ import org.junit.runners.model.Statement; /** * This is the rule to add to tests that rarely fail randomly and you want to keep them but cannot figure out they fail. - * It is safe to use it in any class, it will only apply to tests which have @InterimittentRule annotation - * + * It is safe to use it in any class, it will only apply to tests which have @Intermittent annotation + + import org.eclipse.cdt.tests.dsf.gdb.framework.Intermittent + import org.eclipse.cdt.tests.dsf.gdb.framework.IntermittentRule - public @Rule InterimittentRule rule = new InterimittentRule(); + class SomeTest { + public @Rule IntermittentRule rule = new IntermittentRule(); @Test - @InterimittentRule(repetition = 3) - public void someTest (){} + @Intermittent(repetition = 3) + public void someTest (){...} + } + - * + You can also ally this to the whole class + + import org.eclipse.cdt.tests.dsf.gdb.framework.Intermittent + import org.eclipse.cdt.tests.dsf.gdb.framework.IntermittentRule + + @Intermittent(repetition = 3) + class SomeTest { + public @Rule IntermittentRule rule = new IntermittentRule(); + ... + } + + */ -public class InterimittentRule implements MethodRule { +public class IntermittentRule implements MethodRule { public static class RunIntermittent extends Statement { private final FrameworkMethod method; private final Statement statement; diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBMultiNonStopRunControlTest_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBMultiNonStopRunControlTest_7_0.java index 80fcce925fe..5439979bc52 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBMultiNonStopRunControlTest_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/GDBMultiNonStopRunControlTest_7_0.java @@ -34,12 +34,15 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker; import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase; +import org.eclipse.cdt.tests.dsf.gdb.framework.Intermittent; +import org.eclipse.cdt.tests.dsf.gdb.framework.IntermittentRule; import org.eclipse.cdt.tests.dsf.gdb.framework.ServiceEventWaitor; import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; import org.eclipse.cdt.tests.dsf.gdb.launching.TestsPlugin; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; import org.junit.Assume; import org.junit.BeforeClass; +import org.junit.Rule; import org.junit.Test; import org.junit.runner.RunWith; @@ -48,7 +51,10 @@ import org.junit.runner.RunWith; * Tests IMultiRunControl class for Non-stop multi-threaded application. */ @RunWith(BackgroundRunner.class) +@Intermittent public class GDBMultiNonStopRunControlTest_7_0 extends BaseTestCase { + public @Rule IntermittentRule irule = new IntermittentRule(); + @Override protected void setGdbVersion() { setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0);