Use LTTNG_TEST_TRACE_FORMAT from env to chose the session trace format
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Wed, 27 Jul 2022 18:44:41 +0000 (14:44 -0400)
committerJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Fri, 19 Aug 2022 16:11:10 +0000 (12:11 -0400)
This is a temporary solution for testing.

The plan is to review all tests and produce ctf1/ctf2 only when
pertinent. For now we want to cover as much ground as possible.

Change-Id: Ic5823c15689061f230a6ebd6e0ce3591a2e48ef7
Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
tests/regression/tools/live/test_kernel
tests/regression/tools/live/test_lttng_kernel
tests/utils/test_utils.py
tests/utils/utils.sh

index b01dfda141784ad07be11b6d03c4de5e3ad84cbc..8a948d82410effac5d5e9f7374426dce14086723 100755 (executable)
@@ -25,7 +25,7 @@ source $TESTDIR/utils/utils.sh
 function setup_live_tracing()
 {
        # Create session with default path
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create --trace-format=ctf1 $SESSION_NAME --live $DELAY_USEC \
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create --trace-format="$TRACE_FORMAT_OUTPUT" $SESSION_NAME --live $DELAY_USEC \
                -U net://localhost >/dev/null 2>&1
 
        $TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event "$EVENT_NAME" -s $SESSION_NAME -k >/dev/null 2>&1
index e0e823d6652e0bf0ce9aa43a720360c49ab80fa4..93d1ebef3014cd70be8c524ea2833d284abde54c 100755 (executable)
@@ -30,7 +30,7 @@ print_test_banner "$TEST_DESC"
 function setup_live_tracing()
 {
        # Create session with default path
-       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create --trace-format=ctf1 $SESSION_NAME --live $DELAY_USEC \
+       $TESTDIR/../src/bin/lttng/$LTTNG_BIN create --trace-format="$TRACE_FORMAT_OUTPUT" $SESSION_NAME --live $DELAY_USEC \
                -U net://localhost >/dev/null 2>&1
        ok $? "Create session in live mode with delay $DELAY_USEC"
 
index 39ff21bfd3bd0398c7bb7b9bfdd6a3c31ed45574..33b7fd28ada68e1f5a8907e973bbe0efbf6b742b 100644 (file)
@@ -23,6 +23,10 @@ sys.path.append(lttng_bindings_libs_path)
 from lttng import *
 
 BABELTRACE_BIN="babeltrace2"
+trace_format_mapping = {
+        "ctf1" : lttng_trace_format_ctf_1_descriptor_create,
+        "ctf2" : lttng_trace_format_ctf_2_descriptor_create,
+        }
 
 class SessionInfo:
     def __init__(self, handle, session_name, tmp_directory, channel_name):
@@ -72,7 +76,13 @@ def create_session():
     session_name = str(uuid.uuid1())
     tmp_directory = tempfile.mkdtemp()
     trace_path = tmp_directory + "/" + session_name
-    trace_format_desc = lttng_trace_format_ctf_1_descriptor_create()
+
+    if 'LTTNG_TEST_TRACE_FORMAT' in os.environ:
+        trace_format_env = os.getenv('LTTNG_TEST_TRACE_FORMAT')
+    else:
+        trace_format_env = 'ctf1'
+
+    trace_format_desc = trace_format_mapping[value]()
 
     session_descriptor = lttng_session_descriptor_local_create(session_name, trace_path)
 
index a4698c4afabce57da889f986a6c7b7512c8c3c7a..04f76215e81b5f2be6c5d0ca25b1b14c201cf376 100644 (file)
@@ -33,6 +33,7 @@ system_long_bit_size=$(getconf LONG_BIT)
 KERNEL_MAJOR_VERSION=2
 KERNEL_MINOR_VERSION=6
 KERNEL_PATCHLEVEL_VERSION=27
+TRACE_FORMAT_OUTPUT=${LTTNG_TESTS_TRACE_FORMAT:-ctf1}
 
 # We set the default UST register timeout and network and app socket timeout to
 # "wait forever", so that basic tests don't have to worry about hitting
@@ -1054,7 +1055,7 @@ function create_lttng_session_no_output ()
 {
        local sess_name=$1
        local opts="${@:2}"
-       local trace_format=("--trace-format" "ctf1")
+       local trace_format=("--trace-format" "$TRACE_FORMAT_OUTPUT")
 
        _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
                create "${trace_format[@]}" $sess_name --no-output $opts
@@ -1065,7 +1066,7 @@ function create_lttng_session_uri () {
        local sess_name=$1
        local uri=$2
        local opts="${@:3}"
-       local trace_format=("--trace-format" "ctf1")
+       local trace_format=("--trace-format" "$TRACE_FORMAT_OUTPUT")
 
        _run_lttng_cmd "$OUTPUT_DEST" "$ERROR_OUTPUT_DEST" \
                create "${trace_format[@]}" $sess_name -U $uri $opts
@@ -1079,7 +1080,7 @@ function create_lttng_session ()
        local sess_name=$3
        local trace_path=$4
        local opt=$5
-       local trace_format=("--trace-format" "ctf1")
+       local trace_format=("--trace-format" "$TRACE_FORMAT_OUTPUT")
 
        if [ -z "$trace_path" ]; then
                # Use lttng-sessiond default output.
This page took 0.030409 seconds and 5 git commands to generate.