[edk2-devel] [Patch v2 00/12] Add gmock support for host-based unit testing

Michael D Kinney posted 12 patches 1 year ago
Failed in applying to current master (apply log)
There is a newer version of this series
.gitmodules                                   |    3 +
.pytool/CISettings.py                         |    2 +
.../MockUefiRuntimeServicesTableLib.inf       |    6 +-
.../GoogleTest/UefiSortLibGoogleTest.cpp      |   61 +
.../GoogleTest/UefiSortLibGoogleTest.inf      |   31 +
MdeModulePkg/Test/MdeModulePkgHostTest.dsc    |    6 +
.../VariableLockRequestToLockUnitTest.inf     |    2 +-
.../Library/BaseLib/UnitTestHostBaseLib.inf   |    2 +-
MdePkg/MdePkg.dec                             |    1 +
MdePkg/Test/MdePkgHostTest.dsc                |    2 +
.../Include/GoogleTest/Library/MockUefiLib.h  |   39 +
.../Library/MockUefiRuntimeServicesTableLib.h |   42 +
.../GoogleTest/MockUefiLib/MockUefiLib.cpp    |   12 +
.../GoogleTest/MockUefiLib/MockUefiLib.inf    |   33 +
.../MockUefiRuntimeServicesTableLib.cpp       |   40 +
.../MockUefiRuntimeServicesTableLib.inf       |   33 +
.../DxePrmContextBufferLibUnitTestHost.inf    |    2 +-
.../DxePrmModuleDiscoveryLibUnitTestHost.inf  |    2 +-
ReadMe.rst                                    |    1 +
.../SecureBootVariableLibGoogleTest.cpp       |  174 +++
.../SecureBootVariableLibGoogleTest.inf       |   32 +
.../UnitTest/MockPlatformPKProtectionLib.inf  |    6 +-
.../UnitTest/MockUefiLib.inf                  |    6 +-
.../MockUefiRuntimeServicesTableLib.inf       |    6 +-
.../UnitTest/SecureBootVariableLibUnitTest.c  |  172 ++-
SecurityPkg/SecurityPkg.dec                   |    1 +
.../Library/MockPlatformPKProtectionLib.h     |   28 +
.../MockPlatformPKProtectionLib.cpp           |   11 +
.../MockPlatformPKProtectionLib.inf           |   34 +
SecurityPkg/Test/SecurityPkgHostTest.dsc      |    8 +
.../Include/Library/FunctionMockLib.h         |  131 +++
.../Include/Library/GoogleTestLib.h           |   96 ++
.../Include/Library/SubhookLib.h              |   15 +
.../Library/CmockaLib/CmockaLib.inf           |    2 +-
.../Library/FunctionMockLib/FunctionMockLib.c |    7 +
.../FunctionMockLib/FunctionMockLib.inf       |   31 +
.../FunctionMockLib/FunctionMockLib.uni       |   11 +
.../Library/GoogleTestLib/GoogleTestLib.inf   |    6 +-
.../Library/GoogleTestLib/GoogleTestLib.uni   |    3 -
.../SubhookLib.inf}                           |   16 +-
.../Library/SubhookLib/SubhookLib.uni         |   11 +
.../Library/SubhookLib/subhook                |    1 +
UnitTestFrameworkPkg/ReadMe.md                | 1013 ++++++++++++++++-
.../Test/UnitTestFrameworkPkgHostTest.dsc     |    2 +
.../UnitTestFrameworkPkg.ci.yaml              |    7 +-
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec |    4 +
.../UnitTestFrameworkPkgHost.dsc.inc          |    2 +
47 files changed, 1994 insertions(+), 162 deletions(-)
create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.cpp
create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.inf
create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiRuntimeServicesTableLib.h
create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.cpp
create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.cpp
create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.cpp
create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.inf
create mode 100644 SecurityPkg/Test/Mock/Include/GoogleTest/Library/MockPlatformPKProtectionLib.h
create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.cpp
create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.inf
create mode 100644 UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h
create mode 100644 UnitTestFrameworkPkg/Include/Library/SubhookLib.h
create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c
create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf
create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni
copy UnitTestFrameworkPkg/Library/{GoogleTestLib/GoogleTestLib.inf => SubhookLib/SubhookLib.inf} (53%)
create mode 100644 UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.uni
create mode 160000 UnitTestFrameworkPkg/Library/SubhookLib/subhook
[edk2-devel] [Patch v2 00/12] Add gmock support for host-based unit testing
Posted by Michael D Kinney 1 year ago
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389

PR: https://github.com/tianocore/edk2/pull/4180
Branch: https://github.com/mdkinney/edk2/tree/Bug_4389_UnitTestFrameworkPkg_AddGoogleMockSupport

New in v2
==========
* SecurityPkg: Add unit test descriptions to SecureBootVariableLibGoogleTest
* MdeModulePkg: Add unit test descriptions to UefiSortLibGoogleTest
* UnitTestFrameworkPkg: Update ReadMe.md based on review findings
  * Fix FunctionMockLib example of the MockUefiLib declaration to align with
    the design code.
  * Fix FunctionMockLib Mocks header file location paths in the tables.
  * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
    declaration to align with the design code.
  * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
    INF file to align with the design file.
  * Fix typos in new Code Coverage section.

V1
===
* Add subhook submodule that is required to hook internal functions
  when using gmock.
* Add gmock support to GoogleTestLib
* Add FunctionMockLib library class and library instance
* Add GoogleTest extension to GoogleTestLib.h for CHAR16 type
* Add GoogleTest extension to GoogleTestLib.h for buffer types
* Add gmock documentation
* Add gmock examples
* Fix VS20xx 4122 errors in SecurityPkg unit test
* HOST_APPLICATION only supports IA32/X64

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Chris Johnson <chris.n.johnson@intel.com>

Chris Johnson (7):
  UnitTestFrameworkPkg: Add subhook submodule required for gmock
  .pytool/CISettings.py: Add subhook submodule
  UnitTestFrameworkPkg:  Add gmock support to GoogleTestLib
  UnitTestFrameworkPkg/ReadMe.md: Add gmock documentation
  MdePkg: Add gmock examples
  MdeModulePkg/Library/UefiSortLib: Add GoogleTestLib example
  SecurityPkg: Add gmock example

Michael D Kinney (5):
  SecurityPkg/Library/SecureBootVariableLib: Fix VS20xx 4122 errors
  SecurityPkg/Library/SecureBootVariableLib: HOST_APPLICATION IA32/X64
    only
  MdePkg/Library/BaseLib: HOST_APPLICATION IA32/X64 only
  MdeModulePkg: HOST_APPLICATION IA32/X64 only
  PrmPkg/Library: HOST_APPLICATION IA32/X64 only

 .gitmodules                                   |    3 +
 .pytool/CISettings.py                         |    2 +
 .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
 .../GoogleTest/UefiSortLibGoogleTest.cpp      |   61 +
 .../GoogleTest/UefiSortLibGoogleTest.inf      |   31 +
 MdeModulePkg/Test/MdeModulePkgHostTest.dsc    |    6 +
 .../VariableLockRequestToLockUnitTest.inf     |    2 +-
 .../Library/BaseLib/UnitTestHostBaseLib.inf   |    2 +-
 MdePkg/MdePkg.dec                             |    1 +
 MdePkg/Test/MdePkgHostTest.dsc                |    2 +
 .../Include/GoogleTest/Library/MockUefiLib.h  |   39 +
 .../Library/MockUefiRuntimeServicesTableLib.h |   42 +
 .../GoogleTest/MockUefiLib/MockUefiLib.cpp    |   12 +
 .../GoogleTest/MockUefiLib/MockUefiLib.inf    |   33 +
 .../MockUefiRuntimeServicesTableLib.cpp       |   40 +
 .../MockUefiRuntimeServicesTableLib.inf       |   33 +
 .../DxePrmContextBufferLibUnitTestHost.inf    |    2 +-
 .../DxePrmModuleDiscoveryLibUnitTestHost.inf  |    2 +-
 ReadMe.rst                                    |    1 +
 .../SecureBootVariableLibGoogleTest.cpp       |  174 +++
 .../SecureBootVariableLibGoogleTest.inf       |   32 +
 .../UnitTest/MockPlatformPKProtectionLib.inf  |    6 +-
 .../UnitTest/MockUefiLib.inf                  |    6 +-
 .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
 .../UnitTest/SecureBootVariableLibUnitTest.c  |  172 ++-
 SecurityPkg/SecurityPkg.dec                   |    1 +
 .../Library/MockPlatformPKProtectionLib.h     |   28 +
 .../MockPlatformPKProtectionLib.cpp           |   11 +
 .../MockPlatformPKProtectionLib.inf           |   34 +
 SecurityPkg/Test/SecurityPkgHostTest.dsc      |    8 +
 .../Include/Library/FunctionMockLib.h         |  131 +++
 .../Include/Library/GoogleTestLib.h           |   96 ++
 .../Include/Library/SubhookLib.h              |   15 +
 .../Library/CmockaLib/CmockaLib.inf           |    2 +-
 .../Library/FunctionMockLib/FunctionMockLib.c |    7 +
 .../FunctionMockLib/FunctionMockLib.inf       |   31 +
 .../FunctionMockLib/FunctionMockLib.uni       |   11 +
 .../Library/GoogleTestLib/GoogleTestLib.inf   |    6 +-
 .../Library/GoogleTestLib/GoogleTestLib.uni   |    3 -
 .../SubhookLib.inf}                           |   16 +-
 .../Library/SubhookLib/SubhookLib.uni         |   11 +
 .../Library/SubhookLib/subhook                |    1 +
 UnitTestFrameworkPkg/ReadMe.md                | 1013 ++++++++++++++++-
 .../Test/UnitTestFrameworkPkgHostTest.dsc     |    2 +
 .../UnitTestFrameworkPkg.ci.yaml              |    7 +-
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec |    4 +
 .../UnitTestFrameworkPkgHost.dsc.inc          |    2 +
 47 files changed, 1994 insertions(+), 162 deletions(-)
 create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.cpp
 create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.inf
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
 create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiRuntimeServicesTableLib.h
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.cpp
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.cpp
 create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
 create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.cpp
 create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.inf
 create mode 100644 SecurityPkg/Test/Mock/Include/GoogleTest/Library/MockPlatformPKProtectionLib.h
 create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.cpp
 create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.inf
 create mode 100644 UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h
 create mode 100644 UnitTestFrameworkPkg/Include/Library/SubhookLib.h
 create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c
 create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf
 create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni
 copy UnitTestFrameworkPkg/Library/{GoogleTestLib/GoogleTestLib.inf => SubhookLib/SubhookLib.inf} (53%)
 create mode 100644 UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.uni
 create mode 160000 UnitTestFrameworkPkg/Library/SubhookLib/subhook

-- 
2.39.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102518): https://edk2.groups.io/g/devel/message/102518
Mute This Topic: https://groups.io/mt/98066292/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch v2 00/12] Add gmock support for host-based unit testing
Posted by Michael D Kinney 1 year ago
Patches 1..7 from Chris Johnson:

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Michael D Kinney
> Sent: Tuesday, April 4, 2023 11:22 AM
> To: devel@edk2.groups.io
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>; Desimone, Nathaniel L <nathaniel.l.desimone@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Yao, Jiewen
> <jiewen.yao@intel.com>; Sean Brogan <sean.brogan@microsoft.com>; Andrew Fish <afish@apple.com>; Leif Lindholm
> <quic_llindhol@quicinc.com>; Johnson, Chris N <chris.n.johnson@intel.com>
> Subject: [edk2-devel] [Patch v2 00/12] Add gmock support for host-based unit testing
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389
> 
> PR: https://github.com/tianocore/edk2/pull/4180
> Branch: https://github.com/mdkinney/edk2/tree/Bug_4389_UnitTestFrameworkPkg_AddGoogleMockSupport
> 
> New in v2
> ==========
> * SecurityPkg: Add unit test descriptions to SecureBootVariableLibGoogleTest
> * MdeModulePkg: Add unit test descriptions to UefiSortLibGoogleTest
> * UnitTestFrameworkPkg: Update ReadMe.md based on review findings
>   * Fix FunctionMockLib example of the MockUefiLib declaration to align with
>     the design code.
>   * Fix FunctionMockLib Mocks header file location paths in the tables.
>   * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
>     declaration to align with the design code.
>   * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
>     INF file to align with the design file.
>   * Fix typos in new Code Coverage section.
> 
> V1
> ===
> * Add subhook submodule that is required to hook internal functions
>   when using gmock.
> * Add gmock support to GoogleTestLib
> * Add FunctionMockLib library class and library instance
> * Add GoogleTest extension to GoogleTestLib.h for CHAR16 type
> * Add GoogleTest extension to GoogleTestLib.h for buffer types
> * Add gmock documentation
> * Add gmock examples
> * Fix VS20xx 4122 errors in SecurityPkg unit test
> * HOST_APPLICATION only supports IA32/X64
> 
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Signed-off-by: Chris Johnson <chris.n.johnson@intel.com>
> 
> Chris Johnson (7):
>   UnitTestFrameworkPkg: Add subhook submodule required for gmock
>   .pytool/CISettings.py: Add subhook submodule
>   UnitTestFrameworkPkg:  Add gmock support to GoogleTestLib
>   UnitTestFrameworkPkg/ReadMe.md: Add gmock documentation
>   MdePkg: Add gmock examples
>   MdeModulePkg/Library/UefiSortLib: Add GoogleTestLib example
>   SecurityPkg: Add gmock example
> 
> Michael D Kinney (5):
>   SecurityPkg/Library/SecureBootVariableLib: Fix VS20xx 4122 errors
>   SecurityPkg/Library/SecureBootVariableLib: HOST_APPLICATION IA32/X64
>     only
>   MdePkg/Library/BaseLib: HOST_APPLICATION IA32/X64 only
>   MdeModulePkg: HOST_APPLICATION IA32/X64 only
>   PrmPkg/Library: HOST_APPLICATION IA32/X64 only
> 
>  .gitmodules                                   |    3 +
>  .pytool/CISettings.py                         |    2 +
>  .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
>  .../GoogleTest/UefiSortLibGoogleTest.cpp      |   61 +
>  .../GoogleTest/UefiSortLibGoogleTest.inf      |   31 +
>  MdeModulePkg/Test/MdeModulePkgHostTest.dsc    |    6 +
>  .../VariableLockRequestToLockUnitTest.inf     |    2 +-
>  .../Library/BaseLib/UnitTestHostBaseLib.inf   |    2 +-
>  MdePkg/MdePkg.dec                             |    1 +
>  MdePkg/Test/MdePkgHostTest.dsc                |    2 +
>  .../Include/GoogleTest/Library/MockUefiLib.h  |   39 +
>  .../Library/MockUefiRuntimeServicesTableLib.h |   42 +
>  .../GoogleTest/MockUefiLib/MockUefiLib.cpp    |   12 +
>  .../GoogleTest/MockUefiLib/MockUefiLib.inf    |   33 +
>  .../MockUefiRuntimeServicesTableLib.cpp       |   40 +
>  .../MockUefiRuntimeServicesTableLib.inf       |   33 +
>  .../DxePrmContextBufferLibUnitTestHost.inf    |    2 +-
>  .../DxePrmModuleDiscoveryLibUnitTestHost.inf  |    2 +-
>  ReadMe.rst                                    |    1 +
>  .../SecureBootVariableLibGoogleTest.cpp       |  174 +++
>  .../SecureBootVariableLibGoogleTest.inf       |   32 +
>  .../UnitTest/MockPlatformPKProtectionLib.inf  |    6 +-
>  .../UnitTest/MockUefiLib.inf                  |    6 +-
>  .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
>  .../UnitTest/SecureBootVariableLibUnitTest.c  |  172 ++-
>  SecurityPkg/SecurityPkg.dec                   |    1 +
>  .../Library/MockPlatformPKProtectionLib.h     |   28 +
>  .../MockPlatformPKProtectionLib.cpp           |   11 +
>  .../MockPlatformPKProtectionLib.inf           |   34 +
>  SecurityPkg/Test/SecurityPkgHostTest.dsc      |    8 +
>  .../Include/Library/FunctionMockLib.h         |  131 +++
>  .../Include/Library/GoogleTestLib.h           |   96 ++
>  .../Include/Library/SubhookLib.h              |   15 +
>  .../Library/CmockaLib/CmockaLib.inf           |    2 +-
>  .../Library/FunctionMockLib/FunctionMockLib.c |    7 +
>  .../FunctionMockLib/FunctionMockLib.inf       |   31 +
>  .../FunctionMockLib/FunctionMockLib.uni       |   11 +
>  .../Library/GoogleTestLib/GoogleTestLib.inf   |    6 +-
>  .../Library/GoogleTestLib/GoogleTestLib.uni   |    3 -
>  .../SubhookLib.inf}                           |   16 +-
>  .../Library/SubhookLib/SubhookLib.uni         |   11 +
>  .../Library/SubhookLib/subhook                |    1 +
>  UnitTestFrameworkPkg/ReadMe.md                | 1013 ++++++++++++++++-
>  .../Test/UnitTestFrameworkPkgHostTest.dsc     |    2 +
>  .../UnitTestFrameworkPkg.ci.yaml              |    7 +-
>  UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec |    4 +
>  .../UnitTestFrameworkPkgHost.dsc.inc          |    2 +
>  47 files changed, 1994 insertions(+), 162 deletions(-)
>  create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.cpp
>  create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.inf
>  create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
>  create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiRuntimeServicesTableLib.h
>  create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.cpp
>  create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
>  create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.cpp
>  create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
>  create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.cpp
>  create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.inf
>  create mode 100644 SecurityPkg/Test/Mock/Include/GoogleTest/Library/MockPlatformPKProtectionLib.h
>  create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.cpp
>  create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.inf
>  create mode 100644 UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h
>  create mode 100644 UnitTestFrameworkPkg/Include/Library/SubhookLib.h
>  create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c
>  create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf
>  create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni
>  copy UnitTestFrameworkPkg/Library/{GoogleTestLib/GoogleTestLib.inf => SubhookLib/SubhookLib.inf} (53%)
>  create mode 100644 UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.uni
>  create mode 160000 UnitTestFrameworkPkg/Library/SubhookLib/subhook
> 
> --
> 2.39.1.windows.1
> 
> 
> 
> 
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102717): https://edk2.groups.io/g/devel/message/102717
Mute This Topic: https://groups.io/mt/98066292/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076/xyzzy [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [Patch v2 00/12] Add gmock support for host-based unit testing
Posted by Oliver Smith-Denny 1 year ago
Thanks for sending this out, looks to be a pretty clean unit
testing interface. We are testing this now with some of
our unit tests and will update with any feedback.

In the meantime, for the patchset:

Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com>

On 4/4/2023 11:22 AM, Michael D Kinney wrote:
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389
> 
> PR: https://github.com/tianocore/edk2/pull/4180
> Branch: https://github.com/mdkinney/edk2/tree/Bug_4389_UnitTestFrameworkPkg_AddGoogleMockSupport
> 
> New in v2
> ==========
> * SecurityPkg: Add unit test descriptions to SecureBootVariableLibGoogleTest
> * MdeModulePkg: Add unit test descriptions to UefiSortLibGoogleTest
> * UnitTestFrameworkPkg: Update ReadMe.md based on review findings
>    * Fix FunctionMockLib example of the MockUefiLib declaration to align with
>      the design code.
>    * Fix FunctionMockLib Mocks header file location paths in the tables.
>    * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
>      declaration to align with the design code.
>    * Fix FunctionMockLib Mocks example (and description) of the MockUefiLib
>      INF file to align with the design file.
>    * Fix typos in new Code Coverage section.
> 
> V1
> ===
> * Add subhook submodule that is required to hook internal functions
>    when using gmock.
> * Add gmock support to GoogleTestLib
> * Add FunctionMockLib library class and library instance
> * Add GoogleTest extension to GoogleTestLib.h for CHAR16 type
> * Add GoogleTest extension to GoogleTestLib.h for buffer types
> * Add gmock documentation
> * Add gmock examples
> * Fix VS20xx 4122 errors in SecurityPkg unit test
> * HOST_APPLICATION only supports IA32/X64
> 
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Sean Brogan <sean.brogan@microsoft.com>
> Cc: Michael Kubacki <mikuback@linux.microsoft.com>
> Cc: Andrew Fish <afish@apple.com>
> Cc: Leif Lindholm <quic_llindhol@quicinc.com>
> Signed-off-by: Chris Johnson <chris.n.johnson@intel.com>
> 
> Chris Johnson (7):
>    UnitTestFrameworkPkg: Add subhook submodule required for gmock
>    .pytool/CISettings.py: Add subhook submodule
>    UnitTestFrameworkPkg:  Add gmock support to GoogleTestLib
>    UnitTestFrameworkPkg/ReadMe.md: Add gmock documentation
>    MdePkg: Add gmock examples
>    MdeModulePkg/Library/UefiSortLib: Add GoogleTestLib example
>    SecurityPkg: Add gmock example
> 
> Michael D Kinney (5):
>    SecurityPkg/Library/SecureBootVariableLib: Fix VS20xx 4122 errors
>    SecurityPkg/Library/SecureBootVariableLib: HOST_APPLICATION IA32/X64
>      only
>    MdePkg/Library/BaseLib: HOST_APPLICATION IA32/X64 only
>    MdeModulePkg: HOST_APPLICATION IA32/X64 only
>    PrmPkg/Library: HOST_APPLICATION IA32/X64 only
> 
>   .gitmodules                                   |    3 +
>   .pytool/CISettings.py                         |    2 +
>   .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
>   .../GoogleTest/UefiSortLibGoogleTest.cpp      |   61 +
>   .../GoogleTest/UefiSortLibGoogleTest.inf      |   31 +
>   MdeModulePkg/Test/MdeModulePkgHostTest.dsc    |    6 +
>   .../VariableLockRequestToLockUnitTest.inf     |    2 +-
>   .../Library/BaseLib/UnitTestHostBaseLib.inf   |    2 +-
>   MdePkg/MdePkg.dec                             |    1 +
>   MdePkg/Test/MdePkgHostTest.dsc                |    2 +
>   .../Include/GoogleTest/Library/MockUefiLib.h  |   39 +
>   .../Library/MockUefiRuntimeServicesTableLib.h |   42 +
>   .../GoogleTest/MockUefiLib/MockUefiLib.cpp    |   12 +
>   .../GoogleTest/MockUefiLib/MockUefiLib.inf    |   33 +
>   .../MockUefiRuntimeServicesTableLib.cpp       |   40 +
>   .../MockUefiRuntimeServicesTableLib.inf       |   33 +
>   .../DxePrmContextBufferLibUnitTestHost.inf    |    2 +-
>   .../DxePrmModuleDiscoveryLibUnitTestHost.inf  |    2 +-
>   ReadMe.rst                                    |    1 +
>   .../SecureBootVariableLibGoogleTest.cpp       |  174 +++
>   .../SecureBootVariableLibGoogleTest.inf       |   32 +
>   .../UnitTest/MockPlatformPKProtectionLib.inf  |    6 +-
>   .../UnitTest/MockUefiLib.inf                  |    6 +-
>   .../MockUefiRuntimeServicesTableLib.inf       |    6 +-
>   .../UnitTest/SecureBootVariableLibUnitTest.c  |  172 ++-
>   SecurityPkg/SecurityPkg.dec                   |    1 +
>   .../Library/MockPlatformPKProtectionLib.h     |   28 +
>   .../MockPlatformPKProtectionLib.cpp           |   11 +
>   .../MockPlatformPKProtectionLib.inf           |   34 +
>   SecurityPkg/Test/SecurityPkgHostTest.dsc      |    8 +
>   .../Include/Library/FunctionMockLib.h         |  131 +++
>   .../Include/Library/GoogleTestLib.h           |   96 ++
>   .../Include/Library/SubhookLib.h              |   15 +
>   .../Library/CmockaLib/CmockaLib.inf           |    2 +-
>   .../Library/FunctionMockLib/FunctionMockLib.c |    7 +
>   .../FunctionMockLib/FunctionMockLib.inf       |   31 +
>   .../FunctionMockLib/FunctionMockLib.uni       |   11 +
>   .../Library/GoogleTestLib/GoogleTestLib.inf   |    6 +-
>   .../Library/GoogleTestLib/GoogleTestLib.uni   |    3 -
>   .../SubhookLib.inf}                           |   16 +-
>   .../Library/SubhookLib/SubhookLib.uni         |   11 +
>   .../Library/SubhookLib/subhook                |    1 +
>   UnitTestFrameworkPkg/ReadMe.md                | 1013 ++++++++++++++++-
>   .../Test/UnitTestFrameworkPkgHostTest.dsc     |    2 +
>   .../UnitTestFrameworkPkg.ci.yaml              |    7 +-
>   UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec |    4 +
>   .../UnitTestFrameworkPkgHost.dsc.inc          |    2 +
>   47 files changed, 1994 insertions(+), 162 deletions(-)
>   create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.cpp
>   create mode 100644 MdeModulePkg/Library/UefiSortLib/GoogleTest/UefiSortLibGoogleTest.inf
>   create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiLib.h
>   create mode 100644 MdePkg/Test/Mock/Include/GoogleTest/Library/MockUefiRuntimeServicesTableLib.h
>   create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.cpp
>   create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiLib/MockUefiLib.inf
>   create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.cpp
>   create mode 100644 MdePkg/Test/Mock/Library/GoogleTest/MockUefiRuntimeServicesTableLib/MockUefiRuntimeServicesTableLib.inf
>   create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.cpp
>   create mode 100644 SecurityPkg/Library/SecureBootVariableLib/GoogleTest/SecureBootVariableLibGoogleTest.inf
>   create mode 100644 SecurityPkg/Test/Mock/Include/GoogleTest/Library/MockPlatformPKProtectionLib.h
>   create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.cpp
>   create mode 100644 SecurityPkg/Test/Mock/Library/GoogleTest/MockPlatformPKProtectionLib/MockPlatformPKProtectionLib.inf
>   create mode 100644 UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h
>   create mode 100644 UnitTestFrameworkPkg/Include/Library/SubhookLib.h
>   create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c
>   create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf
>   create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni
>   copy UnitTestFrameworkPkg/Library/{GoogleTestLib/GoogleTestLib.inf => SubhookLib/SubhookLib.inf} (53%)
>   create mode 100644 UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.uni
>   create mode 160000 UnitTestFrameworkPkg/Library/SubhookLib/subhook
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102566): https://edk2.groups.io/g/devel/message/102566
Mute This Topic: https://groups.io/mt/98066292/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-