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

Anders Wallin wallinux at gmail.com
Thu Apr 8 05:22:18 EDT 2021


OK,

I tried this and for
- test_event_vpid_track_untrack ust 0 "${EVENT_NAME}"
- test_event_pid_track_untrack ust 0 "${EVENT_NAME}"
it works well.

For
- test_event_vpid_tracker ust 0 "${EVENT_NAME}"
- test_event_pid_tracker ust 0 "${EVENT_NAME}"
validate_trace_empty fails since there is no data at all in the trace_path

This run is just calling copy of test_event_tracker running only
"test_event_vpid_tracker ust 0 ..."
1..747
# LTTng - Event tracker test
ok 1 - Start session daemon
# Test UST tracker
ok 2 - Create session tracker in -o /tmp/tmp.lu5aeCJhQ3
ok 3 - Enable ust event tp:tptest for session tracker
ok 4 - Untrack command with opts: -u --all --vpid
ok 5 - Start tracing for session
ok 6 - Track command with opts: -u --vpid 11842
ok 7 - Traced application stopped.
ok 8 - Stop lttng tracing for session
ok 9 - Destroy session tracker


*not ok 10 - Failed to parse trace#   Failed test 'Failed to parse trace'*#
  in ./regression/tools/tracker//../../../utils/tap/tap.sh:fail() at line
159.
# Killing (signal SIGTERM) lttng-sessiond and lt-lttng-sessiond pids: 11808
11809 11830
ok 11 - Wait after kill session daemon
# Looks like you planned 747 tests but only ran 11.
# Looks like you failed 1 test of 11.

# find /tmp/tmp.lu5aeCJhQ3
/tmp/tmp.lu5aeCJhQ3
/tmp/tmp.lu5aeCJhQ3/ust

Do you want me to add a special version of "validate_trace_empty" not
returning
"Failed to parse trace" for this? If so should it be added in
"test_event_tracker" or in "utils.sh"

Anders Wallin


On Wed, Apr 7, 2021 at 5:31 PM Mathieu Desnoyers <
mathieu.desnoyers at efficios.com> wrote:

> ----- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20210408/93ff5d8e/attachment.htm>


More information about the lttng-dev mailing list