diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/AllTests.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/AllTests.java deleted file mode 100644 index 0d51eec8757..00000000000 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/AllTests.java +++ /dev/null @@ -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 {} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Suite_Sessionless_Tests.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Suite_Sessionless_Tests.java new file mode 100644 index 00000000000..570260c12bf --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/Suite_Sessionless_Tests.java @@ -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. +} diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OnceOnlySuite.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OnceOnlySuite.java new file mode 100644 index 00000000000..eded8ba7b26 --- /dev/null +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/OnceOnlySuite.java @@ -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. + * + *

+ * Thanks to Bill Venners and David Saff for suggesting this solution on the + * junit mailing list. See http://tech.groups.yahoo.com/group/junit/message/23208 + */ +@SuppressWarnings("restriction") +public class OnceOnlySuite extends Suite { + private static Set> alreadySeen = new HashSet>(); + + 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); + } + }); + } +} \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java index 8db5caa03f8..9761d8b2e27 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_6_6.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java index 0de74bf1aea..71b3d04343b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_6/Suite_Remote_6_6.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java index e7c96e7bf22..c6841c6e076 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_6_7.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java index 1d440675779..2ec129981b2 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_7/Suite_Remote_6_7.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java index 0fbdbdac20d..20e567f6c44 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_6_8.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java index d48e97f4d74..1049657b74b 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_6_8/Suite_Remote_6_8.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java index 811a46749a5..e42d3343f26 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_7_0.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java index 96f04236019..0c77abc4257 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_0/Suite_Remote_7_0.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java index d9f74e54bdb..c1265023fef 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_7_1.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java index 2124dda48f4..d766ec427a8 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_1/Suite_Remote_7_1.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java index 12d9a7b6506..34c0bc4ca2c 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_7_2.java @@ -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 */ }) diff --git a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java index b79c3828fa9..90f96a9cd78 100644 --- a/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java +++ b/dsf-gdb/org.eclipse.cdt.tests.dsf.gdb/src/org/eclipse/cdt/tests/dsf/gdb/tests/tests_7_2/Suite_Remote_7_2.java @@ -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 */ })