From patchwork Mon Sep 23 12:15:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcin Zapolski X-Patchwork-Id: 59609 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1A8E81BED7; Mon, 23 Sep 2019 14:16:26 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id A30701BEC9 for ; Mon, 23 Sep 2019 14:16:23 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Sep 2019 05:16:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,539,1559545200"; d="scan'208";a="218519626" Received: from marcinzx-mobl.ger.corp.intel.com ([10.103.104.110]) by fmsmga002.fm.intel.com with ESMTP; 23 Sep 2019 05:16:21 -0700 From: Marcin Zapolski To: dev@dpdk.org Cc: Marcin Zapolski Date: Mon, 23 Sep 2019 14:15:33 +0200 Message-Id: <20190923121533.1191-1-marcinx.a.zapolski@intel.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20190923085226.1009-1-marcinx.a.zapolski@intel.com> References: <20190923085226.1009-1-marcinx.a.zapolski@intel.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2] doc: add code coverage report generation guide 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" Add unit tests and code coverage reports generation guides to Meson build documentation. Signed-off-by: Marcin Zapolski --- v2: fix trailing whitespaces --- doc/build-sdk-meson.txt | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/build-sdk-meson.txt b/doc/build-sdk-meson.txt index fc7fe37b5..691950a62 100644 --- a/doc/build-sdk-meson.txt +++ b/doc/build-sdk-meson.txt @@ -192,3 +192,43 @@ From examples/helloworld/Makefile:: build: @mkdir -p $@ + +Running DPDK unit-tests +----------------------- + +To run all defined unit tests we can use the command:: + + meson test -C build + +from DPDK root direcotry, where build is the project build directory. It is the +equivalent to running:: + + ninja test + +in ``build`` directory. +To run a set of tests belonging to a specific test suite, we can use:: + + meson test -C build --suite + +where can be ``fast-tests``, ``perf-tests``, ``driver-tests`` or +``debug-tests``. + +Generating code coverage reports +-------------------------------- + +To gather code coverage data, we need to give meson the ``-Db_coverage=true`` +command line flag:: + + meson configure -Db_coverage=true + +To generate code coverage reports, the ``gcovr`` tool needs to be installed. On +most linux distributions it is available through the package manager, eg. +``sudo apt-get install gcovr``. +Then, after running the tests, we can generate the reports simply by running:: + + ninja coverage + +in project build directory. The reports will be generated in +``build/meson-logs`` directory, in ``html``, ``xml`` and ``txt`` formats. +To generate the coverage reports in only one format, we can use one of +``coverage-html``, ``coverage-xml`` or ``coverage-txt`` meson targets.