From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88C42A0597; Tue, 21 Apr 2020 14:53:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C36F51C2EE; Tue, 21 Apr 2020 14:53:22 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 2E73A1C2DB for ; Tue, 21 Apr 2020 14:53:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587473600; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Hb7sZm1ycesg12FmCtx7FPKvBkAlHIjs3CEeHFjW6Y8=; b=aHWe1CSY4faC78y84tgIsPjS5m2rKG8mQJgcuto1Q5ttFqpPTBLH817V62GRUwej31Qn6O JOaXUpMOEVargpYBl+ZCE7eujOK2hz+1NvuAlrmUSP3pCyLH7j3HhUCFNlAGfhiEnUTy8A OXfYRRa3qmqjf6+SsHbCcGU60lYwUIQ= Received: from mail-vk1-f197.google.com (mail-vk1-f197.google.com [209.85.221.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-387-rjSswoEFO4KAEK-FUXDAJA-1; Tue, 21 Apr 2020 08:53:09 -0400 X-MC-Unique: rjSswoEFO4KAEK-FUXDAJA-1 Received: by mail-vk1-f197.google.com with SMTP id q136so5266358vkq.6 for ; Tue, 21 Apr 2020 05:53:08 -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=coX1o+j/04FiJpHCjO8ToLW/iyexIR5FYsAxGQw+Aqw=; b=D1HVe6CXFQqUwy26IVkvnjX5XWCKcvLViZsQMyCqFw0ydB5Txi3fA+QF3YuIKg7csv OS3gcdp/qf8g2IHKryUaaMqoU1WRlYExRvgoPGTOgL99Uaa+EnxCrVU6CIswfu8fluyi 4d9G1AltBqzWN8q4ZMrcrXGo0IfaaJlNqrEg3d3d35gtjPHkqzKu3pvvuIhWUW8wUd4b lTjiSX63gokj6adDjF8IEdtB+FwBhxoYppcB2WA8e6uEAzEu9+xTu8nZaWTFPhY9BL6J L4sfSlWnVxp9SvBAJS9lCFrzOaymnl54mxf5hHOsyfVZ0DNtNIK9B1fRRdX/Ay2kddkn 5Hiw== X-Gm-Message-State: AGi0PuZFyBs6qaRGrgo/iD8aO1oRU5+C35Bsep2uD4Y/ONb5fVzo5L4E gyS4KYYO+ae/TEPuibSyvais3npC7dqtKGKyQTQRSZKYFVFLcSk130RgaAYa8vH0R5t1TZ+5w6m Gfxvmiv3TVmg+z87IXg4= X-Received: by 2002:a05:6102:1043:: with SMTP id h3mr15699615vsq.39.1587473588432; Tue, 21 Apr 2020 05:53:08 -0700 (PDT) X-Google-Smtp-Source: APiQypJbPFRncGsFbHnvm05gLsVCTO/Mpo/cXtIhfMDDa8x1oA3SnT7UUP1b27QHxgoox/gx78tXA7vIJfXfdWDOyJU= X-Received: by 2002:a05:6102:1043:: with SMTP id h3mr15699597vsq.39.1587473588131; Tue, 21 Apr 2020 05:53:08 -0700 (PDT) MIME-Version: 1.0 References: <20200413150116.734047-1-jerinj@marvell.com> <20200419100133.3232316-1-jerinj@marvell.com> <20200419100133.3232316-28-jerinj@marvell.com> In-Reply-To: <20200419100133.3232316-28-jerinj@marvell.com> From: David Marchand Date: Tue, 21 Apr 2020 14:52:57 +0200 Message-ID: To: Jerin Jacob Kollanukkaran Cc: dev , Thomas Monjalon , Bruce Richardson , =?UTF-8?Q?Mattias_R=C3=B6nnblom?= , Sunil Kumar Kori X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [dpdk-dev] [PATCH v6 27/33] eal/trace: add unit test cases X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Sun, Apr 19, 2020 at 12:03 PM wrote: > > From: Sunil Kumar Kori > > Example commands to run UT and check the traces with babeltrace viewer. > > - Delete the existing /root/dpdk-traces/ directory if needed. > > sudo rm -rf /root/dpdk-traces/ > > - Start the dpdk-test > > sudo ./build/app/test/dpdk-test -c 0x3 - --trace=3D.* Unit tests are there to do sanity/non regression checks. Here you describe a manual test procedure. Could it work in the CI for the functional parts? > > - Run trace_autotest > > trace_autotest > > - View the traces with babletrace viewer. > > sudo babeltrace /root/dpdk-traces/ > > Signed-off-by: Sunil Kumar Kori [snip] > diff --git a/app/test/test_trace.c b/app/test/test_trace.c > new file mode 100644 > index 000000000..26b403e62 > --- /dev/null > +++ b/app/test/test_trace.c > @@ -0,0 +1,223 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2020 Marvell International Ltd. > + */ > + > +#include > +#include > +#include > + > +#include "test.h" > +#include "test_trace.h" > + > +static int32_t > +test_trace_point_globbing(void) > +{ > + bool val; > + int rc; > + > + rc =3D rte_trace_pattern("app.dpdk.test*", false); > + if (rc !=3D 1) > + goto failed; > + > + val =3D rte_trace_point_is_enabled(&__app_dpdk_test_tp); > + if (val =3D=3D true) > + goto failed; No need to test a boolean against true/false values. Idem for the rest of this code. > + > + rc =3D rte_trace_pattern("app.dpdk.test*", true); > + if (rc !=3D 1) > + goto failed; > + > + val =3D rte_trace_point_is_enabled(&__app_dpdk_test_tp); > + if (val =3D=3D false) > + goto failed; > + [snip] > +static int > +test_trace_mode(void) > +{ > + enum rte_trace_mode current; > + > + current =3D rte_trace_mode_get(); > + > + if (rte_trace_is_enabled() =3D=3D false) > + return TEST_SKIPPED; This test would always be skipped if we called it from the CI, as it requires the dpdk-test binary to be started with traces on. > + > + rte_trace_mode_set(RTE_TRACE_MODE_DISCARD); > + if (rte_trace_mode_get() !=3D RTE_TRACE_MODE_DISCARD) > + goto failed; > + [snip] > diff --git a/app/test/test_trace_register.c b/app/test/test_trace_registe= r.c > new file mode 100644 > index 000000000..1735149a2 > --- /dev/null > +++ b/app/test/test_trace_register.c > @@ -0,0 +1,17 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(C) 2020 Marvell International Ltd. > + */ > +#define RTE_TRACE_POINT_REGISTER_SELECT /* Select trace point register m= acros */ I noticed this comment is copy/pasted in all trace points "register" code. This does not help. The documentation on the other side does not describe this macro which is quite important for developers adding tracepoints to their code (Thomas already commented about it on the doc patch). > + > +#include "test_trace.h" > + > +/* Define trace points */ > +RTE_TRACE_POINT_DEFINE(app_dpdk_test_tp); > +RTE_TRACE_POINT_DEFINE(app_dpdk_test_fp); > + > +RTE_INIT(register_valid_trace_points) > +{ > + RTE_TRACE_POINT_REGISTER(app_dpdk_test_tp, app.dpdk.test.tp); > + RTE_TRACE_POINT_REGISTER(app_dpdk_test_fp, app.dpdk.test.fp); > +} > + > -- > 2.25.1 > --=20 David Marchand