diff options
| author | Satyam Kandula | 2012-01-10 17:22:20 +0000 |
|---|---|---|
| committer | Mike Rennie | 2012-01-10 17:22:20 +0000 |
| commit | b2694a05a04919831e643d14e3d2e9b68d280994 (patch) | |
| tree | bb19b1fd4a182913a6c9abad987ab8c5ceb765be | |
| parent | dc3d8469d83ecaa53f85d5b06dec8fbd086500e2 (diff) | |
| download | eclipse.platform-b2694a05a04919831e643d14e3d2e9b68d280994.tar.gz eclipse.platform-b2694a05a04919831e643d14e3d2e9b68d280994.tar.xz eclipse.platform-b2694a05a04919831e643d14e3d2e9b68d280994.zip | |
Bug 366493 - SteppingTests.testStepOverAntCallSepVM fails on Macv20120110-1722
3 files changed, 91 insertions, 13 deletions
diff --git a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java index 364d5c5d7..07b2ac8c2 100644 --- a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java +++ b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/AbstractAntDebugTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -170,7 +170,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { } } setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend, launch terminated.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend, launch terminated"); + } return suspendee; } @@ -389,7 +391,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread)suspendee; } @@ -409,7 +413,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } assertTrue("suspendee was not an AntThread", suspendee instanceof AntThread); AntThread thread = (AntThread) suspendee; IBreakpoint hit = getBreakpoint(thread); @@ -579,7 +585,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -598,7 +606,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -615,7 +625,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -632,7 +644,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -658,7 +672,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -684,7 +700,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -710,7 +728,9 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { Object suspendee= waiter.waitForEvent(); setEventSet(waiter.getEventSet()); - assertNotNull("Program did not suspend.", suspendee); + if (suspendee == null) { + throw new TestAgainException("Retest - Program did not suspend"); + } return (AntThread) suspendee; } @@ -744,6 +764,28 @@ public abstract class AbstractAntDebugTest extends AbstractAntUIBuildTest { debugUIPreferences.setValue(IDebugUIConstants.PREF_ACTIVATE_WORKBENCH, activate); } + /** + * When a test throws the 'try again' exception, try it again. + * @see junit.framework.TestCase#runBare() + */ + public void runBare() throws Throwable { + boolean tryAgain = true; + int attempts = 0; + while (tryAgain) { + try { + attempts++; + super.runBare(); + tryAgain = false; + } catch (TestAgainException e) { + System.err.println("Test failed attempt " + attempts + ". Re-testing: " + this.getName()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + e.printStackTrace(); + if (attempts > 5) { + tryAgain = false; + } + } + } + } + /* (non-Javadoc) * @see junit.framework.TestCase#tearDown() */ diff --git a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java index c8b826cc7..1086f4377 100644 --- a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java +++ b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/RunToLineTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2009 IBM Corporation and others. + * Copyright (c) 2005, 2012 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -202,7 +202,9 @@ public class RunToLineTests extends AbstractAntDebugTest { DebugElementEventWaiter waiter = new DebugElementEventWaiter(DebugEvent.SUSPEND, thread); DebugUIPlugin.getStandardDisplay().syncExec(r); Object event = waiter.waitForEvent(); - assertNotNull("no suspend event was recieved", event); + if (event == null) { + throw new TestAgainException("Retest - no suspend event was recieved"); + } IStackFrame topStackFrame = thread.getTopStackFrame(); assertNotNull("There must be a top stack frame", topStackFrame); assertEquals("wrong line", expectedLineNumber, topStackFrame.getLineNumber()); diff --git a/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/TestAgainException.java b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/TestAgainException.java new file mode 100644 index 000000000..925aeb0c0 --- /dev/null +++ b/ant/org.eclipse.ant.tests.ui/Ant Debug Tests/org/eclipse/ant/tests/ui/debug/TestAgainException.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2012 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.ant.tests.ui.debug; + +/** + * Exception to indicate a test should be run again when it fails. + * + * @since 3.8 + */ +public class TestAgainException extends RuntimeException { + + /** + * Generated serial version id + */ + private static final long serialVersionUID = -7743450644051812955L; + + /** + * Constructor + * @param string + */ + public TestAgainException(String string) { + super(string); + } + + +}
\ No newline at end of file |
