From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id oy6VLL8lb2AlFAAAWB0awg (envelope-from ) for ; Thu, 08 Apr 2021 11:48:15 -0400 Received: by simark.ca (Postfix, from userid 112) id A9FF31EE0E; Thu, 8 Apr 2021 11:48:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HTML_MESSAGE,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.lttng.org (lists.lttng.org [167.114.26.123]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BDE5C1E01F for ; Thu, 8 Apr 2021 11:48:14 -0400 (EDT) Received: from lists-lttng01.efficios.com (localhost [IPv6:::1]) by lists.lttng.org (Postfix) with ESMTP id 4FGQdp0X0Pz14pr; Thu, 8 Apr 2021 11:48:14 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lists.lttng.org; s=default; t=1617896894; bh=ciWFLzfs2mF0OlRiAnLQanlXbf4+qNDDHt6DHxwNG1E=; h=References:In-Reply-To:Date:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=SrT6cfeAjUEGWSA/8VEzwEEgKvvbO/HjP0MTAhNLxmHO5wokpY3z1//lHG8vi1gwL cHJmN9jn8tam+2ocxp4TbhJMBMeJmEdXW5h1bRvszc+STHnOBzp4P0xIv+Y1NJdz5U FamI3LkkrWuk6tv+98LzlLxCvlTT/aPf3ccjWyf6KZsjPQlTQBejZuf69UNY7PrPwm tS4DHZiepF31cGyycQ+akdpLpRcY4X60O4VIKLB2O5xH1lzVhfhhb3br7MRBS5iGR1 1trRIWXRDXIbaNjZjbEeOr7+Z+SWaHigz4WkdrDeWphRVcjXy1sKnBLsVr3um2OBU3 rFoyLh60tbc6Q== Received: from mail-il1-x12c.google.com (mail-il1-x12c.google.com [IPv6:2607:f8b0:4864:20::12c]) by lists.lttng.org (Postfix) with ESMTPS id 4FGQdm5KLMz14pq for ; Thu, 8 Apr 2021 11:48:12 -0400 (EDT) Received: by mail-il1-x12c.google.com with SMTP id c3so2197614ils.2 for ; Thu, 08 Apr 2021 08:48:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=oelIagvCt1TDQ/lqySo0oajNHziyn/GB0GzRZntqX9w=; b=LYs/joidgFvRTZuCacG57EP18fa6fFc6eFWTbcE3vR0yoW+FhIAX3Cjmi4PPnfWBvg VouEMgD1swzGDrdebNwEGyQ91x0Mx5O9QW3ormryWiEBRxLFBLkCxlNaDWxFTji3/OWi ooaukCFtAKfO3w2rlp3bMH1VjrgX4ALaXVjbL1R5qR7Y9ZSLHyhGMYCEqHQ/HRgMII8k AwrIsoqqAjiwchiB54/q/CZupmsKxenH9Qj2tgpeW0tk7OnVTidy7yH5uaVM1NDtWJeK AhKQLgZ2DdqrLBh+bFYQmg8JuH+3uAaMA66t79kbI3cvZr4g5qAvifHRGQTrT7yF09h4 Q6hw== X-Gm-Message-State: AOAM5316UnZ+95oofp3jexwKl0GAdPb7SK7/pK7W2/HaJbFnzBektqSj aWBqETP3cxCD5lh32zNcwnY+WW1YEKtdzHrOKOI= X-Google-Smtp-Source: ABdhPJzDfk9G35wYYHeJ/C4UeXTxh/cPUPzElKI/NiC4pPAKlW0Wn6eHgPqZt/ipZG0mRn/1WlSTqWQQjODykheUyoI= X-Received: by 2002:a05:6e02:1584:: with SMTP id m4mr7607173ilu.108.1617896891923; Thu, 08 Apr 2021 08:48:11 -0700 (PDT) MIME-Version: 1.0 References: <20210401163710.839365-1-wallinux@gmail.com> <667805472.60438.1617809506670.JavaMail.zimbra@efficios.com> <621616245.61369.1617886095197.JavaMail.zimbra@efficios.com> In-Reply-To: <621616245.61369.1617886095197.JavaMail.zimbra@efficios.com> Date: Thu, 8 Apr 2021 17:47:59 +0200 Message-ID: To: Mathieu Desnoyers Cc: lttng-dev Subject: Re: [lttng-dev] [PATCH lttng-tools] Fix: test code assumes that child process is schedule to run before parent X-BeenThere: lttng-dev@lists.lttng.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: LTTng development list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Anders Wallin via lttng-dev Reply-To: Anders Wallin Content-Type: multipart/mixed; boundary="===============7679738367301868487==" Errors-To: lttng-dev-bounces@lists.lttng.org Sender: "lttng-dev" --===============7679738367301868487== Content-Type: multipart/alternative; boundary="00000000000086cef405bf77f990" --00000000000086cef405bf77f990 Content-Type: text/plain; charset="UTF-8" Is it OK that validate_trace_session_ust_empty and validate_trace_session_kernel_empty calls different functions? Or is it cp/paste error? function validate_trace_session_ust_empty() { validate_directory_empty "$1"/ust } function validate_trace_session_kernel_empty() { * validate_trace_empty "$1"/kernel* } Anders Wallin On Thu, Apr 8, 2021 at 2:48 PM Mathieu Desnoyers < mathieu.desnoyers@efficios.com> wrote: > > > ----- On Apr 8, 2021, at 5:22 AM, Anders Wallin > wrote: > > 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" > > Actually, this helper already exists in utils.sh: > validate_trace_session_ust_empty (), which > internally uses validate_directory_empty (). As you point out, we should > use > validate_trace_session_ust_empty for the validation of those test cases > which populate no > trace whatsoever. > > Thanks, > > Mathieu > > > Anders Wallin > > > On Wed, Apr 7, 2021 at 5:31 PM Mathieu Desnoyers < > mathieu.desnoyers@efficios.com> wrote: > >> ----- On Apr 1, 2021, at 12:37 PM, lttng-dev lttng-dev@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 >> > --- >> > 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@lists.lttng.org >> > https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev >> >> -- >> Mathieu Desnoyers >> EfficiOS Inc. >> http://www.efficios.com >> > > > -- > Mathieu Desnoyers > EfficiOS Inc. > http://www.efficios.com > --00000000000086cef405bf77f990 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Is it OK that=C2=A0validate_trace_session_ust_empty and=C2= =A0validate_trace_session_kernel_empty calls different functions?
Or is = it cp/paste error?

function validate_trace_session_ust_emp= ty()
{
validate_directory_empty "$1"/ust
}

funct= ion validate_trace_session_kernel_empty()
{
validate_trace_empty = "$1"/kernel
}

Ande= rs Wallin


<= div dir=3D"ltr" class=3D"gmail_attr">On Thu, Apr 8, 2021 at 2:48 PM Mathieu= Desnoyers <mathieu.de= snoyers@efficios.com> wrote:


----- On Apr 8, 2021, at 5:22 AM,= Anders Wallin <= wallinux@gmail.com> wrote:
OK,=C2= =A0

I tried this and for=C2=A0
- test_event_vpid_track_untrack us= t 0 "${EVENT_NAME}"
- test_event_pid_track_untrack ust 0 "= ;${EVENT_NAME}"
it works well.

For=C2=A0
- test_event_vp= id_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=C2=A0 "test_event_vpid_tracker ust 0 ...&q= uot;
1..747
# LTTng - Event tracker test
ok 1 - Start sessi= on daemon
# Test UST tracker
ok 2 - Create session tracker in -o /tmp= /tmp.lu5aeCJhQ3
ok 3 - Enable ust event tp:tptest for session trackerok 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 - T= raced application stopped.
ok 8 - Stop lttng tracing for session
ok = 9 - Destroy session tracker
not ok 10 - Failed to parse trace
# = =C2=A0 Failed test 'Failed to parse trace'
# =C2=A0 in ./reg= ression/tools/tracker//../../../utils/tap/tap.sh:fail() at line 159.
# K= illing (signal SIGTERM) lttng-sessiond and lt-lttng-sessiond pids: 11808 11= 809 11830
ok 11 - Wait after kill session daemon
# Looks like you pl= anned 747 tests but only ran 11.
# Looks like you failed 1 test of 11.
# find /tmp/tmp.lu5aeCJhQ3
/tmp/tmp.lu5aeCJhQ3
/tmp/tmp.lu5aeCJ= hQ3/ust

Do you want me to add a special version of "validate_tr= ace_empty" not returning=C2=A0
"Failed to parse trace" fo= r this? If so should it be added in "test_event_tracker" or in &q= uot;utils.sh"
Actually, this helper alrea= dy exists in utils.sh: validate_trace_session_ust_empty (), which
=
internally uses validate_directory_empty (). As you point out, we shou= ld use
validate_trace_session_ust_empty for the validation of tho= se test cases which populate no
trace whatsoever.
<= br>
Thanks,

Mathieu

Anders Wallin


On Wed, Apr 7, 2021 at 5:31 PM Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
=
----- On Apr 1, 2021, at = 12:37 PM, lttng-dev lttng-dev@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 expecte= d
behavior. AFAIU this explains why there is a small window where traced appl= ications
can generate events when none are expected.

Fixing this should solve the issues without requiring any addition to the t= est
program.

Thanks,

Mathieu

>
> Signed-off-by: Anders Wallin <wallinux@gmail.com<= /a>>
> ---
> 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=3D"LTTng - Event traker test"
> +TEST_DESC=3D"LTTng - Event tracker test"
>
> CURDIR=3D$(dirname "$0")/
> TESTDIR=3D"$CURDIR/../../.."
> @@ -30,27 +30,24 @@ SCRIPT_GROUPNAME=3D"$(id -gn)"
>
> CHILD_PID=3D-1
> WAIT_PATH=3D
> -AFTER_FIRST_PATH=3D
> -BEFORE_LAST_PATH=3D
> +BEFORE_FIRST_PATH=3D
>
> source $TESTDIR/utils/utils.sh
>
> function prepare_ust_app
> {
> -=C2=A0 =C2=A0 =C2=A0AFTER_FIRST_PATH=3D$(mktemp -u)
> -=C2=A0 =C2=A0 =C2=A0BEFORE_LAST_PATH=3D$(mktemp -u)
> +=C2=A0 =C2=A0 =C2=A0BEFORE_FIRST_PATH=3D$(mktemp -u)
>
> -=C2=A0 =C2=A0 =C2=A0$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT -a &quo= t;$AFTER_FIRST_PATH" -b
> "$BEFORE_LAST_PATH" &
> +=C2=A0 =C2=A0 =C2=A0$TESTAPP_BIN -i $NR_ITER -w $NR_USEC_WAIT --sync-= before-first-event
> "$BEFORE_FIRST_PATH" &
>=C2=A0 =C2=A0 =C2=A0 =C2=A0CHILD_PID=3D$!
> }
>
> function trace_ust_app
> {
> -=C2=A0 =C2=A0 =C2=A0touch "$BEFORE_LAST_PATH"
> +=C2=A0 =C2=A0 =C2=A0touch "$BEFORE_FIRST_PATH"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0wait
>=C2=A0 =C2=A0 =C2=A0 =C2=A0ok $? "Traced application stopped."= ;
> -=C2=A0 =C2=A0 =C2=A0rm "$BEFORE_LAST_PATH"
> -=C2=A0 =C2=A0 =C2=A0rm "$AFTER_FIRST_PATH"
> +=C2=A0 =C2=A0 =C2=A0rm "$BEFORE_FIRST_PATH"
> }
>
> function prepare_kernel_app
> --
> 2.31.1
>
> _______________________________________________
> lttng-dev mailing list
>
lttng-dev@lists.lttng.org
> https://= lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

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


--
=
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
--00000000000086cef405bf77f990-- --===============7679738367301868487== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ lttng-dev mailing list lttng-dev@lists.lttng.org https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev --===============7679738367301868487==--