The following dependencies are optional:
* **https://babeltrace.org/[Babeltrace{nbsp}2]**: default viewer
- of the https://lttng.org/man/1/lttng-view/[`lttng view`] command.
+ of the https://lttng.org/man/1/lttng-view/[`lttng view`] command,
+ `make{nbsp}check` and tests.
+
Debian/Ubuntu package: `babeltrace2`
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
+
function validate_trace_date
{
local test_date=$1
local trace_path=$2
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
-
res=$($BABELTRACE_BIN --clock-date $trace_path 2>/dev/null | head -1 | grep $test_date)
if [ $? -eq 0 ]; then
pass "Validate trace at date $test_date"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
skip $isroot "Root access is needed. Skipping all tests." "$NUM_TESTS" ||
{
- which "$BABELTRACE_BIN" > /dev/null
- test $? -ne 0
- skip $? "Babeltrace binary not found. Skipping callstack tests" "$NUM_TESTS" ||
- {
- start_lttng_sessiond
+ start_lttng_sessiond
- if test $RUN_USERSPACE_TEST == 1; then
- test_user_callstack
- fi
+ if test $RUN_USERSPACE_TEST == 1; then
+ test_user_callstack
+ fi
- test_kernel_callstack
+ test_kernel_callstack
- stop_lttng_sessiond
- }
+ stop_lttng_sessiond
}
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
TESTS=(
"test_clock_override_metadata"
"test_clock_override_timestamp"
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_relayd "-o $TRACE_PATH"
start_lttng_sessiond
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
if [ ! -x "$TESTAPP_BIN" ]; then
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
streaming_tests=(test_ust_streaming
test_ust_streaming_rotate_clear
test_ust_streaming_clear_rotate
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
function start_test_app()
{
local tmp_file=$(mktemp --tmpdir -u "tmp.${FUNCNAME[0]}.XXXXXX")
run_apps
stop_lttng_tracing_ok $SESSION_NAME
- nb_events=$(babeltrace $trace_path | wc -l)
+ nb_events=$("$BABELTRACE_BIN" $trace_path | wc -l)
if [ "$nb_events" -ne "0" ]; then
ok 0 "Events were found during the dry run without exclusion"
else
# Destroy session
destroy_lttng_session_ok $SESSION_NAME
- stats=`babeltrace $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null`
+ stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null`
if [ ! -z "$stats" ]; then
fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
else
# Destroy session
destroy_lttng_session_ok $SESSION_NAME
- stats=$(babeltrace $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null)
+ stats=$("$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint "$event_name_expected_to_be_missing" | grep -v index 2> /dev/null)
if [ ! -z "$stats" ]; then
fail "Excluded event \"$event_name_expected_to_be_missing\" was found in trace!"
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
diag "Enable event without exclusion"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
OLDIFS="$IFS"
IFS=$'\n'
INVALID_FILTERS=(
# Destroy session
destroy_lttng_session_ok $SESSION_NAME
- stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name`
+ stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
rm -rf $trace_path
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
issue_356_filter="intfield > 0 && intfield > 1 && "
issue_356_filter+="intfield > 2 && intfield > 3 && "
issue_356_filter+="intfield > 4 && intfield > 5 && "
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
function test_custom_url()
{
# Create session with custom URL
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
if [ "$(id -u)" == "0" ]; then
isroot=1
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
# Use LTTNG_HOME since we want the complete "default" lttng directory hierarchy
# with "<session_name>-<datetime>/...".
LTTNG_HOME="$TRACE_PATH"
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_relayd "-o $TRACE_PATH"
start_lttng_sessiond
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_sessiond
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
tests=(
test_ust_uid_live
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
if [ "$(id -u)" == "0" ]; then
isroot=1
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_relayd "-o $TRACE_PATH"
start_lttng_sessiond
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
tests=( test_ust_list_output
test_ust_local_snapshot
TEMP_FILE=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file1.XXXXXX)
TEMP_FILE_2=$(mktemp --tmpdir tmp.streaming_high_throughput_limit_file2.XXXXXX)
- traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
- babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
+ traced=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
+ "$BABELTRACE_BIN" $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_relayd "-o $TRACE_PATH"
start_lttng_sessiond
[ "$(get_stream_file_count "$trace_path" "$stream_pattern")" -eq "$count_limit" ]
ok $? "Stream meets the trace file limit of $count_limit"
- stats=`babeltrace $trace_path | $STATS_BIN --tracepoint $event_name`
+ stats=`"$BABELTRACE_BIN" $trace_path | $STATS_BIN --tracepoint $event_name`
validate_min_max "$stats" "intfield" "[0-9]+" "$expected_max"
ok $? "Trace validation - intfield"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
for limit in "${LIMITS[@]}";
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
# Test with multiples of PAGE_SIZE
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
diag "Test UST tracker"
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_sessiond_notap
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
diag "Test UST wildcard"
# Check for statedump events in the resulting trace
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
start_event_found = False
bin_info_event_found = False
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
start_lttng_sessiond
destroy_lttng_session_ok $SESSION_NAME
stop_lttng_sessiond
- nr_events=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
+ nr_events=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
test $nr_events -eq $NUM_EVENT
ok $? "No event lost with UST blocking mode: found $nr_events expect $NUM_EVENT"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
TESTS=(
"test_ust_implicit_no_blocking"
"test_ust_implicit_no_blocking_with_channel_blocking"
rm -f ${file_sync_before_last}_${i}
done
- out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+ out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
if [ $out -eq 0 ]; then
fail "Trace validation"
diag "No event(s) found. We are supposed to have at least one."
rm -f ${file_sync_after_first}
rm -f ${file_sync_before_last}
- out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+ out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
if [ $out -eq 0 ]; then
fail "Trace validation"
diag "No event(s) found. We are supposed to have at least one."
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
TESTS=(
"test_before_app"
"test_after_app"
stop_session(session_info)
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.")
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
before_daemon_event_found = False
before_daemon_event_pid = -1
# Check both events (normal exit and suicide messages) are present in the resulting trace
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.")
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
event_lines = []
for event_line in babeltrace_process.stdout:
# Check both events (normal exit and suicide messages) are present in the resulting trace
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
event_lines = []
for event_line in babeltrace_process.stdout:
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ ! -x "$CURDIR/.libs/lttng-ust-getcpu-override-test.so" ]; then
skip 0 "No shared object generated. Skipping all tests." $NUM_TESTS && exit 0
fi
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
TEMP_FILE=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file1.XXXXXX)
TEMP_FILE_2=$(mktemp --tmpdir tmp.test_high_throughput_tmp_file2.XXXXXX)
-traced=$(babeltrace $TRACE_PATH 2>/dev/null | wc -l)
-babeltrace $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
+traced=$("$BABELTRACE_BIN" $TRACE_PATH 2>/dev/null | wc -l)
+"$BABELTRACE_BIN" $TRACE_PATH >/dev/null 2>$TEMP_FILE_2
cat $TEMP_FILE_2 | cut -f4 -d " " >$TEMP_FILE
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ ! -f "$TESTAPP_PATH.class" ]; then
withapp=0
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ ! -f "$TESTAPP_PATH.class" ]; then
withapp=0
else
# Check for malloc events in the resulting trace
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
malloc_event_found = False
free_event_found = False
continue
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.")
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
# We should find 8 events in the resulting trace
event_entries = []
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
last_val=0
out=0
-babeltrace $TRACE_PATH | while read event;
+"$BABELTRACE_BIN" $TRACE_PATH | while read event;
do
val=$(echo $event | cut -f10 -d" ")
val=${val%?}
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
TESTS=(
"test_dlopen_same_provider_name_same_event"
"test_dlopen_same_provider_name_different_event"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
system_has_ns=0
if [ -d "/proc/$$/ns" ]; then
system_has_ns=1
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
isroot=0
if [ "$(id -u)" == "0" ]; then
isroot=1
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ -x "$CURDIR/demo/demo" ]; then
foundbin=1
else
{
local out
- out=$(babeltrace $TRACE_PATH | grep $EVENT_NAME | wc -l)
+ out=$("$BABELTRACE_BIN" $TRACE_PATH | grep $EVENT_NAME | wc -l)
if [ $out -eq 0 ]; then
fail "Trace validation"
diag "No event(s) found. We are supposed to have at least one."
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
TESTS=(
"test_before_app_uid"
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
if [ "$(id -u)" == "0" ]; then
isroot=1
else
print_test_banner "$TEST_DESC"
+bail_out_if_no_babeltrace
+
start_lttng_sessiond
TRACE_PATH=$(mktemp --tmpdir -d tmp.test_event_tracef_trace_path.XXXXXX)
# Check event fields using type declarations are present
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.")
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN))
event_lines = []
for event_line in babeltrace_process.stdout:
# Check for dl events in the resulting trace
try:
- babeltrace_process = subprocess.Popen(["babeltrace", session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ babeltrace_process = subprocess.Popen([BABELTRACE_BIN, session_info.trace_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except FileNotFoundError:
- bail("Could not open babeltrace. Please make sure it is installed.", session_info)
+ bail("Could not open {}. Please make sure it is installed.".format(BABELTRACE_BIN), session_info)
dlopen_event_found = 0
dlmopen_event_found = 0
sys.path.append(lttng_bindings_libs_path)
from lttng import *
+BABELTRACE_BIN="babeltrace2"
class SessionInfo:
def __init__(self, handle, session_name, tmp_directory, channel_name):
RELAYD_BIN="lttng-relayd"
RELAYD_MATCH=".*lttng-relayd.*"
LTTNG_BIN="lttng"
-BABELTRACE_BIN="babeltrace"
+BABELTRACE_BIN="babeltrace2"
OUTPUT_DEST=/dev/null
ERROR_OUTPUT_DEST=/dev/null
MI_XSD_MAJOR_VERSION=4
pass "Waiting for live viewers on url: $url"
}
+function bail_out_if_no_babeltrace()
+{
+ which "$BABELTRACE_BIN" >/dev/null
+ if [ $? -ne 0 ]; then
+ LTTNG_BAIL_OUT "\"$BABELTRACE_BIN\" binary not found. Skipping tests"
+ fi
+}
+
function validate_metadata_event ()
{
local event_name=$1
local metadata_file=$(find $trace_path -name "metadata")
local metadata_path=$(dirname $metadata_file)
- which $BABELTRACE_BIN >/dev/null
- skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+ bail_out_if_no_babeltrace
local count=$($BABELTRACE_BIN --output-format=ctf-metadata $metadata_path | grep $event_name | wc -l)
local nr_iter=$2
local trace_path=$3
- which $BABELTRACE_BIN >/dev/null
- skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+ bail_out_if_no_babeltrace
local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
local nr_iter=$2
local trace_path=$3
- which $BABELTRACE_BIN >/dev/null
- skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+ bail_out_if_no_babeltrace
+ #which "$BABELTRACE_BIN" >/dev/null
+ #skip $? -ne 0 "\"$BABELTRACE_BIN\" binary not found. Skipping trace comparison"
local count=$($BABELTRACE_BIN $trace_path | grep $event_name | wc -l)
local total=$($BABELTRACE_BIN $trace_path | wc -l)
local event_name=$1
local trace_path=$2
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
+ bail_out_if_no_babeltrace
OLDIFS=$IFS
IFS=","
local trace_path=$2
local expected_count=$3
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
+ bail_out_if_no_babeltrace
cnt=0
OLDIFS=$IFS
local expected_min=$3
local expected_max=$4
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
+ bail_out_if_no_babeltrace
cnt=0
OLDIFS=$IFS
{
local trace_path=$1
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
-
$BABELTRACE_BIN $trace_path 2>/dev/null | head -n 1
}
local event_exp=$1
local trace_path=$2
- which $BABELTRACE_BIN >/dev/null
- skip $? -ne 0 "Babeltrace binary not found. Skipping trace validation"
+ bail_out_if_no_babeltrace
traced=$($BABELTRACE_BIN $trace_path 2>/dev/null | grep --extended-regexp ${event_exp} | wc -l)
if [ "$traced" -ne 0 ]; then
local event_exp=$1
local trace_path=$2
- which $BABELTRACE_BIN >/dev/null
- skip $? -ne 0 "Babeltrace binary not found. Skipping trace matches"
+ bail_out_if_no_babeltrace
local count=$($BABELTRACE_BIN $trace_path | grep --extended-regexp ${event_exp} | wc -l)
local total=$($BABELTRACE_BIN $trace_path | wc -l)
{
local trace_path=$1
- which $BABELTRACE_BIN >/dev/null
- if [ $? -ne 0 ]; then
- skip 0 "Babeltrace binary not found. Skipping trace validation"
- fi
+ bail_out_if_no_babeltrace
events=$($BABELTRACE_BIN $trace_path 2>/dev/null)
ret=$?