From 2d657e85ca761337a7d4b089d31c938ce04d57b4 Mon Sep 17 00:00:00 2001 From: Camilo Bernal Date: Tue, 29 Jan 2013 12:04:39 -0500 Subject: Fix perf launch tests failures when perf is not available. Check for perf before running perf launch tests. Change-Id: I3dd97c3497e04f7c056978d93f29f3aa42128d3f Reviewed-on: https://git.eclipse.org/r/10010 Reviewed-by: Alexander Kurtakov IP-Clean: Alexander Kurtakov Tested-by: Alexander Kurtakov --- .../linuxtools/internal/perf/tests/LaunchTest.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) 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 index 004d39ebf5..9dc312f176 100644 --- 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 @@ -20,6 +20,7 @@ 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; @@ -68,22 +69,26 @@ public class LaunchTest extends AbstractTest { } public void testDefaultRun () { - try { - delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); - } catch (CoreException e) { - fail(); + if (PerfCore.checkPerfInPath()) { + try { + delegate.launch(wc, ILaunchManager.PROFILE_MODE, launch, null); + } catch (CoreException e) { + fail(); + } } } public void testClockEventRun () { - try { - ArrayList list = new ArrayList(); - 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(); + if (PerfCore.checkPerfInPath()) { + try { + ArrayList list = new ArrayList(); + 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(); + } } } -- cgit v1.2.3