diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceMiTest.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceMiTest.java index 5048494f45..06239b382b 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceMiTest.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceMiTest.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2014 Ericsson + * Copyright (c) 2014, 2024 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which @@ -21,6 +21,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Optional; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.runtime.NullProgressMonitor; @@ -30,6 +31,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.core.model.IEventInfo; import org.eclipse.tracecompass.internal.lttng2.control.core.model.ILoggerInfo; import org.eclipse.tracecompass.internal.lttng2.control.core.model.ISessionInfo; +import org.eclipse.tracecompass.internal.lttng2.control.core.model.IUstProviderInfo; import org.eclipse.tracecompass.internal.lttng2.control.core.model.LogLevelType; import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceChannelOutputType; import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType; @@ -60,6 +62,7 @@ public class LTTngControlServiceMiTest extends LTTngControlServiceTest { private static final String SCEN_ENABLING_JUL_LOGGERS = "EnableJulLoggers"; private static final String SCEN_ENABLING_LOG4J_LOGGERS = "EnableLog4jLoggers"; private static final String SCEN_ENABLING_PYTHON_LOGGERS = "EnablePythonLoggers"; + private static final String SCEN_GET_UST_PROVIDER4 = "GetUstProvider4"; @Override protected ILttngControlService getControlService() { @@ -463,4 +466,23 @@ public void testEnablePythonLoggers() { fail(e.toString()); } } + + @Test + @Override + public void testUstProvider4() { + try { + fShell.setScenario(SCEN_GET_UST_PROVIDER4); + List providers = fService.getUstProvider(); + + assertNotNull(providers); + assertEquals(2, providers.size()); + + // Verify that there are no logger ust provider + Optional optional = providers.stream().filter(provider -> provider.getLoggers().size() > 0).findFirst(); + assertTrue(optional.isEmpty()); + + } catch (ExecutionException e) { + fail(e.toString()); + } + } } diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java index 161e9e7adc..331909a398 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java @@ -1,5 +1,5 @@ /********************************************************************** - * Copyright (c) 2012, 2015 Ericsson + * Copyright (c) 2012, 2024 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License 2.0 which @@ -746,6 +746,10 @@ public void testGetUstProvider3() { } } + @Test + public void testUstProvider4() { + // Nothing to do because loggers are only supported with MI. + } @Test public void testGetKernelProviderNoUst1() { diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3Test.cfg b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3Test.cfg index 441c8e000a..c163a8026b 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3Test.cfg +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3Test.cfg @@ -1,5 +1,5 @@ #################################################################### -# Copyright (c) 2014, 2016 Ericsson +# Copyright (c) 2014, 2024 Ericsson # # All rights reserved. This program and the accompanying materials are # made available under the terms of the Eclipse Public License 2.0 which @@ -1334,6 +1334,160 @@ lttng --mi xml list -p + +#################################################################### +# Scenario: Test "lttng list -u -f" with missing logger agents +#################################################################### + +GetUstProvider4 + +lttng --mi xml list -u -f + + +0 + + + + + list + + + + UST + PER_PID + + + 9379 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + TRACE_DEBUG_MODULE + ALL + + + + ust_tests_hello:tptest + TRACEPOINT + true + TRACE_INFO + ALL + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + 4852 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + TRACE_WARNING + ALL + + + + ust_tests_hello:tptest + TRACEPOINT + true + TRACE_DEBUG_FUNCTION + ALL + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + + + + + + +lttng --mi xml list -j + + +1 + + + + + list + + + +Error: Unable to list jul events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -l + + +1 + + + + + list + + + +Error: Unable to list log4j events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -p + + +1 + + + + + list + + + +Error: Unable to list python events: Session daemon agent tracing is disabled + + + + #################################################################### # Scenario: Test "lttng create #################################################################### diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3TestLTTng211.cfg b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3TestLTTng211.cfg index 8e2512b473..efec45e228 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3TestLTTng211.cfg +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3TestLTTng211.cfg @@ -1,5 +1,5 @@ #################################################################### -# Copyright (c) 2014, 2016 Ericsson +# Copyright (c) 2014, 2024 Ericsson # # All rights reserved. This program and the accompanying materials are # made available under the terms of the Eclipse Public License 2.0 which @@ -1341,6 +1341,160 @@ lttng --mi xml list -p + +#################################################################### +# Scenario: Test "lttng list -u -f" with missing logger agents +#################################################################### + +GetUstProvider4 + +lttng --mi xml list -u -f + + +0 + + + + + list + + + + UST + PER_PID + + + 9379 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + TRACE_DEBUG_MODULE + ALL + + + + ust_tests_hello:tptest + TRACEPOINT + true + TRACE_INFO + ALL + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + 4852 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + TRACE_WARNING + ALL + + + + ust_tests_hello:tptest + TRACEPOINT + true + TRACE_DEBUG_FUNCTION + ALL + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + + + + + + +lttng --mi xml list -j + + +1 + + + + + list + + + +Error: Unable to list jul events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -l + + +1 + + + + + list + + + +Error: Unable to list log4j events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -p + + +1 + + + + + list + + + +Error: Unable to list python events: Session daemon agent tracing is disabled + + + + #################################################################### # Scenario: Test "lttng create #################################################################### diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg index 761b8ab8b9..f507f8e743 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg @@ -1,5 +1,5 @@ #################################################################### -# Copyright (c) 2014, 2015 Ericsson +# Copyright (c) 2014, 2024 Ericsson # # All rights reserved. This program and the accompanying materials are # made available under the terms of the Eclipse Public License 2.0 which @@ -1269,6 +1269,168 @@ lttng --mi xml list -p + +#################################################################### +# Scenario: Test "lttng list -u -f" with missing logger agents +#################################################################### + +GetUstProvider4 + +lttng --mi xml list -u -f + + +0 + + + + + list + + + + UST + PER_PID + + + 9379 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + false + TRACE_DEBUG_MODULE + ALL + false + + + + ust_tests_hello:tptest + TRACEPOINT + true + false + TRACE_INFO + ALL + false + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + 4852 + /home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello + + + ust_tests_hello:tptest_sighandler + TRACEPOINT + true + false + TRACE_WARNING + ALL + false + + + + ust_tests_hello:tptest + TRACEPOINT + true + false + TRACE_DEBUG_FUNCTION + ALL + false + + + doublefield + FLOAT + 0 + + + floatfield + FLOAT + 0 + + + stringfield + STRING + 0 + + + + + + + + + + + + +lttng --mi xml list -j + + +1 + + + + + list + + + +Error: Unable to list jul events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -l + + +1 + + + + + list + + + +Error: Unable to list log4j events: Session daemon agent tracing is disabled + + + +lttng --mi xml list -p + + +1 + + + + + list + + + +Error: Unable to list python events: Session daemon agent tracing is disabled + + + + #################################################################### # Scenario: Test "lttng create #################################################################### diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceConstants.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceConstants.java index 6762688e75..ef4fc3ba47 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceConstants.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceConstants.java @@ -513,7 +513,7 @@ public interface LTTngControlServiceConstants { /** * Pattern to match error line if no ust tracer is available or installed. */ - Pattern LIST_UST_NO_UST_PROVIDER_PATTERN = Pattern.compile(".*Unable\\s*to\\s*list\\s*UST\\s*event.*"); //$NON-NLS-1$ + Pattern LIST_UST_NO_UST_PROVIDER_PATTERN = Pattern.compile(".*Unable\\s*to\\s*list\\s*(.*)\\s*event.*"); //$NON-NLS-1$ /** * Pattern to match for list snapshot information (lttng snapshot list-output) */ diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceMI.java b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceMI.java index f0d61ac911..502ab98e47 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceMI.java +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui/src/org/eclipse/tracecompass/internal/lttng2/control/ui/views/service/LTTngControlServiceMI.java @@ -1141,6 +1141,11 @@ private void getUstProviderLoggers(List allProviders, TraceDom ICommandResult result = executeCommand(command, monitor, false); if (isError(result)) { + // Ignore the following case (example jul): + // Error: Unable to list jul events: Session daemon agent tracing is disabled + if (ignoredPattern(result.getErrorOutput(), LTTngControlServiceConstants.LIST_UST_NO_UST_PROVIDER_PATTERN)) { + return; + } throw new ExecutionException(Messages.TraceControl_CommandError + command.toString()); }