control: add service test cases for load and save commands
authorBernd Hufmann <Bernd.Hufmann@ericsson.com>
Mon, 30 Nov 2015 12:13:37 +0000 (07:13 -0500)
committerBernd Hufmann <bernd.hufmann@ericsson.com>
Tue, 8 Dec 2015 17:37:09 +0000 (12:37 -0500)
Change-Id: I3455c2c9df7cb43bca9fe0905d418bbe66ad0c38
Signed-off-by: Bernd Hufmann <Bernd.Hufmann@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/61554
Reviewed-by: Hudson CI
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceTest.cfg

index d7cfcdc55bbd18882cfe86ae5d6fa0971da7e139..40365fc5e0e4a596642a96bdb14a5da7bbcad416 100644 (file)
@@ -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);
index 721137bec7640faa0d1996708d9c769debbe65c8..3fd2351122c65fdba1fac5868b5ed66cfb101ccb 100644 (file)
@@ -2709,3 +2709,73 @@ lttng --mi xml list mysession
 </command>
 </COMMAND_OUTPUT>
 </SCENARIO>
+####################################################################
+# Scenario: Test "lttng load [OPTIONS] [SESSION]"
+#                "lttng save [OPTIONS] [SESSION]"
+# (LTTng 2.5)
+####################################################################
+<SCENARIO>
+SessionProfile
+<COMMAND_INPUT>
+lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>load</name><output><load><session><name>*</name></session><path>.lttng/sessions/seqSession2.lttng</path></load></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+<SCENARIO>
+SessionProfile
+<COMMAND_INPUT>
+lttng --mi xml load -i /home/user/.lttng/sessions/mysession.lttng -f
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>load</name><output><load><session><name>*</name></session><path>.lttng/sessions/seqSession2.lttng</path></load></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng --mi xml save
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>save</name><output><save><session><name>*</name></session></save></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng --mi xml save mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng --mi xml save -f mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng --mi xml save -o /tmp/test -f mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<command><name>save</name><output><save><session><name>seqSession2</name></session></save></output><success>true</success></command>
+</COMMAND_OUTPUT>
+
+</SCENARIO>
index 316d0de81af66f68ad701a3212f5dea7460275ae..20bfb9cad6115abce67a8d23aabe738115b70935 100644 (file)
@@ -1565,7 +1565,7 @@ lttng snapshot record -s mysession
 <COMMAND_OUTPUT>
     Snapshot recorded successfully for session mysession
 </COMMAND_OUTPUT>
-#------------------------------------------------------------------------------
+#-----------------------------------------------------------------------------
 <COMMAND_INPUT>
 lttng destroy mysession
 </COMMAND_INPUT>
@@ -1575,4 +1575,76 @@ lttng destroy mysession
 <COMMAND_OUTPUT>
 Session mysession destroyed.
 </COMMAND_OUTPUT>
+
 </SCENARIO>
+
+####################################################################
+# Scenario: Test "lttng load [OPTIONS] [SESSION]"
+#                "lttng save [OPTIONS] [SESSION]"
+# (LTTng 2.5)
+####################################################################
+<SCENARIO>
+SessionProfile
+<COMMAND_INPUT>
+lttng load -i /home/user/.lttng/sessions/mysession.lttng
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All sessions have been loaded successfully.
+</COMMAND_OUTPUT>
+
+<SCENARIO>
+SessionProfile
+<COMMAND_INPUT>
+lttng load -i /home/user/.lttng/sessions/mysession.lttng -f
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All sessions have been loaded successfully.
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng save
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+All sessions have been saved successfully.
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng save mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession saved successfully.
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng save -f mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession saved successfully.
+</COMMAND_OUTPUT>
+
+<COMMAND_INPUT>
+lttng save -o /tmp/test -f mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+Session mysession saved successfully.
+</COMMAND_OUTPUT>
+
+</SCENARIO>
\ No newline at end of file
This page took 0.031492 seconds and 5 git commands to generate.