mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 20:05:35 +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:
parent
6d3706eaf2
commit
bee707ec10
1 changed files with 7 additions and 0 deletions
|
@ -42,6 +42,8 @@ import org.junit.Assert;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.rules.TestName;
|
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.
|
* 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.
|
* code is to be run.
|
||||||
*/
|
*/
|
||||||
public class BaseTestCase {
|
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()
|
// Make the current test naem available through testName.getMethodName()
|
||||||
@Rule public TestName testName = new TestName();
|
@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";
|
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";
|
private static final String DEFAULT_TEST_APP = "data/launch/bin/GDBMIGenericTestApp.exe";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue