touch "${file_sync_before_last}"
# Wait for the applications started in background
- wait
+ wait "${!}"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace_date $DATE1 "$TRACE_PATH"
touch "${file_sync_before_last}"
# Wait for the applications started in background
- wait
+ wait "${!}"
stop_lttng_tracing_ok $SESSION_NAME
validate_trace_date $DATE1 $TRACE_PATH/$HOSTNAME/$SESSION_NAME*
$TESTAPP_BIN -i 1 -w 10000 \
--create-in-main ${file_create_in_main} \
--wait-before-first-event ${file_wait_before_first} 2>&1 &
+ tracee_pids+=("${!}")
while [ ! -f "${file_create_in_main}" ]; do
sleep 0.5
touch ${file_wait_before_first}
# Wait for the testapp to finish.
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok $SESSION_NAME
bail_out_if_no_babeltrace
start_lttng_sessiond
+tracee_pids=()
diag "Enable event without exclusion"
dry_run
setup_live_tracing
-# Run app in background
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
-
while [ ! -f "${file_sync_after_first}" ]; do
sleep 0.5
done
# Start the live test
$TESTDIR/regression/tools/live/live_test
-# Wait for the applications started in background
-wait
-
clean_live_tracing
rm -f ${file_sync_after_first}
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+ local pid
OUTPUT_FILE="list_ust_event.xml"
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} & 2>/dev/null
+ pid="${!}"
while [ ! -f "${file_sync_after_first}" ]; do
sleep 0.5
test "$num" -ge "12"
ok $? "Mi test: $num / 12 ust event fields discovered"
- #Wait for all background processes
- wait
+ wait "${pid}"
rm -f ${file_sync_after_first}
rm -f ${file_sync_before_last}
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
local metadata_path
+ local pid
diag "Test UST streaming with metadata regeneration"
create_lttng_session_uri $SESSION_NAME net://localhost
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+ pid="${!}"
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${pid}"
# Expect a valid trace
stop_lttng_tracing_ok $SESSION_NAME
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
local metadata_path
+ local pid
diag "Test UST local with metadata regeneration"
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 &
+ pid="${!}"
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${pid}"
# Expect a valid trace
stop_lttng_tracing_ok $SESSION_NAME
{
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+ local pid
diag "Test UST per-pid with metadata regeneration (expect failure)"
create_lttng_session_ok $SESSION_NAME $TRACE_PATH
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+ pid="${!}"
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${pid}"
regenerate_metadata_fail $SESSION_NAME
stop_lttng_tracing_ok $SESSION_NAME
{
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
+ local pid
diag "Test UST live with metadata regeneration (expect failure)"
create_lttng_session_uri $SESSION_NAME net://localhost --live
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} >/dev/null 2>&1 &
+ pid="${!}"
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${pid}"
regenerate_metadata_fail $SESSION_NAME
stop_lttng_tracing_ok $SESSION_NAME
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
--sync-after-first-event "$file_sync_after_first" \
--sync-before-last-event "$file_sync_before_last" 2>&1 &
+ pid="${!}"
while [ ! -f "${file_sync_after_first}" ]; do
sleep 0.5
lttng_snapshot_record "$session_name"
touch "$file_sync_before_last"
- wait
+ wait "${pid}"
stop_lttng_tracing_ok "$session_name"
destroy_lttng_session_ok "$session_name" --no-wait
function stop_test_apps()
{
- diag "Stopping $TESTAPP_NAME"
- kill "${APPS_PID[@]}"
- wait "${APPS_PID[@]}"
- APPS_PID=()
+ if [[ -n "${APPS_PID[*]}" ]]; then
+ diag "Stopping $TESTAPP_NAME"
+ kill "${APPS_PID[@]}"
+ wait "${APPS_PID[@]}"
+ APPS_PID=()
+ fi
}
function snapshot_add_output ()
# the status reply from the consumer quite slow thus delaying the
# registration done message.
LTTNG_UST_REGISTER_TIMEOUT=-1 $TESTAPP_BIN -i "$NR_ITER" >/dev/null 2>&1 &
+ tracee_pids+=("${!}")
done
}
start_lttng_tracing_ok $SESSION_NAME
run_apps
diag "Waiting for applications to end"
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
pass "waiting done"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
trap interrupt_cleanup SIGTERM SIGINT
BW_LIMITS=(3200 400 100)
+ tracee_pids=()
for BW in "${BW_LIMITS[@]}";
do
diag "Test high-throughput with bandwidth limit set to ${BW}kbits"
function test_ust_before_start ()
{
local file_sync_before_last=$(mktemp -u -t "tmp.test_${FUNCNAME[0]}_sync_before_last.XXXXXX")
+ local tracee_pids=()
diag "Test UST streaming BEFORE tracing starts"
create_lttng_session_uri $SESSION_NAME net://localhost
# Run 5 times with a 1 second delay
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-before-last-event ${file_sync_before_last} > /dev/null 2>&1 &
+ tracee_pids+=("${!}")
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
function test_ust_after_start ()
{
local file_sync_after_first=$(mktemp -u -t "tmp.test_${FUNCNAME[0]}_sync_after_first.XXXXXX")
+ local tracee_pids=()
diag "Test UST streaming AFTER tracing starts"
create_lttng_session_uri $SESSION_NAME net://localhost
# Run 5 times with a 1 second delay
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT \
- --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
+ --sync-after-first-event ${file_sync_after_first} >/dev/null 2>&1
+ tracee_pids+=("${!}")
while [ ! -f "${file_sync_after_first}" ]; do
sleep 0.5
destroy_lttng_session_ok $SESSION_NAME
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
rm -f ${file_sync_after_first}
}
start_lttng_tracing_ok $SESSION_NAME
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
- wait
+ wait "${!}"
ok $? "Traced application stopped."
stop_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
- wait
+ wait "${!}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_after_multiple_apps() {
local out
local i
+ local tracee_pids=()
diag "Start multiple applications AFTER tracing is started"
for i in `seq 1 5`; do
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT >/dev/null 2>&1 &
ok $? "Start application $i for tracing"
+ tracee_pids+=("${!}")
done
- wait
+ wait "${tracee_pids[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_before_multiple_apps() {
local out
local i
+ local tracee_pids=()
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
--sync-after-first-event ${file_sync_after_first}_${i} \
--sync-before-last-event ${file_sync_before_last}_${i} >/dev/null 2>&1 &
ok $? "Start application $i for tracing"
+ tracee_pids+=("${!}")
done
# BEFORE application is spawned
done
diag "Waiting for applications to end"
- wait
+ wait "${tracee_pids[@]}"
pass "Waiting done"
stop_lttng_tracing_ok $SESSION_NAME
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
ok $? "Start application to trace"
- wait
+ wait "${!}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_before_app() {
local out
+ local pid
local file_sync_after_first=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_after_first.XXXXXX")
local file_sync_before_last=$(mktemp -u -t "tmp.${FUNCNAME[0]}_sync_before_last.XXXXXX")
--sync-after-first-event ${file_sync_after_first} \
--sync-before-last-event ${file_sync_before_last} &
ok $? "Start application to trace"
+ pid="${!}"
start_lttng_tracing_ok $SESSION_NAME
touch ${file_sync_before_last}
- wait
+ wait "${pid}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT &
ok $? "Start application to trace"
- wait
+ wait "${!}"
stop_lttng_tracing_ok $SESSION_NAME
trace_match_only $EVENT_NAME $[NR_ITER * 5] $TRACE_PATH
enable_ust_lttng_event_ok $SESSION_NAME $EVENT_NAME
start_lttng_tracing_ok $SESSION_NAME
+pids=()
for i in `seq 1 $NR_APP`; do
./$CURDIR/$BIN_NAME >/dev/null 2>&1 &
+ pids+=("${!}")
done
diag "Waiting for applications to end"
-wait
+wait "${pids[@]}"
pass "Wait for applications to end"
stop_lttng_tracing_ok $SESSION_NAME
function run_app_background
{
run_app $@ &
+ tracee_pids+=("${!}")
}
function enable_jul_loglevel_only()
touch ${file_sync_before_last}
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
withapp=1
fi
+tracee_pids=()
skip $withapp "JUL support is needed. Skipping all tests." $NUM_TESTS ||
{
start_lttng_sessiond
function run_app_background
{
run_app "${@}" &
+ tracee_pids+=("${!}")
}
touch "${file_sync_before_last}"
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
# Run 5 times with a 1 second delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
# Run 5 times with a 1 second delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
test_log4j_filter_loglevel
)
+tracee_pids=()
for fct_test in "${tests[@]}";
do
TRACE_PATH=$(mktemp -d -t tmp.test_java_log4j_trace_path.XXXXXX)
function run_app_background
{
run_app "${@}" &
+ tracee_pids+=("${!}")
}
touch "${file_sync_before_last}"
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_before_start"
destroy_lttng_session_ok "log4j2_before_start"
# Run 5 times with a 1ms delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_destroy_session"
destroy_lttng_session_ok "log4j2_destroy_session"
# Run 5 times with a 1ms delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_destroy_session"
destroy_lttng_session_ok "log4j2_destroy_session"
test_log4j2_filter_loglevel
)
+tracee_pids=()
for fct_test in "${tests[@]}";
do
TRACE_PATH=$(mktemp -d -t tmp.test_java_log4j2_trace_path.XXXXXX)
function run_app_background
{
run_app "${@}" &
+ tracee_pids+=("${!}")
}
touch "${file_sync_before_last}"
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_before_start"
destroy_lttng_session_ok "log4j2_before_start"
# Run 5 times with a 1ms delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_destroy_session"
destroy_lttng_session_ok "log4j2_destroy_session"
# Run 5 times with a 1ms delay
run_app_background 0 1
# Wait for the applications started in background
- wait
+ wait "${tracee_pids[@]}"
+ tracee_pids=()
stop_lttng_tracing_ok "log4j2_destroy_session"
destroy_lttng_session_ok "log4j2_destroy_session"
test_log4j2_filter_loglevel
)
+tracee_pids=()
for fct_test in "${tests[@]}";
do
TRACE_PATH=$(mktemp --tmpdir -d tmp.test_java_log4j2_trace_path.XXXXXX)
"./$CURDIR/gen-nevents" $NR_ITER &
ok $? "Start application to generate $NR_ITER events"
-
- wait
+ wait "${!}"
pass "Wait for events to record"
for i in $(seq 0 3); do
function run_app_background
{
run_app "$@" &
+ tracee_pids+=("${!}")
}
function enable_python_loglevel_only()
# Wait for the applications started in background
echo "1" > ${go_file}
- wait
+ wait "${tracee_pids[@]}"
stop_lttng_tracing_ok $SESSION_NAME
destroy_lttng_session_ok $SESSION_NAME
skip_agent=1
fi
+tracee_pids=()
skip $skip_agent "Python agent test skipped." $NUM_TESTS ||
{
start_lttng_sessiond