public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: "Guo, Gua" <gua.guo@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>,
	"Barkelew, Bret" <bret.barkelew@microsoft.com>,
	Michael Kubacki <mikuback@linux.microsoft.com>
Subject: Re: [PATCH] UnitTestFrameworkPkg: Add code coverage support for GCC
Date: Tue, 13 Sep 2022 15:11:39 +0000	[thread overview]
Message-ID: <CO1PR11MB492931F2F113FF233F8E9222D2479@CO1PR11MB4929.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BL1PR11MB547818CFB44E14AC53441606EF479@BL1PR11MB5478.namprd11.prod.outlook.com>

Is there a Visual Studio Code plugin to view the code coverage too?

Thanks,

Mike

> -----Original Message-----
> From: Guo, Gua <gua.guo@intel.com>
> Sent: Tuesday, September 13, 2022 6:28 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; Barkelew, Bret
> <bret.barkelew@microsoft.com>; Michael Kubacki <mikuback@linux.microsoft.com>
> Subject: RE: [PATCH] UnitTestFrameworkPkg: Add code coverage support for GCC
> 
> Hi All
> 
> I want to follow below steps to generate code coverage data based the default build. But I notice currently GCC compiler flags won't
> generate *gcda and *.gcno.
> So add the CC flags to generate necessary data that require by "lcov" tool.
> 
> I'm not sure whether have any concern to add the flags by default.
> 
> Step1. sudo apt-get install lcov
> Step2. stuart_ci_build -c .pytool/CISettings.py -p MdePkg -t NOOPT -a IA32,X64 TOOL_CHAIN_TAG=GCC5 --verbose
> Step3. lcov -c --rc lcov_branch_coverage=1 -o UnitTest.info -d Build/MdePkg/HostTest/NOOPT_GCC5/X64/MdePkg/
> Step4. genhtml UnitTest.info --branch-coverage -o .Build/UnitTestReport
> Step5. Open "Build/UnitTestReport/index.html"
> 
> Thanks,
> Gua
> 
> -----Original Message-----
> From: Guo, Gua <gua.guo@intel.com>
> Sent: Tuesday, September 13, 2022 9:24 PM
> To: devel@edk2.groups.io
> Cc: Guo, Gua <gua.guo@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; Barkelew,
> Bret <bret.barkelew@microsoft.com>; Michael Kubacki <mikuback@linux.microsoft.com>
> Subject: [PATCH] UnitTestFrameworkPkg: Add code coverage support for GCC
> 
> From: Gua Guo <gua.guo@intel.com>
> 
> In order to collect code coverage after running executable file, generate *.gcda and *.gcno file that require by lcov tool to
> generate code coverage report.
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Signed-off-by: Gua Guo <gua.guo@intel.com>
> ---
>  UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> index 4dd8d4ac67..8623aecb33 100644
> --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
> @@ -19,7 +19,7 @@
>    MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.inf  [BuildOptions]-
> GCC:*_*_*_CC_FLAGS = -fno-pie+  GCC:*_*_*_CC_FLAGS = -fno-pie -ftest-coverage -fprofile-arcs !ifdef $(UNIT_TESTING_DEBUG)
> MSFT:*_*_*_CC_FLAGS  = -D UNIT_TESTING_DEBUG=1   GCC:*_*_*_CC_FLAGS   = -D UNIT_TESTING_DEBUG=1--
> 2.31.1.windows.1


  reply	other threads:[~2022-09-13 15:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-13 13:24 [PATCH] UnitTestFrameworkPkg: Add code coverage support for GCC Guo, Gua
2022-09-13 13:28 ` Guo, Gua
2022-09-13 15:11   ` Michael D Kinney [this message]
2022-09-13 15:19     ` Guo, Gua
2022-09-13 15:10 ` Michael D Kinney
2022-09-13 15:20   ` Guo, Gua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CO1PR11MB492931F2F113FF233F8E9222D2479@CO1PR11MB4929.namprd11.prod.outlook.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox