1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 335643: Session-less tests should be exercised as part of every suite

This commit is contained in:
John Cortell 2011-01-28 02:03:46 +00:00
parent 514a13bad4
commit c1b4709436
15 changed files with 115 additions and 42 deletions

View file

@ -1,30 +0,0 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Ericsson 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:
* Ericsson - Initial Implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/*
* This class is meant to be empty. It enables us to define
* the annotations which list all the different JUnit class we
* want to run. When creating a new test class, it should be
* added to the list below.
*/
@RunWith(Suite.class)
@Suite.SuiteClasses({
TestMIBreakInsertCommand.class,
TestMICommandConstructCommand.class
/* Add your test class here */
})
public class AllTests {}

View file

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2008, 2009 Ericsson 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:
* Ericsson - Initial Implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.mi.service.command.output.MIThreadTests;
import org.eclipse.cdt.tests.dsf.gdb.tests.OnceOnlySuite;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
/**
* This suite executes all test classes that don't involve a debug session. As
* such, these tests need to run just once, and not once for each GDB version we
* support, not to mention remote vs local. We avoid lots of redundant runs by
* running these tests with our special runner (OnceOnlySuite)
*/
@RunWith(OnceOnlySuite.class)
@Suite.SuiteClasses({
TestMIBreakInsertCommand.class,
TestMICommandConstructCommand.class,
MIThreadTests.class
/* Add your test class here */
})
public class Suite_Sessionless_Tests {
// This class is meant to be empty. It enables us to define the annotations
// which list all the different JUnit class we want to run. When creating a
// new test class, it should be added to the list above.
}

View file

@ -0,0 +1,44 @@
package org.eclipse.cdt.tests.dsf.gdb.tests;
import java.util.HashSet;
import java.util.Set;
import org.junit.internal.builders.IgnoredClassRunner;
import org.junit.runner.Runner;
import org.junit.runners.Suite;
import org.junit.runners.model.InitializationError;
import org.junit.runners.model.RunnerBuilder;
/**
* This custom suite runner ensures that a class runs only once, no matter how
* many times it appears in a suite. Redundant appearances are possible with
* hierarchical suites. In some cases, this is intentional and desirable--i.e.,
* we want the same class to run multiple times (usually with some slight
* variation). However, in some cases, the redundant appearances are
* unintentional and unavoidable consequences of how the suites are defined and
* used. This runner caters to the latter scenario.
*
* <p>
* Thanks to Bill Venners and David Saff for suggesting this solution on the
* junit mailing list. See <a
* href="http://tech.groups.yahoo.com/group/junit/message/23208"
* >http://tech.groups.yahoo.com/group/junit/message/23208</a>
*/
@SuppressWarnings("restriction")
public class OnceOnlySuite extends Suite {
private static Set<Class<?>> alreadySeen = new HashSet<Class<?>>();
public OnceOnlySuite(Class<?> testClass, final RunnerBuilder builder) throws InitializationError {
super(testClass, new RunnerBuilder() {
@Override
public Runner runnerForClass(Class<?> testClass) throws Throwable {
if (alreadySeen.contains(testClass)) {
return new IgnoredClassRunner(testClass);
}
alreadySeen.add(testClass);
return builder.runnerForClass(testClass);
}
});
}
}

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_6.class,
MICatchpointsTest_6_6.class,
MIDisassemblyTest_6_6.class,
GDBProcessesTest_6_6.class
GDBProcessesTest_6_6.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_6;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -36,7 +37,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_6.class,
MICatchpointsTest_6_6.class,
MIDisassemblyTest_6_6.class,
GDBProcessesTest_6_6.class
GDBProcessesTest_6_6.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_7.class,
MICatchpointsTest_6_7.class,
MIDisassemblyTest_6_7.class,
GDBProcessesTest_6_7.class
GDBProcessesTest_6_7.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_7;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -36,7 +37,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_7.class,
MICatchpointsTest_6_7.class,
MIDisassemblyTest_6_7.class,
GDBProcessesTest_6_7.class
GDBProcessesTest_6_7.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_8.class,
MICatchpointsTest_6_8.class,
MIDisassemblyTest_6_8.class,
GDBProcessesTest_6_8.class
GDBProcessesTest_6_8.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_6_8;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -36,7 +37,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_6_8.class,
MICatchpointsTest_6_8.class,
MIDisassemblyTest_6_8.class,
GDBProcessesTest_6_8.class
GDBProcessesTest_6_8.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_0.class,
MICatchpointsTest_7_0.class,
MIDisassemblyTest_7_0.class,
GDBProcessesTest_7_0.class
GDBProcessesTest_7_0.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_0;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -37,7 +38,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_0.class,
MICatchpointsTest_7_0.class,
MIDisassemblyTest_7_0.class,
GDBProcessesTest_7_0.class
GDBProcessesTest_7_0.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_1.class,
MICatchpointsTest_7_1.class,
MIDisassemblyTest_7_1.class,
GDBProcessesTest_7_1.class
GDBProcessesTest_7_1.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_1;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -37,7 +38,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_1.class,
MICatchpointsTest_7_1.class,
MIDisassemblyTest_7_1.class,
GDBProcessesTest_7_1.class
GDBProcessesTest_7_1.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@ -32,7 +33,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_2.class,
MICatchpointsTest_7_2.class,
MIDisassemblyTest_7_2.class,
GDBProcessesTest_7_2.class
GDBProcessesTest_7_2.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.tests.dsf.gdb.tests.tests_7_2;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.mi.service.command.commands.Suite_Sessionless_Tests;
import org.eclipse.cdt.tests.dsf.gdb.framework.BaseTestCase;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@ -37,7 +38,8 @@ import org.junit.runners.Suite;
MIBreakpointsTest_7_2.class,
MICatchpointsTest_7_2.class,
MIDisassemblyTest_7_2.class,
GDBProcessesTest_7_2.class
GDBProcessesTest_7_2.class,
Suite_Sessionless_Tests.class
/* Add your test class here */
})