Yes, we can install gcov viewer on vscode. [cid:image001.png@01D8C7C7.45B07080] [cid:image002.png@01D8C7C7.45B07080] Thanks, Gua -----Original Message----- From: Kinney, Michael D Sent: Tuesday, September 13, 2022 11:12 PM To: Guo, Gua ; devel@edk2.groups.io; Kinney, Michael D Cc: Sean Brogan ; Barkelew, Bret ; Michael Kubacki Subject: RE: [PATCH] UnitTestFrameworkPkg: Add code coverage support for GCC Is there a Visual Studio Code plugin to view the code coverage too? Thanks, Mike > -----Original Message----- > From: Guo, Gua > > Sent: Tuesday, September 13, 2022 6:28 AM > To: devel@edk2.groups.io > Cc: Kinney, Michael D >; Sean Brogan > >; Barkelew, Bret > >; Michael Kubacki > > > 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 > > Sent: Tuesday, September 13, 2022 9:24 PM > To: devel@edk2.groups.io > Cc: Guo, Gua >; Kinney, Michael D > >; Sean Brogan >; > Barkelew, Bret >; Michael Kubacki > > > Subject: [PATCH] UnitTestFrameworkPkg: Add code coverage support for > GCC > > From: Gua Guo > > > 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 > > Cc: Sean Brogan > > Cc: Bret Barkelew > > Cc: Michael Kubacki > > Signed-off-by: Gua Guo > > --- > 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