X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=tests%2Futils%2Futils.sh;h=3964e3b12820901957d68f1bf1bbe91497a99b88;hp=35207929eca6afd63394c63a7f7d556c579f3489;hb=b89c3a68195f2b41a803a66e8acc57ea8eac5289;hpb=db7b260cfaefc5c9065650ac21bfe21c2e401192 diff --git a/tests/utils/utils.sh b/tests/utils/utils.sh index 35207929e..3964e3b12 100644 --- a/tests/utils/utils.sh +++ b/tests/utils/utils.sh @@ -33,6 +33,12 @@ KERNEL_PATCHLEVEL_VERSION=27 # systems. Specialized tests should test those corner-cases. export LTTNG_UST_REGISTER_TIMEOUT=-1 +# We set the default lttng-sessiond path to /bin/true to prevent the spawning +# of a daemonized sessiond. This is necessary since 'lttng create' will spawn +# its own sessiond if none is running. It also ensures that 'lttng create' +# fails when no sessiond is running. +export LTTNG_SESSIOND_PATH="/bin/true" + source $TESTDIR/utils/tap/tap.sh function print_ok () @@ -82,7 +88,17 @@ function validate_kernel_version () function randstring() { [ "$2" == "0" ] && CHAR="[:alnum:]" || CHAR="[:graph:]" - cat /dev/urandom | tr -cd "$CHAR" | head -c ${1:-16} + cat /dev/urandom 2>/dev/null | tr -cd "$CHAR" 2>/dev/null | head -c ${1:-16} 2>/dev/null + echo +} + +# Return the number of _configured_ CPUs. +function conf_proc_count() +{ + getconf _NPROCESSORS_CONF + if [ $? -ne 0 ]; then + diag "Failed to get the number of configured CPUs" + fi echo } @@ -362,7 +378,7 @@ function start_lttng_sessiond_opt() if [ -z $(pgrep --full lt-$SESSIOND_BIN) ]; then # Have a load path ? if [ -n "$load_path" ]; then - $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --load "$1" --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" + $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --load "$load_path" --background --consumerd32-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" --consumerd64-path="$DIR/../src/bin/lttng-consumerd/lttng-consumerd" else $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" fi