public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Michael D Kinney" <michael.d.kinney@intel.com>
To: devel@edk2.groups.io
Cc: Liming Gao <gaoliming@byosoft.com.cn>,
	Zhiguang Liu <zhiguang.liu@intel.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Yuwei Chen <yuwei.chen@intel.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Bret Barkelew <Bret.Barkelew@microsoft.com>
Subject: [Patch 0/7] Add GoogleTest to UnitTestFrameworkPkg
Date: Thu,  3 Nov 2022 20:30:49 -0700	[thread overview]
Message-ID: <20221104033056.1259-1-michael.d.kinney@intel.com> (raw)

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134

PR: https://github.com/tianocore/edk2/pull/3566
Branch: https://github.com/mdkinney/edk2/tree/Bug_4134_AddGoogleTest

Add GoogleTest support to UnitTestFrameworkPkg to provide an
additional host-based unit test framework to developers.

Code: https://github.com/google/googletest
Docs: https://google.github.io/googletest

GoogleTest is implemented in C++, but does support implementing
unit tests for C code.  This patch series makes a few updates for C++
compatibility and build issues related to multiple definitions of _ASSERT().
The GoogleTest git submodule is added to the UnitTestFrameworkPkg
and .pytools/CISettings.py file along with an update to the host-based
test runner plugin to set the GTEST_OUTPUT environment variable to 
specify the XML output file format and location.

A port of the unit tests for the the MdePkg BaseSafeIntLib are included
to provide an example that is in both the current unit test style and the
GoogleTest style.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>

Michael D Kinney (7):
  MdePkg/Include: Update Base.h to improve C++ compatibility
  MdePkg/Include/Library: Undefine _ASSERT() if already defined
  UnitTestFrameworkPkg: Add googletest submodule and GoogleTestLib
  UnitTestFrameworkPkg/Library/CmockaLib: Enable symbol files.
  .pytool: Add googletest submodule to CISettings.py
  BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output
  MdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTest

 .gitmodules                                   |    3 +
 .pytool/CISettings.py                         |    2 +
 .../HostBasedUnitTestRunner.py                |    7 +-
 MdePkg/Include/Base.h                         |   12 +-
 MdePkg/Include/Library/DebugLib.h             |    3 +
 .../GoogleTestBaseSafeIntLib.inf              |   37 +
 .../GoogleTestBaseSafeIntLib.uni              |   13 +
 .../SafeIntLibUintnIntnUnitTests32.cpp        |  425 +++
 .../SafeIntLibUintnIntnUnitTests64.cpp        |  429 ++++
 .../BaseSafeIntLib/TestBaseSafeIntLib.cpp     | 2274 +++++++++++++++++
 MdePkg/Test/MdePkgHostTest.dsc                |    1 +
 .../Include/Library/GoogleTestLib.h           |   14 +
 .../Library/CmockaLib/CmockaLib.inf           |    2 +-
 .../Library/GoogleTestLib/GoogleTestLib.inf   |   36 +
 .../Library/GoogleTestLib/GoogleTestLib.uni   |   14 +
 .../Library/GoogleTestLib/googletest          |    1 +
 UnitTestFrameworkPkg/ReadMe.md                |  235 +-
 .../SampleGoogleTest/SampleGoogleTest.cpp     |  263 ++
 .../SampleGoogleTest/SampleGoogleTestHost.inf |   35 +
 .../Test/UnitTestFrameworkPkgHostTest.dsc     |    4 +-
 .../UnitTestFrameworkPkg.ci.yaml              |    4 +-
 UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec |    8 +
 .../UnitTestFrameworkPkgHost.dsc.inc          |    4 +-
 23 files changed, 3790 insertions(+), 36 deletions(-)
 create mode 100644 MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/GoogleTestBaseSafeIntLib.inf
 create mode 100644 MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/GoogleTestBaseSafeIntLib.uni
 create mode 100644 MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/SafeIntLibUintnIntnUnitTests32.cpp
 create mode 100644 MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/SafeIntLibUintnIntnUnitTests64.cpp
 create mode 100644 MdePkg/Test/GoogleTest/Library/BaseSafeIntLib/TestBaseSafeIntLib.cpp
 create mode 100644 UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h
 create mode 100644 UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf
 create mode 100644 UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.uni
 create mode 160000 UnitTestFrameworkPkg/Library/GoogleTestLib/googletest
 create mode 100644 UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTest.cpp
 create mode 100644 UnitTestFrameworkPkg/Test/GoogleTest/Sample/SampleGoogleTest/SampleGoogleTestHost.inf

-- 
2.37.1.windows.1


             reply	other threads:[~2022-11-04  3:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04  3:30 Michael D Kinney [this message]
2022-11-04  3:30 ` [Patch 1/7] MdePkg/Include: Update Base.h to improve C++ compatibility Michael D Kinney
2022-11-04  3:30 ` [Patch 2/7] MdePkg/Include/Library: Undefine _ASSERT() if already defined Michael D Kinney
2022-11-04  3:30 ` [Patch 3/7] UnitTestFrameworkPkg: Add googletest submodule and GoogleTestLib Michael D Kinney
2022-11-04 14:44   ` [edk2-devel] " Michael Kubacki
2022-11-04 16:32     ` Michael D Kinney
2022-11-04  3:30 ` [Patch 4/7] UnitTestFrameworkPkg/Library/CmockaLib: Enable symbol files Michael D Kinney
2022-11-04 14:45   ` [edk2-devel] " Michael Kubacki
2022-11-04  3:30 ` [Patch 5/7] .pytool: Add googletest submodule to CISettings.py Michael D Kinney
2022-11-04 14:46   ` [edk2-devel] " Michael Kubacki
2022-11-04  3:30 ` [Patch 6/7] BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output Michael D Kinney
2022-11-04 13:30   ` Bob Feng
2022-11-04  3:30 ` [Patch 7/7] MdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTest Michael D Kinney

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=20221104033056.1259-1-michael.d.kinney@intel.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