From 2b7c6996a97c80433032850e8bd9da80cdf607ad Mon Sep 17 00:00:00 2001 From: Bernd Hufmann Date: Mon, 30 Nov 2015 07:13:37 -0500 Subject: [PATCH] control: add service test cases for load and save commands Change-Id: I3455c2c9df7cb43bca9fe0905d418bbe66ad0c38 Signed-off-by: Bernd Hufmann Reviewed-on: https://git.eclipse.org/r/61554 Reviewed-by: Hudson CI Tested-by: Matthew Khouzam Reviewed-by: Matthew Khouzam --- .../service/LTTngControlServiceTest.java | 44 +++++++++++ .../testfiles/LTTngServiceMiTest.cfg | 70 ++++++++++++++++++ .../testfiles/LTTngServiceTest.cfg | 74 ++++++++++++++++++- 3 files changed, 187 insertions(+), 1 deletion(-) 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 d7cfcdc55b..40365fc5e0 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 @@ -114,6 +114,8 @@ public class LTTngControlServiceTest { private static final String SCEN_CREATE_SNAPSHOT_SESSION_ERRORS = "CreateSessionSnapshotErrors"; protected static final String SCEN_CREATE_LIVE_SESSION = "CreateSessionLive"; private static final String SCEN_CREATE_LIVE_SESSION_ERRORS = "CreateSessionLiveErrors"; + private static final String SCEN_SESSION_PROFILES = "SessionProfile"; + // ------------------------------------------------------------------------ @@ -1580,6 +1582,48 @@ public class LTTngControlServiceTest { } } + @Test + public void testSessionProfile() { + fShell.setScenario(SCEN_SESSION_PROFILES); + final String profile = "/home/user/.lttng/sessions/mysession.lttng"; + try { + fService.loadSession(profile, false, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("load session failed: " + e); + } + + try { + fService.loadSession(profile, true, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("load session failed: " + e); + } + + try { + fService.saveSession(null, null, false, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("save session failed: " + e); + } + + final String sessionName = "mysession"; + try { + fService.saveSession(sessionName, null, false, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("save session failed: " + e); + } + + try { + fService.saveSession(sessionName, null, true, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("save session failed: " + e); + } + + try { + fService.saveSession(sessionName, "/tmp/test", true, new NullProgressMonitor()); + } catch (ExecutionException e) { + fail("save session failed: " + e); + } + } + private static void enableVerbose() { // verbose ControlCommandLogger.init(ControlPreferences.getInstance().getLogfilePath(), false); 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 721137bec7..3fd2351122 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 @@ -2709,3 +2709,73 @@ lttng --mi xml list mysession +#################################################################### +# Scenario: Test "lttng load [OPTIONS] [SESSION]" +# "lttng save [OPTIONS] [SESSION]" +# (LTTng 2.5) +#################################################################### + +SessionProfile + +lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng + + +0 + + +load*.lttng/sessions/seqSession2.lttngtrue + + + +SessionProfile + +lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng -f + + +0 + + +load*.lttng/sessions/seqSession2.lttngtrue + + + +lttng --mi xml save + + +0 + + +save*true + + + +lttng --mi xml save mysession + + +0 + + +saveseqSession2true + + + +lttng --mi xml save -f mysession + + +0 + + +saveseqSession2true + + + +lttng --mi xml save -o /tmp/test -f mysession + + +0 + + +saveseqSession2true + + + diff --git a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceTest.cfg b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceTest.cfg index 316d0de81a..20bfb9cad6 100644 --- a/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceTest.cfg +++ b/lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceTest.cfg @@ -1565,7 +1565,7 @@ lttng snapshot record -s mysession Snapshot recorded successfully for session mysession -#------------------------------------------------------------------------------ +#----------------------------------------------------------------------------- lttng destroy mysession @@ -1575,4 +1575,76 @@ lttng destroy mysession Session mysession destroyed. + + +#################################################################### +# Scenario: Test "lttng load [OPTIONS] [SESSION]" +# "lttng save [OPTIONS] [SESSION]" +# (LTTng 2.5) +#################################################################### + +SessionProfile + +lttng load -i /home/user/.lttng/sessions/mysession.lttng + + +0 + + +All sessions have been loaded successfully. + + + +SessionProfile + +lttng load -i /home/user/.lttng/sessions/mysession.lttng -f + + +0 + + +All sessions have been loaded successfully. + + + +lttng save + + +0 + + +All sessions have been saved successfully. + + + +lttng save mysession + + +0 + + +Session mysession saved successfully. + + + +lttng save -f mysession + + +0 + + +Session mysession saved successfully. + + + +lttng save -o /tmp/test -f mysession + + +0 + + +Session mysession saved successfully. + + + \ No newline at end of file -- 2.34.1