From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web08.21.1667949182063513285 for ; Tue, 08 Nov 2022 15:13:02 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=d5GMF0NA; spf=pass (domain: intel.com, ip: 134.134.136.24, mailfrom: michael.d.kinney@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667949182; x=1699485182; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=FhmnAUuPSIsjj0OjSMk7UTKAVlW/yw1GL6wpi4xjQUE=; b=d5GMF0NADRSWwgiYm1KGjOlpuocIlPNGm/XE2vKk96IusbXCUZC4FNFx emQdBTNBiyZlhRxr9Bv4G5wJ/SMpQDqbvEoXI3Vs4zRnpsIg7I45QuX0v jvG5rYJe5sy7Yr7V5il+glFqlazYleUB4YAaPuauGzrRTOU2aXnSlkC8p YJEigoIPnhhIXbSZae7Z9UYxeOn0mf3y3tm0B33fuavfdfEyW60DdXEnT OcKdOG3Y2YJL2TrXaAgaQm2bwXYhOJh0hsmcql1QJffEqwVeE3GngEexb 977kxx9J1ASxT5aBC/Qincr+l8Al0gIk5oe/uWbAN5BaKkJ1je3m6xBYI g==; X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="311990216" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="311990216" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 15:13:00 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10525"; a="636512147" X-IronPort-AV: E=Sophos;i="5.96,149,1665471600"; d="scan'208";a="636512147" Received: from mdkinney-mobl2.amr.corp.intel.com ([10.209.46.35]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Nov 2022 15:12:59 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Liming Gao , Zhiguang Liu , Bob Feng , Yuwei Chen , Sean Brogan , Michael Kubacki , Andrew Fish , Leif Lindholm Subject: [Patch v3 0/7] Add GoogleTest to UnitTestFrameworkPkg Date: Tue, 8 Nov 2022 15:12:45 -0800 Message-Id: <20221108231252.1864-1-michael.d.kinney@intel.com> X-Mailer: git-send-email 2.37.1.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4134 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. New in V2 --------- * Update maintainers/reviewers * Add feature table to Readme.md and fix typos New in V3 --------- * Add link to googletest license file to Readme.rst Cc: Liming Gao Cc: Zhiguang Liu Cc: Bob Feng Cc: Yuwei Chen Cc: Sean Brogan Cc: Michael Kubacki Cc: Andrew Fish Cc: Leif Lindholm Signed-off-by: Michael D Kinney 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: Generate symbol information .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 + ReadMe.rst | 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 | 255 +- .../SampleGoogleTest/SampleGoogleTest.cpp | 263 ++ .../SampleGoogleTest/SampleGoogleTestHost.inf | 35 + .../Test/UnitTestFrameworkPkgHostTest.dsc | 4 +- .../UnitTestFrameworkPkg.ci.yaml | 4 +- UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | 8 + .../UnitTestFrameworkPkgHost.dsc.inc | 4 +- 24 files changed, 3811 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