diff options
author | Roland Grunberg | 2012-10-22 18:34:58 +0000 |
---|---|---|
committer | Camilo Bernal | 2012-10-23 16:55:13 +0000 |
commit | 09f4be0ffd863460c156c03bb8d2c4e4b9b0e99c (patch) | |
tree | 6a46a4a968194901e757a201e90adb406fc613c5 /perf/org.eclipse.linuxtools.perf.tests | |
parent | 07d364b7901fcde69263defa9a091dced84a0314 (diff) | |
download | org.eclipse.linuxtools-09f4be0ffd863460c156c03bb8d2c4e4b9b0e99c.tar.gz org.eclipse.linuxtools-09f4be0ffd863460c156c03bb8d2c4e4b9b0e99c.tar.xz org.eclipse.linuxtools-09f4be0ffd863460c156c03bb8d2c4e4b9b0e99c.zip |
Move perf test cases that perform a launch into separate test class.
Test cases that require the perf underlying tool to be present should
not be executed on the build server, but should run by default.
Change-Id: I129545db7b225e140bfd41959569a00a7e80df04
Reviewed-on: https://git.eclipse.org/r/8335
Tested-by: Hudson CI
Reviewed-by: Camilo Bernal <cabernal@redhat.com>
IP-Clean: Camilo Bernal <cabernal@redhat.com>
Tested-by: Camilo Bernal <cabernal@redhat.com>
Diffstat (limited to 'perf/org.eclipse.linuxtools.perf.tests')
4 files changed, 138 insertions, 44 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.tests/pom.xml b/perf/org.eclipse.linuxtools.perf.tests/pom.xml index 107796853a..55dcd4593a 100644 --- a/perf/org.eclipse.linuxtools.perf.tests/pom.xml +++ b/perf/org.eclipse.linuxtools.perf.tests/pom.xml @@ -24,19 +24,16 @@ <name>Linux Tools Perf Tests Plug-in</name> <build> - <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> - <resources> - <resource> - <directory>src</directory> - <excludes> - <exclude>**/*.java</exclude> - </excludes> - </resource> - </resources> <plugins> <plugin> <groupId>org.eclipse.tycho</groupId> - <artifactId>tycho-source-plugin</artifactId> + <artifactId>tycho-surefire-plugin</artifactId> + <configuration> + <useUIHarness>true</useUIHarness> + <useUIThread>true</useUIThread> + <testSuite>org.eclipse.linuxtools.perf.tests</testSuite> + <testClass>org.eclipse.linuxtools.internal.perf.tests.AllPerfTests</testClass> + </configuration> </plugin> </plugins> </build> diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/AllPerfTests.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/AllPerfTests.java new file mode 100644 index 0000000000..771021ce36 --- /dev/null +++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/AllPerfTests.java @@ -0,0 +1,41 @@ +/******************************************************************************* +* Copyright (c) 2012 Red Hat, Inc. +* 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: +* Red Hat, Inc. - initial API and implementation +*******************************************************************************/ +package org.eclipse.linuxtools.internal.perf.tests; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class AllPerfTests { + + public static Test suite() { + /** + * Java system properties. usage: + * -Dorg.eclipse.linuxtools.perf.tests.runPerf=<yes|no> + * [default: yes] if yes, will run the launch tests no, will skip the + * launch tests (they all require perf to be installed) + */ + String SYSTEM_PROPERTY_RUN_PERF = "org.eclipse.linuxtools.perf.tests.runPerf"; //$NON-NLS-1$ + boolean RUN_PERF = System + .getProperty(SYSTEM_PROPERTY_RUN_PERF, "yes").equals("yes"); //$NON-NLS-1$ //$NON-NLS-2$ + TestSuite suite = new TestSuite( + "Test for org.eclipse.linuxtools.perf.tests"); //$NON-NLS-1$ + + suite.addTestSuite(LaunchTabsTest.class); + suite.addTestSuite(ModelTest.class); + + if (RUN_PERF) { + suite.addTestSuite(LaunchTest.class); + } + + return suite; + } + +} diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java new file mode 100644 index 0000000000..004d39ebf5 --- /dev/null +++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/LaunchTest.java @@ -0,0 +1,90 @@ +/******************************************************************************* +* Copyright (c) 2012 Red Hat, Inc. +* 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: +* Red Hat, Inc. - initial API and implementation +*******************************************************************************/ +package org.eclipse.linuxtools.internal.perf.tests; + +import java.util.ArrayList; +import java.util.Arrays; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.Launch; +import org.eclipse.linuxtools.internal.perf.PerfPlugin; +import org.eclipse.linuxtools.internal.perf.launch.PerfEventsTab; +import org.eclipse.linuxtools.internal.perf.launch.PerfLaunchConfigDelegate; +import org.eclipse.linuxtools.internal.perf.launch.PerfOptionsTab; +import org.eclipse.linuxtools.profiling.tests.AbstractTest; +import org.osgi.framework.FrameworkUtil; + +public class LaunchTest extends AbstractTest { + + protected ILaunchConfiguration config; + protected PerfLaunchConfigDelegate delegate; + protected ILaunch launch; + protected ILaunchConfigurationWorkingCopy wc; + + @Override + protected void setUp() throws Exception { + super.setUp(); + proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest"); //$NON-NLS-1$ + config = createConfiguration(proj.getProject()); + + delegate = new PerfLaunchConfigDelegate(); + launch = new Launch(config, ILaunchManager.PROFILE_MODE, null); + wc = config.getWorkingCopy(); + setProfileAttributes(wc); + } + + @Override + protected void tearDown() throws Exception { + deleteProject(proj); + wc.delete(); + super.tearDown(); + } + + @Override + protected ILaunchConfigurationType getLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType(PerfPlugin.LAUNCHCONF_ID); + } + + @Override + protected void setProfileAttributes(ILaunchConfigurationWorkingCopy wc) { + PerfEventsTab eventsTab = new PerfEventsTab(); + PerfOptionsTab optionsTab = new PerfOptionsTab(); + wc.setAttribute(PerfPlugin.ATTR_SourceLineNumbers, false); + eventsTab.setDefaults(wc); + optionsTab.setDefaults(wc); + } + + public void testDefaultRun () { + try { + delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); + } catch (CoreException e) { + fail(); + } + } + + public void testClockEventRun () { + try { + ArrayList<String> list = new ArrayList<String>(); + list.addAll(Arrays.asList(new String [] {"cpu-clock", "task-clock", "cycles"})); + wc.setAttribute(PerfPlugin.ATTR_DefaultEvent, false); + wc.setAttribute(PerfPlugin.ATTR_SelectedEvents, list); + delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); + } catch (CoreException e) { + fail(); + } + } + +} diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java index f144f827a0..5c60cc821a 100644 --- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java +++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/ModelTest.java @@ -18,17 +18,12 @@ import java.util.Arrays; import java.util.List; import java.util.Stack; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.Launch; import org.eclipse.linuxtools.internal.perf.PerfCore; import org.eclipse.linuxtools.internal.perf.PerfPlugin; import org.eclipse.linuxtools.internal.perf.launch.PerfEventsTab; -import org.eclipse.linuxtools.internal.perf.launch.PerfLaunchConfigDelegate; import org.eclipse.linuxtools.internal.perf.launch.PerfOptionsTab; import org.eclipse.linuxtools.internal.perf.model.PMCommand; import org.eclipse.linuxtools.internal.perf.model.PMDso; @@ -41,9 +36,6 @@ import org.osgi.framework.FrameworkUtil; public class ModelTest extends AbstractTest { protected ILaunchConfiguration config; - protected PerfLaunchConfigDelegate delegate; - protected ILaunch launch; - protected ILaunchConfigurationWorkingCopy wc; protected Stack<Class<?>> stack; @Override @@ -52,11 +44,6 @@ public class ModelTest extends AbstractTest { proj = createProjectAndBuild(FrameworkUtil.getBundle(this.getClass()), "fibTest"); //$NON-NLS-1$ config = createConfiguration(proj.getProject()); - delegate = new PerfLaunchConfigDelegate(); - launch = new Launch(config, ILaunchManager.PROFILE_MODE, null); - wc = config.getWorkingCopy(); - setProfileAttributes(wc); - Class<?>[] klassList = new Class<?>[] { PMSymbol.class, PMFile.class, PMDso.class, PMCommand.class, PMEvent.class }; stack = new Stack<Class<?>>(); @@ -66,7 +53,6 @@ public class ModelTest extends AbstractTest { @Override protected void tearDown() throws Exception { deleteProject(proj); - wc.delete(); super.tearDown(); } @@ -84,26 +70,6 @@ public class ModelTest extends AbstractTest { optionsTab.setDefaults(wc); } - public void testDefaultRun () { - try { - delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); - } catch (CoreException e) { - fail(); - } - } - - public void testClockEventRun () { - try { - ArrayList<String> list = new ArrayList<String>(); - list.addAll(Arrays.asList(new String [] {"cpu-clock", "task-clock", "cycles"})); - wc.setAttribute(PerfPlugin.ATTR_DefaultEvent, false); - wc.setAttribute(PerfPlugin.ATTR_SelectedEvents, list); - delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); - } catch (CoreException e) { - fail(); - } - } - public void testModelDefaultGenericStructure() { TreeParent invisibleRoot = buildModel( "resources/defaultevent-data/perf.data", |