Test: template on create session
[lttng-tools.git] / tests / utils / utils.sh
index 0a4d591562689052d40b2c11ea7f9d3be3358998..d4ba4d0606cab9e4b93bae958266fd33d87c8a30 100644 (file)
@@ -689,6 +689,29 @@ function create_lttng_session_fail ()
        create_lttng_session 1 "$@"
 }
 
+function create_lttng_session_template ()
+{
+       local expected_to_fail=$1
+       local template_path=$2
+       local opt=$3
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create --template-path="$template_path" $opt > $OUTPUT_DEST
+       ret=$?
+       if [[ $expected_to_fail -eq "1" ]]; then
+               test "$ret" -ne "0"
+               ok $? "Create session from template $template_path failed as expected"
+       else
+               ok $ret "Create session from template $template_path"
+       fi
+}
+
+function create_lttng_session_template_ok () {
+       create_lttng_session_template 0 "$@"
+}
+
+function create_lttng_session_template_fail () {
+       create_lttng_session_template 1 "$@"
+}
 
 function enable_ust_lttng_channel ()
 {
@@ -735,6 +758,24 @@ function enable_lttng_mmap_overwrite_kernel_channel()
        ok $? "Enable channel $channel_name for session $sess_name"
 }
 
+function enable_lttng_mmap_discard_small_kernel_channel()
+{
+       local sess_name=$1
+       local channel_name=$2
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --discard --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       ok $? "Enable small discard channel $channel_name for session $sess_name"
+}
+
+function enable_lttng_mmap_overwrite_small_kernel_channel()
+{
+       local sess_name=$1
+       local channel_name=$2
+
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel -s $sess_name $channel_name -k --output mmap --overwrite --subbuf-size=$(getconf PAGE_SIZE) --num-subbuf=2 1> $OUTPUT_DEST 2> $ERROR_OUTPUT_DEST
+       ok $? "Enable small discard channel $channel_name for session $sess_name"
+}
+
 function enable_lttng_mmap_overwrite_ust_channel()
 {
        local sess_name=$1
@@ -1224,7 +1265,7 @@ function trace_matches ()
 
        if [ "$count" -ne "$nr_iter" ]; then
                fail "Trace match"
-               diag "$count events found in trace"
+               diag "$count matching events found in trace"
        else
                pass "Trace match"
        fi
@@ -1276,6 +1317,18 @@ function validate_trace
        return $ret
 }
 
+function trace_first_line
+{
+       local trace_path=$1
+
+       which $BABELTRACE_BIN >/dev/null
+       if [ $? -ne 0 ]; then
+           skip 0 "Babeltrace binary not found. Skipping trace validation"
+       fi
+
+       $BABELTRACE_BIN $trace_path 2>/dev/null | head -n 1
+}
+
 function validate_trace_exp()
 {
        local event_exp=$1
This page took 0.027899 seconds and 5 git commands to generate.