[lttng-dev] [PATCH lttng-tools] Fix: test code assumes that child process is schedule to run before parent

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed Apr 7 11:31:46 EDT 2021


----- On Apr 1, 2021, at 12:37 PM, lttng-dev lttng-dev at lists.lttng.org wrote:

> the following tests fails
> - test_event_vpid_tracker ust 0 "${EVENT_NAME}"
> - test_event_vpid_track_untrack ust 0 "${EVENT_NAME}"
> - test_event_pid_tracker ust 0 "${EVENT_NAME}"
> - test_event_pid_track_untrack ust 0 "${EVENT_NAME}"

There is indeed an issue with these tests: there is a missing "untrack all pids"
which should be done at the very beginning of each test to have the expected
behavior. AFAIU this explains why there is a small window where traced applications
can generate events when none are expected.

Fixing this should solve the issues without requiring any addition to the test
program.

Thanks,

Mathieu

> 
> Signed-off-by: Anders Wallin <wallinux at gmail.com>
> ---
> tests/regression/tools/tracker/test_event_tracker | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/regression/tools/tracker/test_event_tracker
> b/tests/regression/tools/tracker/test_event_tracker
> index 711690af..78e9310b 100755
> --- a/tests/regression/tools/tracker/test_event_tracker
> +++ b/tests/regression/tools/tracker/test_event_tracker
> @@ -5,7 +5,7 @@
> #
> # SPDX-License-Identifier: GPL-2.0-only
> 
> -TEST_DESC="LTTng - Event traker test"
> +TEST_DESC="LTTng - Event tracker test"
> 
> CURDIR=$(dirname "$0")/
> TESTDIR="$CURDIR/../../.."
> @@ -30,27 +30,24 @@ SCRIPT_GROUPNAME="$(id -gn)"
> 
> CHILD_PID=-1
> WAIT_PATH=
> -AFTER_FIRST_PATH=
> -BEFORE_LAST_PATH=
> +BEFORE_FIRST_PATH=
> 
> source $TESTDIR/utils/utils.sh
> 
> function prepare_ust_app
> {
> -	AFTER_FIRST_PATH=$(mktemp -u)
> -	BEFORE_LAST_PATH=$(mktemp -u)
> +	BEFORE_FIRST_PATH=$(mktemp -u)
> 
> -	$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a "$AFTER_FIRST_PATH" -b
> "$BEFORE_LAST_PATH" &
> +	$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-before-first-event
> "$BEFORE_FIRST_PATH" &
> 	CHILD_PID=$!
> }
> 
> function trace_ust_app
> {
> -	touch "$BEFORE_LAST_PATH"
> +	touch "$BEFORE_FIRST_PATH"
> 	wait
> 	ok $? "Traced application stopped."
> -	rm "$BEFORE_LAST_PATH"
> -	rm "$AFTER_FIRST_PATH"
> +	rm "$BEFORE_FIRST_PATH"
> }
> 
> function prepare_kernel_app
> --
> 2.31.1
> 
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com


More information about the lttng-dev mailing list