Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Khouzam2012-05-17 14:59:56 -0400
committerMarc Khouzam2012-05-17 17:41:23 -0400
commitbee707ec10175c086f859940b8af5b83efd22b02 (patch)
treedc5db68c32e203dea878bf88b365781ee9d5ae07 /dsf-gdb
parent6d3706eaf26c7aa4eb0f5dbb222529cf2f315652 (diff)
downloadorg.eclipse.cdt-bee707ec10175c086f859940b8af5b83efd22b02.tar.gz
org.eclipse.cdt-bee707ec10175c086f859940b8af5b83efd22b02.tar.xz
org.eclipse.cdt-bee707ec10175c086f859940b8af5b83efd22b02.zip
Bug 379841: [tests] Add a timeout for each JUnit test
Change-Id: Icb33e03f91404650457a103246d3276e157c64d4 Reviewed-on: https://git.eclipse.org/r/6017 Reviewed-by: Marc Khouzam <marc.khouzam@ericsson.com> IP-Clean: Marc Khouzam <marc.khouzam@ericsson.com> Tested-by: Marc Khouzam <marc.khouzam@ericsson.com>
Diffstat (limited to 'dsf-gdb')
-rw-r--r--dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
index 94c5d2dece..fc56430565 100644
--- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
+++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/framework/BaseTestCase.java
@@ -42,6 +42,8 @@ import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.junit.rules.TestRule;
+import org.junit.rules.Timeout;
/**
* This is the base class for the GDB/MI Unit tests.
@@ -52,10 +54,15 @@ import org.junit.rules.TestName;
* code is to be run.
*/
public class BaseTestCase {
+ // Timeout value for each individual test
+ private final static int TEST_TIMEOUT = 5 * 60 * 1000; // 5 minutes in milliseconds
// Make the current test naem available through testName.getMethodName()
@Rule public TestName testName = new TestName();
+ // Add a timeout for each test, to make sure no test hangs
+ @Rule public TestRule timeout = new Timeout(TEST_TIMEOUT);
+
public static final String ATTR_DEBUG_SERVER_NAME = TestsPlugin.PLUGIN_ID + ".DEBUG_SERVER_NAME";
private static final String DEFAULT_TEST_APP = "data/launch/bin/GDBMIGenericTestApp.exe";

Back to the top