public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] gTest code coverage
@ 2023-09-15 16:48 CrossedCarpet
  2023-09-15 19:12 ` Michael D Kinney
  0 siblings, 1 reply; 6+ messages in thread
From: CrossedCarpet @ 2023-09-15 16:48 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

Greetings,
Does gTest need any additional steps for building the code coverage files? Or is this not a possibility?
The documentation states "Host based Unit Tests will automatically enable coverage data." and indeed I used to find these coverage files when using the UnitTestFramework. Does this mean that the statement doesn't apply to gTests?
Thank you for your attention,
C.C.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108731): https://edk2.groups.io/g/devel/message/108731
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 1180 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] gTest code coverage
  2023-09-15 16:48 [edk2-devel] gTest code coverage CrossedCarpet
@ 2023-09-15 19:12 ` Michael D Kinney
  2023-09-19 16:44   ` CrossedCarpet
  0 siblings, 1 reply; 6+ messages in thread
From: Michael D Kinney @ 2023-09-15 19:12 UTC (permalink / raw)
  To: devel@edk2.groups.io, crossedcarpet@hotmail.com, Guo, Gua
  Cc: Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 1160 bytes --]

This describes local development code coverage.  Let us know if these work for you.

https://github.com/tianocore/edk2/tree/master/UnitTestFrameworkPkg#code-coverage

Thanks,

Mike

From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of CrossedCarpet
Sent: Friday, September 15, 2023 9:48 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] gTest code coverage

Greetings,
Does gTest need any additional steps for building the code coverage files? Or is this not a possibility?
The documentation states "Host based Unit Tests will automatically enable coverage data." and indeed I used to find these coverage files when using the UnitTestFramework. Does this mean that the statement doesn't apply to gTests?
Thank you for your attention,
C.C.



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108732): https://edk2.groups.io/g/devel/message/108732
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 4082 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] gTest code coverage
  2023-09-15 19:12 ` Michael D Kinney
@ 2023-09-19 16:44   ` CrossedCarpet
  2023-09-19 18:09     ` Michael D Kinney
  0 siblings, 1 reply; 6+ messages in thread
From: CrossedCarpet @ 2023-09-19 16:44 UTC (permalink / raw)
  To: Michael D Kinney, devel

[-- Attachment #1: Type: text/plain, Size: 1864 bytes --]

Thank you for your reply!
Unfortunately, I was aware of that documentation, I quoted it in my original email when asking for help in its interpretation.

I have been using the build system instead of the stuart abstraction. If I try using it in my current setup I get a bug saying my HostTestPkg is unsupported.
Anyhow, I'd love to figure out why isn't the build system generating these gcno and gcda files anymore.

When building my LibraryClasses this is the command that gets run:

"gcc" -o /edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/GoogleTestStringUtilsLib -m64 -no-pie -Wl,--start-group,@/edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/MdePkg/Test/GoogleTest/Library/CustomLibs/StringUtils/StringUtils/OUTPUT/static_library_files.lst,--end-group -lgcov -lpthread -lstdc++ -lm

I have been able to modify it in my own HostTestPkg.dsc with:

[BuildOptions.common.EDKII.HOST_APPLICATION]
GCC:*_GCC5_*_CC_FLAGS = --coverage -fprofile-arcs -ftest-coverage
# or
GCC:*_*_X64_DLINK_FLAGS  == -o $(BIN_DIR)/$(MODULE_NAME_GUID) -fprofile-arcs -ftest-coverage -m64 -no-pie

But to no avail, I've only been able to generate weird intermediate files like: GoogleTestStringUtilsLib.ltrans0.ltrans.gcno

This is how I invoke the build command:
build -a X64 -b DEBUG -t GCC -D DISABLE_NEW_DEPRECATED_INTERFACES -p MdePkg/Test/GoogleTest/Library/CustomLibs/HostTestPkg.dsc"

Help is greatly appreciated. I believe I'm overthinking it and the solution is more straightforward than this.
C.C.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108851): https://edk2.groups.io/g/devel/message/108851
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 3363 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] gTest code coverage
  2023-09-19 16:44   ` CrossedCarpet
@ 2023-09-19 18:09     ` Michael D Kinney
  2023-09-19 22:42       ` Guo, Gua
  0 siblings, 1 reply; 6+ messages in thread
From: Michael D Kinney @ 2023-09-19 18:09 UTC (permalink / raw)
  To: CrossedCarpet, devel@edk2.groups.io, Guo, Gua; +Cc: Kinney, Michael D

[-- Attachment #1: Type: text/plain, Size: 2200 bytes --]

Gua may be able to help.

What error do you get trying to use stuart commands?

Mike

From: CrossedCarpet <crossedcarpet@hotmail.com>
Sent: Tuesday, September 19, 2023 9:45 AM
To: Kinney, Michael D <michael.d.kinney@intel.com>; devel@edk2.groups.io
Subject: Re: [edk2-devel] gTest code coverage


Thank you for your reply!
Unfortunately, I was aware of that documentation, I quoted it in my original email when asking for help in its interpretation.

I have been using the build system instead of the stuart abstraction. If I try using it in my current setup I get a bug saying my HostTestPkg is unsupported.
Anyhow, I'd love to figure out why isn't the build system generating these gcno and gcda files anymore.

When building my LibraryClasses this is the command that gets run:

"gcc" -o /edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/GoogleTestStringUtilsLib -m64 -no-pie -Wl,--start-group,@/edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/MdePkg/Test/GoogleTest/Library/CustomLibs/StringUtils/StringUtils/OUTPUT/static_library_files.lst,--end-group -lgcov -lpthread -lstdc++ -lm

I have been able to modify it in my own HostTestPkg.dsc with:
[BuildOptions.common.EDKII.HOST_APPLICATION]
  GCC:*_GCC5_*_CC_FLAGS = --coverage -fprofile-arcs -ftest-coverage
# or
  GCC:*_*_X64_DLINK_FLAGS  == -o $(BIN_DIR)/$(MODULE_NAME_GUID)  -fprofile-arcs -ftest-coverage -m64 -no-pie

But to no avail, I've only been able to generate weird intermediate files like: GoogleTestStringUtilsLib.ltrans0.ltrans.gcno

This is how I invoke the build command:
build -a X64 -b DEBUG -t GCC -D DISABLE_NEW_DEPRECATED_INTERFACES -p MdePkg/Test/GoogleTest/Library/CustomLibs/HostTestPkg.dsc"

Help is greatly appreciated. I believe I'm overthinking it and the solution is more straightforward than this.
C.C.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108854): https://edk2.groups.io/g/devel/message/108854
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 5546 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] gTest code coverage
  2023-09-19 18:09     ` Michael D Kinney
@ 2023-09-19 22:42       ` Guo, Gua
  2023-09-21 10:25         ` CrossedCarpet
  0 siblings, 1 reply; 6+ messages in thread
From: Guo, Gua @ 2023-09-19 22:42 UTC (permalink / raw)
  To: Kinney, Michael D, CrossedCarpet, devel@edk2.groups.io


[-- Attachment #1.1: Type: text/plain, Size: 3378 bytes --]

Hi C.C.

Two changes that I recommend for you. Hope it’s helpful for you.
Below is my test command

  *   . edksetup.sh
  *   make -C BaseTools
  *   build -a X64 -b NOOPT -t GCC -p MdePkg/Test/MdePkgHostTest.dsc
  *   Build/MdePkg/HostTest/NOOPT_GCC/X64/GoogleTestBaseSafeIntLib

1. Change DEBUG to NOOPT
From build -a X64 -b DEBUG -t GCC -D DISABLE_NEW_DEPRECATED_INTERFACES -p MdePkg/Test/GoogleTest/Library/CustomLibs/HostTestPkg.dsc"
To build -a X64 -b NOOPT -t GCC -D DISABLE_NEW_DEPRECATED_INTERFACES -p MdePkg/Test/GoogleTest/Library/CustomLibs/HostTestPkg.dsc"
Reason: UnitTest only support NOOPT on Host Application.

2. Change BuildOptions from GCC5 to GCC
Reason: TOOLCHAIN “GCC5” is obsolete, it’s issue for Edk2 side.
[cid:image001.png@01D9EB8D.2CC0A8C0]


Thanks,
Gua

From: Kinney, Michael D <michael.d.kinney@intel.com>
Sent: Wednesday, September 20, 2023 2:10 AM
To: CrossedCarpet <crossedcarpet@hotmail.com>; devel@edk2.groups.io; Guo, Gua <gua.guo@intel.com>
Cc: Kinney, Michael D <michael.d.kinney@intel.com>
Subject: RE: [edk2-devel] gTest code coverage

Gua may be able to help.

What error do you get trying to use stuart commands?

Mike

From: CrossedCarpet <crossedcarpet@hotmail.com<mailto:crossedcarpet@hotmail.com>>
Sent: Tuesday, September 19, 2023 9:45 AM
To: Kinney, Michael D <michael.d.kinney@intel.com<mailto:michael.d.kinney@intel.com>>; devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: Re: [edk2-devel] gTest code coverage


Thank you for your reply!
Unfortunately, I was aware of that documentation, I quoted it in my original email when asking for help in its interpretation.

I have been using the build system instead of the stuart abstraction. If I try using it in my current setup I get a bug saying my HostTestPkg is unsupported.
Anyhow, I'd love to figure out why isn't the build system generating these gcno and gcda files anymore.

When building my LibraryClasses this is the command that gets run:

"gcc" -o /edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/GoogleTestStringUtilsLib -m64 -no-pie -Wl,--start-group,@/edk2/edk2/Build/CustomLibs/DEBUG_GCC/X64/MdePkg/Test/GoogleTest/Library/CustomLibs/StringUtils/StringUtils/OUTPUT/static_library_files.lst,--end-group -lgcov -lpthread -lstdc++ -lm

I have been able to modify it in my own HostTestPkg.dsc with:
[BuildOptions.common.EDKII.HOST_APPLICATION]
  GCC:*_GCC5_*_CC_FLAGS = --coverage -fprofile-arcs -ftest-coverage
# or
  GCC:*_*_X64_DLINK_FLAGS  == -o $(BIN_DIR)/$(MODULE_NAME_GUID)  -fprofile-arcs -ftest-coverage -m64 -no-pie

But to no avail, I've only been able to generate weird intermediate files like: GoogleTestStringUtilsLib.ltrans0.ltrans.gcno

This is how I invoke the build command:
build -a X64 -b DEBUG -t GCC -D DISABLE_NEW_DEPRECATED_INTERFACES -p MdePkg/Test/GoogleTest/Library/CustomLibs/HostTestPkg.dsc"

Help is greatly appreciated. I believe I'm overthinking it and the solution is more straightforward than this.
C.C.


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108861): https://edk2.groups.io/g/devel/message/108861
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #1.2: Type: text/html, Size: 13941 bytes --]

[-- Attachment #2: image001.png --]
[-- Type: image/png, Size: 182211 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] gTest code coverage
  2023-09-19 22:42       ` Guo, Gua
@ 2023-09-21 10:25         ` CrossedCarpet
  0 siblings, 0 replies; 6+ messages in thread
From: CrossedCarpet @ 2023-09-21 10:25 UTC (permalink / raw)
  To: Guo, Gua, devel

[-- Attachment #1: Type: text/plain, Size: 539 bytes --]

Spot on, that solved it!
I had attempted the NOOPT flag but I was missing the second part to do the trick
Now I can even generate amazing coverage output with genhtml (:


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#108939): https://edk2.groups.io/g/devel/message/108939
Mute This Topic: https://groups.io/mt/101383490/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 966 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-09-21 10:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-15 16:48 [edk2-devel] gTest code coverage CrossedCarpet
2023-09-15 19:12 ` Michael D Kinney
2023-09-19 16:44   ` CrossedCarpet
2023-09-19 18:09     ` Michael D Kinney
2023-09-19 22:42       ` Guo, Gua
2023-09-21 10:25         ` CrossedCarpet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox