Tests: add tests for the save and load feature
[lttng-tools.git] / tests / utils / utils.sh
index 1595f1d16816f0fd3568b9bbfafc5b9e015376a1..a1a26d9df00a67c761ece45efd5ad8eba4f987f7 100644 (file)
@@ -121,22 +121,33 @@ function start_lttng_relayd
        fi
 }
 
-function stop_lttng_relayd
+function stop_lttng_relayd_nocheck
 {
        PID_RELAYD=`pidof lt-$RELAYD_BIN`
 
+       diag "Killing lttng-relayd (pid: $PID_RELAYD)"
        kill $PID_RELAYD >/dev/null 2>&1
+       retval=$?
 
-       if [ $? -eq 1 ]; then
-               fail "Kill lttng-relayd (pid: $PID_RELAYD)"
-               return 1
-       else
+       if [ $retval -eq 1 ]; then
                out=1
                while [ -n "$out" ]; do
                        out=$(pidof lt-$RELAYD_BIN)
                        sleep 0.5
                done
-               pass "Kill lttng-relayd (pid: $PID_RELAYD)"
+       fi
+       return $retval
+}
+
+function stop_lttng_relayd
+{
+       stop_lttng_relayd_nocheck
+
+       if [ $? -eq 1 ]; then
+               fail "Killed lttng-relayd (pid: $PID_RELAYD)"
+               return 1
+       else
+               pass "Killed lttng-relayd (pid: $PID_RELAYD)"
                return 0
        fi
 }
@@ -389,6 +400,23 @@ function lttng_snapshot_record ()
        ok $? "Snapshot recorded"
 }
 
+function lttng_save()
+{
+       local sess_name=$1
+       local opts=$2
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN save $sess_name $opts >/dev/null 2>&1
+       ok $? "Session successfully saved"
+}
+
+function lttng_load()
+{
+       local opts=$1
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN load $opts >/dev/null 2>&1
+       ok $? "Load command successful"
+}
+
 function trace_matches ()
 {
        event_name=$1
This page took 0.0231 seconds and 4 git commands to generate.