Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java9
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelNoProvidersTest.java183
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java37
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java5
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg33
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg59
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java59
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java4
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java21
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java1
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java18
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java9
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java24
-rw-r--r--lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java7
16 files changed, 428 insertions, 44 deletions
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
index 3d44b0d10c..c255963ffa 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/AllTests.java
@@ -23,6 +23,7 @@ public class AllTests {
//$JUnit-BEGIN$
suite.addTestSuite(TraceControlComponentTest.class);
suite.addTestSuite(TraceControlTreeModelTest.class);
+ suite.addTestSuite(TraceControlTreeModelNoProvidersTest.class);
suite.addTestSuite(TraceControlKernelProviderTests.class);
suite.addTestSuite(TraceControlUstProviderTests.class);
suite.addTestSuite(TraceControlKernelSessionTests.class);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java
index 278d1a2762..26db1586d5 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlKernelProviderTests.java
@@ -36,6 +36,7 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.Kernel
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceChannelComponent;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceEventComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.core.model.IHost;
@@ -142,13 +143,17 @@ public class TraceControlKernelProviderTests extends TestCase {
// Verify that node is connected
assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
- // Get provider groups
+ // Get provider and session group
ITraceControlComponent[] groups = node.getChildren();
assertNotNull(groups);
assertEquals(2, groups.length);
+ // Check for kernel provider
+ TraceProviderGroup providerGroup = (TraceProviderGroup) groups[0];
+ assertTrue(providerGroup.hasKernelProvider());
+
// Get kernel provider
- ITraceControlComponent[] providers = groups[0].getChildren();
+ ITraceControlComponent[] providers = providerGroup.getChildren();
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
// Get kernel provider events and select 2 events
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelNoProvidersTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelNoProvidersTest.java
new file mode 100644
index 0000000000..70095241e0
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelNoProvidersTest.java
@@ -0,0 +1,183 @@
+/**********************************************************************
+ * Copyright (c) 2012 Ericsson
+ *
+ * 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:
+ * Bernd Hufmann - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng2.ui.tests.control.model.component;
+
+import java.io.File;
+import java.net.URL;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.linuxtools.internal.lttng2.core.control.model.TargetNodeState;
+import org.eclipse.linuxtools.internal.lttng2.stubs.service.TestRemoteSystemProxy;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TargetNodeComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceProviderGroup;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionGroup;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.UstProviderComponent;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.ILttngControlService;
+import org.eclipse.linuxtools.internal.lttng2.ui.views.control.service.LTTngControlService;
+import org.eclipse.rse.core.RSECorePlugin;
+import org.eclipse.rse.core.model.IHost;
+import org.eclipse.rse.core.model.ISystemProfile;
+import org.eclipse.rse.core.model.ISystemRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.junit.After;
+import org.junit.Before;
+import org.osgi.framework.FrameworkUtil;
+
+/**
+ * The class <code>TraceControlTreeModelNoProvidersTest</code> verifies that the
+ * Tracer Control can handle the case where no kernel provider and only UST provider
+ * are available.
+ */
+@SuppressWarnings("nls")
+public class TraceControlTreeModelNoProvidersTest extends TestCase {
+
+ // ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_STREAM = "ListInfoTest.cfg";
+ private static final String SCEN_LIST_INFO_TEST = "ListInfoTestNoKernel";
+ private static final String TARGET_NODE_NAME = "myNode";
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+
+ private TestRemoteSystemProxy fProxy;
+ private String fTestFile;
+
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new ModelImplTestSetup(new TestSuite(TraceControlTreeModelNoProvidersTest.class));
+ }
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ *
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ fProxy = new TestRemoteSystemProxy();
+ URL location = FileLocator.find(FrameworkUtil.getBundle(this.getClass()), new Path(TraceControlTestFacility.DIRECTORY + File.separator + TEST_STREAM), null);
+ File testfile = new File(FileLocator.toFileURL(location).toURI());
+ fTestFile = testfile.getAbsolutePath();
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception
+ * if the clean-up fails for some reason
+ *
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ TraceControlTestFacility.getInstance().waitForJobs();
+ }
+
+ /**
+ * Run the TraceControlComponent.
+ *
+ * @throws Exception
+ * This will fail the test
+ */
+ public void testTraceControlComponents() throws Exception {
+
+ fProxy.setTestFile(fTestFile);
+ fProxy.setScenario(SCEN_LIST_INFO_TEST);
+
+ ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
+
+ ISystemRegistry registry = RSECorePlugin.getTheSystemRegistry();
+ ISystemProfile profile = registry.createSystemProfile("myProfile", true);
+ IHost host = registry.createLocalHost(profile, "myProfile", "user");
+
+ TargetNodeComponent node = new TargetNodeComponent(TARGET_NODE_NAME, root, host, fProxy);
+
+ root.addChild(node);
+ node.connect();
+
+ TraceControlTestFacility.getInstance().waitForJobs();
+
+ // ------------------------------------------------------------------------
+ // Verify Parameters of TargetNodeComponent
+ // ------------------------------------------------------------------------
+ assertEquals("LOCALHOST", node.getHostName()); // assigned in createLocalHost() above
+ assertEquals("LOCALHOST", node.getToolTip()); // assigned in createLocalHost() above
+ Image connectedImage = node.getImage();
+ assertNotNull(connectedImage);
+ assertEquals(TargetNodeState.CONNECTED, node.getTargetNodeState());
+ assertNotNull(node.getControlService());
+ ILttngControlService service = node.getControlService();
+ assertTrue(service instanceof LTTngControlService);
+ node.setControlService(service);
+ assertTrue(node.getControlService() instanceof LTTngControlService);
+
+ assertTrue(node.isPassiveCommunicationsListener());
+
+ // ------------------------------------------------------------------------
+ // Verify Children of TargetNodeComponent
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] groups = node.getChildren();
+ assertNotNull(groups);
+ assertEquals(2, groups.length);
+
+ assertTrue(groups[0] instanceof TraceProviderGroup);
+ assertTrue(groups[1] instanceof TraceSessionGroup);
+
+ // Check for kernel provider
+ TraceProviderGroup providerGroup = (TraceProviderGroup) groups[0];
+ assertFalse(providerGroup.hasKernelProvider());
+
+ assertEquals("Provider", providerGroup.getName());
+ assertEquals("Sessions", groups[1].getName());
+
+ // ------------------------------------------------------------------------
+ // Verify TraceProviderGroup
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] providers = groups[0].getChildren();
+
+ assertNotNull(providers);
+ assertEquals(1, providers.length);
+ assertTrue(providers[0] instanceof UstProviderComponent);
+
+ // disconnect
+ node.disconnect();
+ assertEquals(TargetNodeState.DISCONNECTED, node.getTargetNodeState());
+ assertNotNull(node.getImage());
+ assertNotSame(connectedImage, node.getImage());
+
+ node.getParent().removeChild(node);
+ }
+} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
index 3a02b1b263..73b3a80e19 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/model/component/TraceControlTreeModelTest.java
@@ -177,7 +177,7 @@ public class TraceControlTreeModelTest extends TestCase {
assertEquals(3, providers.length);
// ------------------------------------------------------------------------
- // Verify UstProviderComponent
+ // Verify KernelProviderComponent
// ------------------------------------------------------------------------
KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
index 6da6753e28..cf0abba697 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/src/org/eclipse/linuxtools/lttng2/ui/tests/control/service/LTTngControlServiceTest.java
@@ -62,6 +62,8 @@ public class LTTngControlServiceTest extends TestCase {
private static final String SCEN_GET_SESSION_GARBAGE_OUT = "GetSessionGarbageOut";
private static final String SCEN_GET_SESSION1 = "GetSession1";
private static final String SCEN_GET_KERNEL_PROVIDER1 = "GetKernelProvider1";
+ private static final String SCEN_LIST_WITH_NO_KERNEL1 = "ListWithNoKernel1";
+ private static final String SCEN_LIST_WITH_NO_KERNEL2 = "ListWithNoKernel2";
private static final String SCEN_GET_UST_PROVIDER1 = "GetUstProvider1";
private static final String SCEN_GET_UST_PROVIDER2 = "GetUstProvider2";
private static final String SCEN_CREATE_SESSION1 = "CreateSession1";
@@ -145,7 +147,7 @@ public class LTTngControlServiceTest extends TestCase {
fail("Exeption thrown " + e);
}
}
-
+
public void testUnsupportedVersion() {
try {
fShell.setScenario(SCEN_LTTNG_UNSUPPORTED_VERSION);
@@ -375,6 +377,35 @@ public class LTTngControlServiceTest extends TestCase {
}
}
+ public void testGetKernelProviderNoKernel1() {
+ try {
+ fShell.setScenario(SCEN_LIST_WITH_NO_KERNEL1);
+ List<IBaseEventInfo> events = fService.getKernelProvider(new NullProgressMonitor());
+
+ // Verify event info
+ assertNotNull(events);
+ assertEquals(0, events.size());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+ public void testGetKernelProviderNoKernel2() {
+ try {
+ fShell.setScenario(SCEN_LIST_WITH_NO_KERNEL2);
+ List<IBaseEventInfo> events = fService.getKernelProvider(new NullProgressMonitor());
+
+ // Verify event info
+ assertNotNull(events);
+ assertEquals(0, events.size());
+
+ } catch (ExecutionException e) {
+ fail(e.toString());
+ }
+ }
+
+
public void testGetUstProvider() {
try {
fShell.setScenario(SCEN_GET_UST_PROVIDER1);
@@ -459,7 +490,7 @@ public class LTTngControlServiceTest extends TestCase {
public void testCreateSessionWithPrompt() {
try {
- // First line has the shell prompt before the command output
+ // First line has the shell prompt before the command output
// This can happen in a real application if the command line is not echoed by the shell.
fShell.setScenario(SCEN_CREATE_SESSION_WITH_PROMPT);
@@ -475,7 +506,7 @@ public class LTTngControlServiceTest extends TestCase {
}
}
-
+
public void testCreateSessionVariants() {
fShell.setScenario(SCEN_CREATE_SESSION_VARIANTS);
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java
index 7092eac294..4ff146275a 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/stubs/org/eclipse/linuxtools/internal/lttng2/stubs/dialogs/EnableChannelDialogStub.java
@@ -71,6 +71,11 @@ public class EnableChannelDialogStub implements IEnableChannelDialog {
return fIsKernel;
}
+ @Override
+ public void setHasKernel(boolean hasKernel) {
+ // Do nothing
+ }
+
public void setChannelInfo(ChannelInfo info) {
fChannelInfo = info;
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
index 52586c3e8b..42b400447b 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/LTTngServiceTest.cfg
@@ -287,6 +287,39 @@ Kernel events
</SCENARIO>
####################################################################
+# Scenario: Test "lttng list -k" with no kernel and no session daemon
+####################################################################
+<SCENARIO>
+ListWithNoKernel1
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Spawning session daemon
+Error: Unable to list kernel events
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng list -k" with no kernel and with session daemon
+####################################################################
+<SCENARIO>
+ListWithNoKernel2
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Error: Unable to list kernel events
+</COMMAND_OUTPUT>
+</SCENARIO>
+
+####################################################################
# Scenario: Test "lttng list -u" with sample output
####################################################################
<SCENARIO>
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
index b85688769f..824f8808dd 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui.tests/testfiles/ListInfoTest.cfg
@@ -169,3 +169,62 @@ PID: 4852 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
</COMMAND_OUTPUT>
</SCENARIO>
+
+
+####################################################################
+# Scenario: Test "lttng list -k" with no kernel and no session daemon
+####################################################################
+<SCENARIO>
+ListInfoTestNoKernel
+
+<COMMAND_INPUT>
+lttng version
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+lttng version 2.0.0 - Annedd'ale
+Web site: http://lttng.org/
+
+lttng is free software and under the GPL license and part LGPL
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Currently no available tracing session
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -k
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+1
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Error: Unable to list kernel events
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng list -u
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+UST events:
+-------------
+
+PID: 9379 - Name: /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello
+ ust_tests_hello:tptest_sighandler (loglevel: TRACE_DEBUG_MODULE (10)) (type: tracepoint)
+ ust_tests_hello:tptest (loglevel: TRACE_INFO (6)) (type: tracepoint)
+
+</COMMAND_OUTPUT>
+
+</SCENARIO>
+
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java
index a8eca3cd87..d1dea91f06 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableChannelDialog.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -36,7 +36,7 @@ import org.eclipse.swt.widgets.Text;
* <p>
* Dialog box for collecting channel information when enabling a channel (which will be created).
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public class EnableChannelDialog extends Dialog implements IEnableChannelDialog {
@@ -47,7 +47,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
/**
* The icon file for this dialog box.
*/
- public static final String ENABLE_CHANNEL_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$
+ public static final String ENABLE_CHANNEL_ICON_FILE = "icons/elcl16/add_button.gif"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Attributes
@@ -97,12 +97,12 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
*/
private Button fUstButton = null;
/**
- * The parent domain component where the channel node should be added.
+ * The parent domain component where the channel node should be added.
* Null in case of creation on session level.
*/
private TraceDomainComponent fDomain = null;
/**
- * Common verify listener for numeric text input.
+ * Common verify listener for numeric text input.
*/
private VerifyListener fVerifyListener = null;
/**
@@ -110,9 +110,13 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
*/
private IChannelInfo fChannelInfo = null;
/**
- * Output domain information. True in case of Kernel domain. False for UST.
+ * Output domain information. True in case of Kernel domain. False for UST.
*/
private boolean fIsKernel;
+ /**
+ * Flag which indicates whether Kernel domain is available or not
+ */
+ private boolean fHasKernel;
// ------------------------------------------------------------------------
// Constructors
@@ -172,6 +176,21 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
return fIsKernel;
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs.IEnableChannelDialog#setHasKernel(boolean)
+ */
+ @Override
+ public void setHasKernel(boolean hasKernel) {
+ if (fDomain != null) {
+ fIsKernel = fDomain.isKernel();
+ } else {
+ fIsKernel = hasKernel;
+ }
+
+ fHasKernel = hasKernel;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
@@ -192,23 +211,23 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
*/
@Override
protected Control createDialogArea(Composite parent) {
-
+
// Main dialog panel
fDialogComposite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout(3, true);
- fDialogComposite.setLayout(layout);
+ fDialogComposite.setLayout(layout);
Label channelNameLabel = new Label(fDialogComposite, SWT.RIGHT);
channelNameLabel.setText(Messages.TraceControl_EnableChannelNameLabel);
fChannelNameText = new Text(fDialogComposite, SWT.NONE);
fChannelNameText.setToolTipText(Messages.TraceControl_EnableChannelNameTooltip);
-
+
Label subBufferSizeLabel = new Label(fDialogComposite, SWT.RIGHT);
subBufferSizeLabel.setText(Messages.TraceControl_SubBufferSizePropertyName);
fSubBufferSizeText = new Text(fDialogComposite, SWT.NONE);
fSubBufferSizeText.setToolTipText(Messages.TraceControl_EnableChannelSubBufferSizeTooltip);
fSubBufferSizeText.addVerifyListener(fVerifyListener);
-
+
Label numSubBufferLabel = new Label(fDialogComposite, SWT.RIGHT);
numSubBufferLabel.setText(Messages.TraceControl_NbSubBuffersPropertyName);
fNumberOfSubBuffersText = new Text(fDialogComposite, SWT.NONE);
@@ -230,13 +249,13 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
Group discardModeGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
discardModeGroup.setText(Messages.TraceControl_EnableChannelDiscardModeGroupName);
layout = new GridLayout(2, true);
- discardModeGroup.setLayout(layout);
+ discardModeGroup.setLayout(layout);
fDiscardModeButton = new Button(discardModeGroup, SWT.RADIO);
fDiscardModeButton.setText(Messages.TraceControl_EnableChannelDiscardModeLabel);
fDiscardModeButton.setToolTipText(Messages.TraceControl_EnableChannelDiscardModeTooltip);
fDiscardModeButton.setSelection(true);
-
+
fOverwriteModeButton = new Button(discardModeGroup, SWT.RADIO);
fOverwriteModeButton.setText(Messages.TraceControl_EnableChannelOverwriteModeLabel);
fOverwriteModeButton.setToolTipText(Messages.TraceControl_EnableChannelOverwriteModeTooltip);
@@ -245,8 +264,8 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
fDomainGroup = new Group(fDialogComposite, SWT.SHADOW_NONE);
fDomainGroup.setText(Messages.TraceControl_DomainDisplayName);
layout = new GridLayout(2, true);
- fDomainGroup.setLayout(layout);
-
+ fDomainGroup.setLayout(layout);
+
fKernelButton = new Button(fDomainGroup, SWT.RADIO);
fKernelButton.setText(Messages.TraceControl_KernelDomainDisplayName);
fKernelButton.setSelection(fIsKernel);
@@ -254,7 +273,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
fUstButton.setText(Messages.TraceControl_UstDisplayName);
fUstButton.setSelection(!fIsKernel);
- if (fDomain != null) {
+ if ((fDomain != null) || (!fHasKernel)) {
fKernelButton.setEnabled(false);
fUstButton.setEnabled(false);
}
@@ -266,7 +285,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
fDiscardModeButton.setLayoutData(data);
data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
fOverwriteModeButton.setLayoutData(data);
-
+
data = new GridData(GridData.FILL, GridData.CENTER, false, false, 3, 1);
fDomainGroup.setLayoutData(data);
@@ -274,7 +293,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
fKernelButton.setLayoutData(data);
data = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
fUstButton.setLayoutData(data);
-
+
data = new GridData(GridData.FILL_HORIZONTAL);
data.horizontalSpan = 2;
@@ -335,7 +354,7 @@ public class EnableChannelDialog extends Dialog implements IEnableChannelDialog
// validation successful -> call super.okPressed()
super.okPressed();
}
-
+
/*
* (non-Javadoc)
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
index fb44f5ee43..542b6e6cf0 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/EnableEventsDialog.java
@@ -334,7 +334,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog {
if (fDomain != null) {
fIsKernel = fDomain.isKernel();
} else {
- fIsKernel = true;
+ fIsKernel = fProviderGroup != null ? fProviderGroup.hasKernelProvider() : true;
}
}
@@ -380,7 +380,7 @@ public class EnableEventsDialog extends Dialog implements IEnableEventsDialog {
fUstButton.setText(Messages.TraceControl_UstDisplayName);
fUstButton.setSelection(!fIsKernel);
- if (fDomain != null) {
+ if ((fDomain != null) || ((fProviderGroup != null) && (!fProviderGroup.hasKernelProvider()))) {
fKernelButton.setEnabled(false);
fUstButton.setEnabled(false);
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java
index 4e4ca6ad24..d4a072b40c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/dialogs/IEnableChannelDialog.java
@@ -1,12 +1,12 @@
/**********************************************************************
* Copyright (c) 2012 Ericsson
- *
+ *
* 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:
+ *
+ * Contributors:
* Bernd Hufmann - Initial API and implementation
**********************************************************************/
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.dialogs;
@@ -18,11 +18,11 @@ import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceD
* <p>
* Interface for the enable channel dialog when domain is known.
* </p>
- *
+ *
* @author Bernd Hufmann
*/
public interface IEnableChannelDialog {
-
+
// ------------------------------------------------------------------------
// Accessors
// ------------------------------------------------------------------------
@@ -30,19 +30,24 @@ public interface IEnableChannelDialog {
* @return the configuration info for the new channel.
*/
public IChannelInfo getChannelInfo();
-
+
/**
* Sets the domain component
* @param domain - the trace domain component
*/
public void setDomainComponent(TraceDomainComponent domain);
-
+
/**
* @return true for Kernel domain. False for UST.
*/
public boolean isKernel();
-
+ /**
+ * Sets the whether dialog is for Kernel or UST
+ * @param isKernel true for kernel domain else UST
+ */
+ public void setHasKernel(boolean isKernel);
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java
index 8d08305c1c..727de650f4 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/handlers/BaseEnableChannelHandler.java
@@ -87,6 +87,7 @@ abstract class BaseEnableChannelHandler extends BaseControlViewHandler {
final IEnableChannelDialog dialog = TraceControlDialogFactory.getInstance().getEnableChannelDialog();
dialog.setDomainComponent(getDomain(param));
+ dialog.setHasKernel(param.getSession().hasKernelProvider());
if (dialog.open() != Window.OK) {
return null;
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
index f4ee55feb8..448dfa5a6c 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceProviderGroup.java
@@ -79,9 +79,12 @@ public class TraceProviderGroup extends TraceControlComponent {
public void getProviderFromNode(IProgressMonitor monitor) throws ExecutionException {
List<IBaseEventInfo> eventInfos = getControlService().getKernelProvider(monitor);
- KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
- addChild(component);
- component.setEventInfo(eventInfos);
+
+ if (!eventInfos.isEmpty()) {
+ KernelProviderComponent component = new KernelProviderComponent(Messages.TraceControl_KernelProviderDisplayName, this);
+ addChild(component);
+ component.setEventInfo(eventInfos);
+ }
List<IUstProviderInfo> allProviders = getControlService().getUstProvider(monitor);
@@ -92,5 +95,14 @@ public class TraceProviderGroup extends TraceControlComponent {
ustComponent.setUstProvider(ustProviderInfo);
}
}
+
+ /**
+ * Returns whether the kernel provider is available or not
+ * @return <code>true</code> if kernel provide is available or <code>false</code>
+ */
+ public boolean hasKernelProvider() {
+ List<ITraceControlComponent> kernelList = getChildren(KernelProviderComponent.class);
+ return !kernelList.isEmpty();
+ }
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
index 4a95cd934c..b02bc546c4 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/model/impl/TraceSessionComponent.java
@@ -192,6 +192,15 @@ public class TraceSessionComponent extends TraceControlComponent {
return ((TraceSessionGroup)getParent()).getTargetNode();
}
+ /**
+ * Returns whether the kernel provider is available or not
+ * @return <code>true</code> if kernel provide is available or <code>false</code>
+ */
+ public boolean hasKernelProvider() {
+ List<ITraceControlComponent> providerGroups = getTargetNode().getChildren(TraceProviderGroup.class);
+ return (!providerGroups.isEmpty() ? ((TraceProviderGroup) providerGroups.get(0)).hasKernelProvider() : false);
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
index 3df844ed6f..5718b9ba36 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlService.java
@@ -226,12 +226,30 @@ public class LTTngControlService implements ILttngControlService {
@Override
public List<IBaseEventInfo> getKernelProvider(IProgressMonitor monitor) throws ExecutionException {
StringBuffer command = createCommand(LTTngControlServiceConstants.COMMAND_LIST_KERNEL);
- ICommandResult result = executeCommand(command.toString(), monitor);
+ ICommandResult result = executeCommand(command.toString(), monitor, false);
+
+ List<IBaseEventInfo> events = new ArrayList<IBaseEventInfo>();
+
+ if (result.getOutput() != null) {
+ // Ignore the following 2 cases:
+ // Spawning a session daemon
+ // Error: Unable to list kernel events
+ // or:
+ // Error: Unable to list kernel events
+
+ if ((result.getOutput().length == 1) && (LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN.matcher(result.getOutput()[0]).matches()) ||
+ ((result.getOutput().length > 1) && (LTTngControlServiceConstants.LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN.matcher(result.getOutput()[1]).matches()))) {
+ return events;
+ }
+ }
+
+ if (isError(result)) {
+ throw new ExecutionException(Messages.TraceControl_CommandError + " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$
+ }
// Kernel events:
// -------------
// sched_kthread_stop (type: tracepoint)
- List<IBaseEventInfo> events = new ArrayList<IBaseEventInfo>();
getProviderEventInfo(result.getOutput(), 0, events);
return events;
}
@@ -1185,7 +1203,7 @@ public class LTTngControlService implements ILttngControlService {
ControlCommandLogger.log(formatOutput(result));
}
- if (isError(result)) {
+ if (checkForError && isError(result)) {
throw new ExecutionException(Messages.TraceControl_CommandError
+ " " + command.toString() + "\n" + formatOutput(result)); //$NON-NLS-1$ //$NON-NLS-2$
}
diff --git a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
index fd4b600cd0..5e84b86a85 100644
--- a/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
+++ b/lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/service/LTTngControlServiceConstants.java
@@ -26,7 +26,7 @@ public class LTTngControlServiceConstants {
// Version constants
// ------------------------------------------------------------------------
/**
- * Constant for the LTTng toolchain version
+ * Constant for the LTTng toolchain version 2.0
*/
public final static String LTTNG_MAJOR_VERSION_2_0 = "2.0"; //$NON-NLS-1$
@@ -317,5 +317,8 @@ public class LTTngControlServiceConstants {
* Pattern to match introduction line of context list.
*/
public final static Pattern ADD_CONTEXT_HELP_CONTEXTS_END_LINE = Pattern.compile("\\s*Example.*"); //$NON-NLS-1$
-
+ /**
+ * Pattern to match error line if no kernel tracer is available or installed.
+ */
+ public final static Pattern LIST_KERNEL_NO_KERNEL_PROVIDER_PATTERN = Pattern.compile("\\s*Error:\\s+Unable\\s+to\\s+list\\s+kernel\\s+events.*"); //$NON-NLS-1$;
}

Back to the top