1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

adding repeater to some intermittent tests

Change-Id: Idd1610e9c753951a974e336a65441b752e667e00
This commit is contained in:
Alena Laskavaia 2016-03-15 14:32:01 -04:00 committed by Marc Khouzam
parent 9fcf731caa
commit 76c4c117c4
2 changed files with 29 additions and 7 deletions

View file

@ -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. * 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
* <code> <code>
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 @Test
@InterimittentRule(repetition = 3) @Intermittent(repetition = 3)
public void someTest (){} public void someTest (){...}
}
</code>
* </code> You can also ally this to the whole class
<code>
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();
...
}
</code>
*/ */
public class InterimittentRule implements MethodRule { public class IntermittentRule implements MethodRule {
public static class RunIntermittent extends Statement { public static class RunIntermittent extends Statement {
private final FrameworkMethod method; private final FrameworkMethod method;
private final Statement statement; private final Statement statement;

View file

@ -34,12 +34,15 @@ import org.eclipse.cdt.dsf.service.DsfServicesTracker;
import org.eclipse.cdt.dsf.service.DsfSession; import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.tests.dsf.gdb.framework.BackgroundRunner; 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.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.ServiceEventWaitor;
import org.eclipse.cdt.tests.dsf.gdb.framework.SyncUtil; 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.launching.TestsPlugin;
import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants; import org.eclipse.cdt.tests.dsf.gdb.tests.ITestConstants;
import org.junit.Assume; import org.junit.Assume;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
@ -48,7 +51,10 @@ import org.junit.runner.RunWith;
* Tests IMultiRunControl class for Non-stop multi-threaded application. * Tests IMultiRunControl class for Non-stop multi-threaded application.
*/ */
@RunWith(BackgroundRunner.class) @RunWith(BackgroundRunner.class)
@Intermittent
public class GDBMultiNonStopRunControlTest_7_0 extends BaseTestCase { public class GDBMultiNonStopRunControlTest_7_0 extends BaseTestCase {
public @Rule IntermittentRule irule = new IntermittentRule();
@Override @Override
protected void setGdbVersion() { protected void setGdbVersion() {
setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0); setGdbProgramNamesLaunchAttributes(ITestConstants.SUFFIX_GDB_7_0);