fi
}
-echo -e "\n---------------------"
-echo -e "Testing Kernel tracer"
-echo -e "---------------------"
+
+TEST_DESC="Testing Kernel tracer"
+
+print_test_banner "$TEST_DESC"
# Detect lttng-modules installed
check_lttng_modules
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="Streaming - Kernel tracing"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n---------------------------"
-echo -e " Streaming - Kernel tracing "
-echo -e "----------------------------"
+print_test_banner "$TEST_DESC"
if [ "$(id -u)" != "0" ]; then
echo "This test must be running as root. Aborting"
# Create session with default path
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $SESSION_NAME >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
# Create session with default path
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-consumer -k net://localhost >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="Streaming - User space tracing"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n-------------------------------"
-echo -e " Streaming - User space tracing "
-echo -e "--------------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/$BIN_NAME" ]; then
echo -e "No UST nevents binary detected. Passing."
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="Streaming - URI switching"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n"
-echo -e "---------------------------"
-echo -e " Streaming - URI switching "
-echo -e "---------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/$BIN_NAME" ]; then
echo -e "No UST nevents binary detected. Skipping."
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="UST tracer - Start tracing before and after execution"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n----------------------------------------------------"
-echo -e "UST tracer - Star tracing before and after execution"
-echo -e "----------------------------------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/gen-nevents" ]; then
echo -e "No UST nevents binary detected. Passing."
# Start test
echo -n "Starting application... "
./$CURDIR/gen-nevents $NR_ITER
- echo -e "Ended \e[1;32mOK\e[0m"
+ echo -n "Ended "
+ print_ok
stop_tracing $SESSION_NAME
destroy_lttng_session $SESSION_NAME
echo -n "Starting application... "
./$CURDIR/gen-nevents 100 &
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
# BEFORE application is spawned
create_lttng_session $SESSION_NAME $TRACE_PATH
out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
if [ $out -eq 0 ]; then
echo -n "No event found. Suppose to have at least one... "
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
out=1
else
echo -n "Found $out event(s). Coherent... "
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
out=0
fi
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="UST tracer - Testing high events throughput"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n-------------------------------------------"
-echo -e "UST tracer - Testing high events throughput"
-echo -e "-------------------------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/$BIN_NAME" ]; then
echo -e "No UST nevents binary detected. Passing."
if [ $wanted -ne $total ]; then
echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
out=1
else
echo -n "Expected $wanted. Dropped $dropped. Recorded $traced. Total $total... "
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
out=0
fi
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="UST tracer - Testing low events throughput"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n-------------------------------------------"
-echo -e "UST tracer - Testing low events throughput"
-echo -e "-------------------------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/$BIN_NAME" ]; then
echo -e "No UST nevents binary detected. Passing."
if [ $out -eq 0 ]; then
echo -n "Trace is coherent... "
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
else
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
fi
rm -rf $TRACE_PATH
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+TEST_DESC="UST tracer - Multi-session"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
source $TESTDIR/utils.sh
-echo -e "\n--------------------------"
-echo -e "UST tracer - Multi-session"
-echo -e "--------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/gen-nevents" ]; then
echo -e "No UST nevents binary detected. Passing."
echo -n "Starting application generating $NR_ITER events... "
./$CURDIR/gen-nevents $NR_ITER &
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
# At least hit one event
echo -n "Waiting for events to record "
echo -n "."
sleep 0.1
done
- echo -e "\e[1;32m OK\e[0m"
+ print_ok
for i in `seq 0 3`; do
stop_tracing "$SESSION_NAME-$i"
out=$(babeltrace "$TRACE_PATH/$i" | grep "$EVENT_NAMEi$i" | wc -l)
if [ $out -ne $NR_ITER ]; then
echo -n "No event found. Suppose to have at least one... "
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
out=1
else
echo -n "Found $out event(s) for $SESSION_NAME-$i. Coherent... "
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
out=0
fi
done
# You should have received a copy of the GNU Lesser General Public License
# along with this library; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+NR_ITER=100
+TEST_DESC="UST tracer - Generate $NR_ITER process"
CURDIR=$(dirname $0)/
TESTDIR=$CURDIR/../..
-NR_ITER=100
TEST_BIN_NAME="gen-events-time"
source $TESTDIR/utils.sh
-echo -e "\n-------------------------------------"
-echo -e "UST tracer - Generate $NR_ITER process"
-echo -e "---------------------------------------"
+print_test_banner "$TEST_DESC"
if [ ! -x "$CURDIR/$TEST_BIN_NAME" ]; then
echo -e "No UST $TEST_BIN_NAME binary detected. Passing."
listing=$($TESTDIR/../src/bin/lttng/$LTTNG_BIN list -u)
reg_app_count=$(echo -n $listing | sed "s/$TEST_BIN_NAME/$TEST_BIN_NAME\n/g" | grep "$TEST_BIN_NAME" | wc -l)
if [ "$reg_app_count" -ne "$NR_ITER" ]; then
- echo -e "$reg_app_count apps listed. Expected $NR_ITER \e[1;31mFAILED\e[0m"
+ echo -e "$reg_app_count apps listed. Expected $NR_ITER "
+ print_fail
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
TRACE_PATH=$(mktemp -d)
echo -e -n "Killing all spawned applications..."
killall -q $TEST_BIN_NAME >/dev/null 2>&1 &
-echo -e "\e[1;32mOK\e[0m"
+print_ok
exit 0
rm -rf $tmpdir
}
-echo -e "\n-------------------------------------------"
-echo -e "UST tracer - Global domain (LTTNG_DOMAIN_UST)"
-echo -e "---------------------------------------------"
+TEST_DESC="UST tracer - Global domain (LTTNG_DOMAIN_UST)"
+
+print_test_banner "$TEST_DESC"
start_tests
$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"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
fi
echo -n "Enabling kernel event $event_name for session $sess_name"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -k >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
$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"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -e -n "Killing lttng-relayd (pid: $PID_RELAYD)... "
kill $PID_RELAYD >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
out=1
out=$(pidof lt-$RELAYD_BIN)
sleep 0.5
done
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
return 0
fi
}
echo -e -n "Killing session daemon... "
kill $PID_SESSIOND >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
out=1
out=$(pidof lt-$SESSIOND_BIN)
sleep 0.5
done
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Creating lttng session $sess_name in $trace_path "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN create $sess_name -o $trace_path >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Enabling lttng channel $channel_name for session $sess_name"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-channel $channel_name -s $sess_name >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Disabling lttng channel $channel_name for session $sess_name"
$TESTDIR/../src/bin/lttng/$LTTNG_BIN disable-channel $channel_name -s $sess_name >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Enabling lttng event $event_name for session $sess_name "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN enable-event $event_name -s $sess_name -u >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Start lttng tracing for session $sess_name "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN start $sess_name >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Stop lttng tracing for session $sess_name "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN stop $sess_name >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
echo -n "Destroy lttng session $sess_name "
$TESTDIR/../src/bin/lttng/$LTTNG_BIN destroy $sess_name >/dev/null 2>&1
if [ $? -eq 1 ]; then
- echo -e '\e[1;31mFAILED\e[0m'
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
fi
}
count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
if [ "$count" -ne "$nr_iter" ]; then
- echo -e "$count found in trace \e[1;31mFAILED\e[0m"
+ echo -n "$count found in trace "
+ print_fail
return 1
else
- echo -e "Trace is coherent \e[1;32mOK\e[0m"
+ echo -n "Trace is coherent "
+ print_ok
return 0
fi
}
echo -n "Validating trace for event $event_name... "
traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep $event_name | wc -l)
if [ $traced -eq 0 ]; then
- echo -e "\e[1;31mFAILED\e[0m"
+ print_fail
return 1
else
- echo -e "\e[1;32mOK\e[0m"
+ print_ok
return 0
fi
}