1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-01 14:15:23 +02:00

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>
This commit is contained in:
Marc Khouzam 2012-05-17 14:59:56 -04:00
parent 6d3706eaf2
commit bee707ec10

View file

@ -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";