Test: utils: introduce LTTNG_SESSIOND_ENV_VARS
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Thu, 20 Apr 2017 21:19:35 +0000 (17:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 13:19:12 +0000 (09:19 -0400)
When LTTNG_SESSIOND_ENV_VARS is set when calling start_lttng_sessiond_*
the value from LTTNG_SESSIOND_ENV_VARS will be passer to the "env"
command while launching the sessiond.

Allow the use of LD_PRELOAD, LTTNG_ENABLE_TESTPOINT and others.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/utils/utils.sh

index 080aa4d5d684ce61eeeac8d4e4afeeceede792cd..100f4fd2a1fc02566518168a2d2cd57447d71061 100644 (file)
@@ -384,6 +384,7 @@ function start_lttng_sessiond_opt()
        local withtap=$1
        local load_path=$2
 
+       local env_vars=""
        local consumerd=""
        local long_bit_value=$(getconf LONG_BIT)
 
@@ -407,6 +408,11 @@ function start_lttng_sessiond_opt()
                        ;;
        esac
 
+       # Check for env. variable. Allow the use of LD_PRELOAD etc.
+       if [[ "x${LTTNG_SESSIOND_ENV_VARS}" != "x" ]]; then
+               env_vars=${LTTNG_SESSIOND_ENV_VARS}
+       fi
+
        validate_kernel_version
        if [ $? -ne 0 ]; then
            fail "Start session daemon"
@@ -419,9 +425,9 @@ function start_lttng_sessiond_opt()
        if [ -z $(pgrep ${SESSIOND_MATCH}) ]; then
                # Have a load path ?
                if [ -n "$load_path" ]; then
-                       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --load "$load_path" --background $consumerd
+                       env $env_vars $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --load "$load_path" --background $consumerd
                else
-                       $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background $consumerd
+                       env $env_vars $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background $consumerd
                fi
                #$DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --verbose-consumer >>/tmp/sessiond.log 2>&1
                status=$?
This page took 0.028054 seconds and 4 git commands to generate.