Tests: Add helper functions for printing status and banner
[lttng-tools.git] / tests / utils.sh
index 1ca298562aeb8afca9b2f9bd29494383fabc4d45..8fcb0da38c2a8f4a3f9ca8af0484edf8b8aa4ee3 100644 (file)
@@ -25,6 +25,38 @@ KERNEL_MAJOR_VERSION=2
 KERNEL_MINOR_VERSION=6
 KERNEL_PATCHLEVEL_VERSION=27
 
+function print_ok ()
+{
+       # Check if we are a terminal
+       if [ -t 1 ]; then
+               echo -e "\e[1;32mOK\e[0m"
+       else
+               echo -e "OK"
+       fi
+}
+
+function print_fail ()
+{
+       # Check if we are a terminal
+       if [ -t 1 ]; then
+               echo -e "\e[1;31mFAIL\e[0m"
+       else
+               echo -e "FAIL"
+       fi
+}
+
+function print_test_banner ()
+{
+       desc="$1"
+
+       count=$((${#desc}+2))
+       str=$(printf "%${count}s");
+       echo -e "\n"
+       echo -e ${str// /-}
+       echo -e " $desc "
+       echo -e ${str// /-}
+}
+
 function validate_kernel_version ()
 {
        kern_version=($(uname -r | awk -F. '{ printf("%d.%d.%d\n",$1,$2,$3); }' | tr '.' '\n'))
@@ -64,6 +96,7 @@ function spawn_sessiond ()
 
        if [ -z $(pidof lt-$SESSIOND_BIN) ]; then
                $DIR/../src/bin/lttng-sessiond/$SESSIOND_BIN --daemonize --quiet --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 --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 &
                if [ $? -eq 1 ]; then
                        echo -e "\e[1;31mFAILED\e[0m"
                        return 1
@@ -105,6 +138,7 @@ function lttng_start_relayd
 
        if [ -z $(pidof lt-$RELAYD_BIN) ]; then
                $DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt >/dev/null 2>&1 &
+               #$DIR/../src/bin/lttng-relayd/$RELAYD_BIN $opt -vvv >>/tmp/relayd.log 2>&1 &
                if [ $? -eq 1 ]; then
                        echo -e "\e[1;31mFAILED\e[0m"
                        return 1
This page took 0.023389 seconds and 4 git commands to generate.