From nobody Sun Feb 8 19:02:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+102521+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102521+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1680632555; cv=none; d=zohomail.com; s=zohoarc; b=FR4Hjn/VxdS7TLBCUaGGtH39rQ2fDu3n3u/YfT6rAIZQCok1tHvGurpFOCsMWLpeMab8ipE3HoCwiO5V4X8UFiHFTOzV+xpBK1TIvzNYv0AkW6BoVAWSoGu25AbOnY1zNcxPhvFua37R/f7FHjgmB3fTpMAfH1KlSsTut3eaHjY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680632555; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=vVMo7rpDpr/sdStUH80RFm4E7t0WlO89ZuG0pq2q8ts=; b=VO0d1+ULuX6YHYKOY3w5F9dgNrmBhYMFYSOB+X0QIZScwJ8jClfDT5fdaPL9rimO8KDvdL7fguRDVcfCdFWhIzaQm8tLJAGL7+VEBbC7nhMAmAjIxkoa/HZNIxMlgGCnspTDvOwTK8X6im8OKHGxXOS3hSpn0/amwDJuJgpwyNo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+102521+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1680632555486111.11384799793234; Tue, 4 Apr 2023 11:22:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id tIyvYY1788612xhn8ga5BoNw; Tue, 04 Apr 2023 11:22:35 -0700 X-Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mx.groups.io with SMTP id smtpd.web11.109932.1680632553018435869 for ; Tue, 04 Apr 2023 11:22:33 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="343978589" X-IronPort-AV: E=Sophos;i="5.98,318,1673942400"; d="scan'208";a="343978589" X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2023 11:22:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10670"; a="860686642" X-IronPort-AV: E=Sophos;i="5.98,318,1673942400"; d="scan'208";a="860686642" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.111.152]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Apr 2023 11:22:32 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Chris Johnson , Sean Brogan , Michael Kubacki Subject: [edk2-devel] [Patch v2 03/12] UnitTestFrameworkPkg: Add gmock support to GoogleTestLib Date: Tue, 4 Apr 2023 11:22:11 -0700 Message-Id: <20230404182220.688-4-michael.d.kinney@intel.com> In-Reply-To: <20230404182220.688-1-michael.d.kinney@intel.com> References: <20230404182220.688-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com X-Gm-Message-State: ZEzlNEdWfRSglZtm66thJaykx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1680632555; bh=8RsDabkleCQbSQi39FRSFNkXLUdueSeQYZC6f17YWJc=; h=Cc:Date:From:Reply-To:Subject:To; b=qXyPD4eZ7Y9EixNcCDt5nRc5rIv0gPjJrsEHh2Eyg/KAHoMzdfFLRRkCmy7g7P+qDxw 7Ebl10XDEmw7pWgZtaOsFqwrvwkp5si9k9HGr0QrPVpmzQqrkAUXkfxwpJR4mN2kPBxMb NnCNgVC4u4A62seMvxwktFvT9B+Vp60Y76Y= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1680632556887100011 Content-Type: text/plain; charset="utf-8" From: Chris Johnson REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4389 * 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 * HOST_APPLICATION only supports IA32/X64 Cc: Sean Brogan Cc: Michael Kubacki Cc: Michael D Kinney Signed-off-by: Chris Johnson Reviewed-by: Michael Kubacki --- .../Include/Library/FunctionMockLib.h | 131 ++++++++++++++++++ .../Include/Library/GoogleTestLib.h | 96 +++++++++++++ .../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 - .../Test/UnitTestFrameworkPkgHostTest.dsc | 1 + .../UnitTestFrameworkPkg.ci.yaml | 7 +- UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec | 2 + .../UnitTestFrameworkPkgHost.dsc.inc | 1 + 12 files changed, 291 insertions(+), 7 deletions(-) create mode 100644 UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMo= ckLib.c create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMo= ckLib.inf create mode 100644 UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMo= ckLib.uni diff --git a/UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h b/UnitT= estFrameworkPkg/Include/Library/FunctionMockLib.h new file mode 100644 index 000000000000..bf7a7066560a --- /dev/null +++ b/UnitTestFrameworkPkg/Include/Library/FunctionMockLib.h @@ -0,0 +1,131 @@ +/** @file + This header allows the mocking of free (C style) functions using gmock. + + Copyright (c) 2023, Intel Corporation. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef FUNCTION_MOCK_LIB_H_ +#define FUNCTION_MOCK_LIB_H_ + +#include +#include +#include + +//////////////////////////////////////////////////////////////////////////= //// +// The below macros are the public function mock interface that are intend= ed +// to be used outside this file. + +#define MOCK_INTERFACE_DECLARATION(MOCK) \ + static MOCK * Instance; \ + MOCK (); \ + ~MOCK (); + +#define MOCK_INTERFACE_DEFINITION(MOCK) \ + MOCK_STATIC_INSTANCE_DEFINITION (MOCK) \ + MOCK_INTERFACE_CONSTRUCTOR (MOCK) \ + MOCK_INTERFACE_DECONSTRUCTOR (MOCK) + +// Mock function declaration for external functions (i.e. functions to +// mock that do not exist in the compilation unit). +#define MOCK_FUNCTION_DECLARATION(RET_TYPE, FUNC, ARGS) \ + MOCK_FUNCTION_TYPE_DEFINITIONS(RET_TYPE, FUNC, ARGS) \ + MOCK_METHOD (RET_TYPE, FUNC, ARGS); + +// Mock function definition for external functions (i.e. functions to +// mock that do not exist in the compilation unit). +#define MOCK_FUNCTION_DEFINITION(MOCK, FUNC, NUM_ARGS, CALL_TYPE) \ + FUNCTION_DEFINITION_TO_CALL_MOCK(MOCK, FUNC, FUNC, NUM_ARGS, CALL_TYPE) + +// Mock function declaration for internal functions (i.e. functions to +// mock that already exist in the compilation unit). +#define MOCK_FUNCTION_INTERNAL_DECLARATION(RET_TYPE, FUNC, ARGS) \ + MOCK_FUNCTION_DECLARATION(RET_TYPE, FUNC, ARGS) \ + MOCK_FUNCTION_HOOK_DECLARATIONS(FUNC) + +// Mock function definition for internal functions (i.e. functions to +// mock that already exist in the compilation unit). This definition also +// implements MOCK_FUNC() which is later hooked as FUNC(). +#define MOCK_FUNCTION_INTERNAL_DEFINITION(MOCK, FUNC, NUM_ARGS, CALL_TYPE)= \ + FUNCTION_DEFINITION_TO_CALL_MOCK(MOCK, FUNC, MOCK##_##FUNC, NUM_ARGS, CA= LL_TYPE) \ + MOCK_FUNCTION_HOOK_DEFINITIONS(MOCK, FUNC) + +//////////////////////////////////////////////////////////////////////////= //// +// The below macros are private and should not be used outside this file. + +#define MOCK_FUNCTION_HOOK_DECLARATIONS(FUNC) \ + static subhook::Hook Hook##FUNC; \ + struct MockContainer_##FUNC { \ + MockContainer_##FUNC (); \ + ~MockContainer_##FUNC (); \ + }; \ + MockContainer_##FUNC MockContainerInst_##FUNC; + +// This definition implements a constructor and destructor inside a nested +// class to enable automatic installation of the hooks to the associated +// MOCK_FUNC() when the mock object is instantiated in scope and automatic +// removal when the instantiated mock object goes out of scope. +#define MOCK_FUNCTION_HOOK_DEFINITIONS(MOCK, FUNC) \ + subhook :: Hook MOCK :: Hook##FUNC; \ + MOCK :: MockContainer_##FUNC :: MockContainer_##FUNC () { \ + if (MOCK :: Instance =3D=3D NULL) = \ + MOCK :: Hook##FUNC .Install( \ + (FUNC##_ret_type *) ::FUNC, \ + (FUNC##_ret_type *) MOCK##_##FUNC); \ + } \ + MOCK :: MockContainer_##FUNC :: ~MockContainer_##FUNC () { \ + MOCK :: Hook##FUNC .Remove(); \ + } \ + static_assert( \ + std::is_same::value, \ + "Function signature from 'MOCK_FUNCTION_INTERNAL_DEFINITION' macro " \ + "invocation for '" #FUNC "' does not match the function signature " \ + "of '" #FUNC "' function it is mocking. Mismatch could be due to " \ + "different return type, arguments, or calling convention. See " \ + "associated 'MOCK_FUNCTION_INTERNAL_DECLARATION' macro invocation " \ + "for more details."); + +#define MOCK_FUNCTION_TYPE_DEFINITIONS(RET_TYPE, FUNC, ARGS) \ + using FUNC##_ret_type =3D RET_TYPE; \ + using FUNC##_type =3D FUNC##_ret_type ARGS; + +// This function definition simply calls MOCK::Instance->FUNC() which is t= he +// mocked counterpart of the original function. This allows using gmock wi= th +// C free functions (since by default gmock only works with object methods= ). +#define FUNCTION_DEFINITION_TO_CALL_MOCK(MOCK, FUNC, FUNC_DEF_NAME, NUM_AR= GS, CALL_TYPE) \ + extern "C" { = \ + typename MOCK :: FUNC##_ret_type CALL_TYPE FUNC_DEF_NAME( = \ + GMOCK_PP_REPEAT(GMOCK_INTERNAL_PARAMETER, = \ + (MOCK :: FUNC##_type), = \ + NUM_ARGS)) = \ + { = \ + EXPECT_TRUE(MOCK :: Instance !=3D NULL) = \ + << "Called '" #FUNC "' in '" #MOCK "' function mock object before = " \ + << "an instance of '" #MOCK "' was created in test '" = \ + << ::testing::UnitTest::GetInstance()->current_test_info()->name()= \ + << "'."; = \ + return MOCK :: Instance->FUNC( = \ + GMOCK_PP_REPEAT(GMOCK_INTERNAL_FORWARD_ARG, = \ + (MOCK :: FUNC##_type), = \ + NUM_ARGS)); = \ + } = \ + } + +#define MOCK_STATIC_INSTANCE_DEFINITION(MOCK) MOCK * MOCK :: Instance =3D= NULL; + +#define MOCK_INTERFACE_CONSTRUCTOR(MOCK) = \ + MOCK :: MOCK () { = \ + EXPECT_TRUE(MOCK :: Instance =3D=3D NULL) = \ + << "Multiple instances of '" #MOCK "' function mock object were " = \ + << "created and only one instance is allowed in test '" = \ + << ::testing::UnitTest::GetInstance()->current_test_info()->name() = \ + << "'."; = \ + MOCK :: Instance =3D this; = \ + } + +#define MOCK_INTERFACE_DECONSTRUCTOR(MOCK) \ + MOCK :: ~ MOCK () { \ + MOCK :: Instance =3D NULL; \ + } + +#endif // FUNCTION_MOCK_LIB_H_ diff --git a/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h b/UnitTes= tFrameworkPkg/Include/Library/GoogleTestLib.h index ebec766d4cf7..c0a3d8e66011 100644 --- a/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h +++ b/UnitTestFrameworkPkg/Include/Library/GoogleTestLib.h @@ -10,5 +10,101 @@ #define GOOGLE_TEST_LIB_H_ =20 #include +#include +#include + +extern "C" { +#include +} + +//////////////////////////////////////////////////////////////////////////= //// +// Below are the action extensions to GoogleTest and gmock for EDK2 types. +// These actions are intended to be used in EXPECT_CALL (and related gmock +// macros) to support assignments to output arguments in the expected call. +// + +// Action to support pointer types to a buffer (such as UINT8* or VOID*) +ACTION_TEMPLATE ( + SetArgBuffer, + HAS_1_TEMPLATE_PARAMS (size_t, ArgNum), + AND_2_VALUE_PARAMS (Buffer, ByteSize) + ) { + auto ArgBuffer =3D std::get(args); + + std::memcpy (ArgBuffer, Buffer, ByteSize); +} + +//////////////////////////////////////////////////////////////////////////= //// +// Below are the matcher extensions to GoogleTest and gmock for EDK2 types. +// These matchers are intended to be used in EXPECT_CALL (and related gmock +// macros) to support comparisons to input arguments in the expected call. +// +// Note that these matchers can also be used in the EXPECT_THAT or ASSERT_= THAT +// macros to compare whether two values are equal. +// + +// Matcher to support pointer types to a buffer (such as UINT8* or VOID* or +// any structure pointer) +MATCHER_P2 ( + BufferEq, + Buffer, + ByteSize, + std::string ("buffer data to ") + (negation ? "not " : "") + "be the sam= e" + ) { + UINT8 *Actual =3D (UINT8 *)arg; + UINT8 *Expected =3D (UINT8 *)Buffer; + + for (size_t i =3D 0; i < ByteSize; i++) { + if (Actual[i] !=3D Expected[i]) { + *result_listener << "byte at offset " << i + << " does not match expected. [" << std::hex + << "Actual: 0x" << std::setw (2) << std::setfill ('0') + << (unsigned int)Actual[i] << ", " + << "Expected: 0x" << std::setw (2) << std::setfill ('0') + << (unsigned int)Expected[i] << "]"; + return false; + } + } + + *result_listener << "all bytes match"; + return true; +} + +// Matcher to support CHAR16* type +MATCHER_P ( + Char16StrEq, + String, + std::string ("strings to ") + (negation ? "not " : "") + "be the same" + ) { + CHAR16 *Actual =3D (CHAR16 *)arg; + CHAR16 *Expected =3D (CHAR16 *)String; + + for (size_t i =3D 0; Actual[i] !=3D 0; i++) { + if (Actual[i] !=3D Expected[i]) { + *result_listener << "character at offset " << i + << " does not match expected. [" << std::hex + << "Actual: 0x" << std::setw (4) << std::setfill ('0') + << Actual[i]; + + if (std::isprint (Actual[i])) { + *result_listener << " ('" << (char)Actual[i] << "')"; + } + + *result_listener << ", Expected: 0x" << std::setw (4) << std::setfil= l ('0') + << Expected[i]; + + if (std::isprint (Expected[i])) { + *result_listener << " ('" << (char)Expected[i] << "')"; + } + + *result_listener << "]"; + + return false; + } + } + + *result_listener << "strings match"; + return true; +} =20 #endif diff --git a/UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf b/UnitTes= tFrameworkPkg/Library/CmockaLib/CmockaLib.inf index 052c7f557210..eeee6bc2b3f5 100644 --- a/UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf +++ b/UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf @@ -16,7 +16,7 @@ [Defines] LIBRARY_CLASS =3D CmockaLib|HOST_APPLICATION =20 # -# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 +# VALID_ARCHITECTURES =3D IA32 X64 # =20 [Sources] diff --git a/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c= b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c new file mode 100644 index 000000000000..b7bb23f1868b --- /dev/null +++ b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.c @@ -0,0 +1,7 @@ +/** @file + Macro-only FunctionMockLib library instance with no services. + + Copyright (c) 2023, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ diff --git a/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.i= nf b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf new file mode 100644 index 000000000000..4b0662a8b96d --- /dev/null +++ b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf @@ -0,0 +1,31 @@ +## @file +# This module provides FunctionMockLib Library implementation. +# +# Copyright (c) 2023, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D FunctionMockLib + MODULE_UNI_FILE =3D FunctionMockLib.uni + FILE_GUID =3D DF1CAF2F-D584-4EC1-9ABF-07E8B10AD560 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 0.1 + LIBRARY_CLASS =3D FunctionMockLib|HOST_APPLICATION + +# +# VALID_ARCHITECTURES =3D IA32 X64 +# + +[Sources] + FunctionMockLib.c + +[LibraryClasses] + GoogleTestLib + SubhookLib + +[Packages] + MdePkg/MdePkg.dec + UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec diff --git a/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.u= ni b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni new file mode 100644 index 000000000000..13e5308ce0e7 --- /dev/null +++ b/UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.uni @@ -0,0 +1,11 @@ +// /** @file +// This module provides FunctionMockLib Library implementation. +// +// Copyright (c) 2023, Intel Corporation. All rights reserved.
+// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + +#string STR_MODULE_ABSTRACT #language en-US "FunctionMockLib L= ibrary implementation" + +#string STR_MODULE_DESCRIPTION #language en-US "This module provi= des FunctionMockLib Library implementation." diff --git a/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf b= /UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf index 68db75d7023f..1203a0e6eccd 100644 --- a/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf +++ b/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf @@ -16,20 +16,22 @@ [Defines] LIBRARY_CLASS =3D GoogleTestLib|HOST_APPLICATION =20 # -# VALID_ARCHITECTURES =3D IA32 X64 ARM AARCH64 +# VALID_ARCHITECTURES =3D IA32 X64 # =20 [Sources] googletest/googletest/src/gtest-all.cc + googletest/googlemock/src/gmock-all.cc =20 [Packages] + MdePkg/MdePkg.dec UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec =20 [BuildOptions] MSFT:*_*_*_CC_FLAGS =3D=3D /c /EHsc /Zi MSFT:NOOPT_*_*_CC_FLAGS =3D /Od =20 - GCC:*_*_*_CC_FLAGS =3D=3D -g -c + GCC:*_*_*_CC_FLAGS =3D=3D -g -c -fshort-wchar =20 GCC:NOOPT_*_*_CC_FLAGS =3D -O0 GCC:*_*_IA32_CC_FLAGS =3D -m32 diff --git a/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.uni b= /UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.uni index 14c862a23744..695588ce3f46 100644 --- a/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.uni +++ b/UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.uni @@ -1,10 +1,7 @@ // /** @file // This module provides GoogleTest Library implementation. // -// This module provides GoogleTest Library implementation. -// // Copyright (c) 2022, Intel Corporation. All rights reserved.
-// // SPDX-License-Identifier: BSD-2-Clause-Patent // // **/ diff --git a/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc b/U= nitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc index 722509c8f26f..f14961ad86d0 100644 --- a/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc +++ b/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc @@ -34,6 +34,7 @@ [Components] UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.inf UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.inf + UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMockLib.inf UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAlloca= tionLibPosix.inf UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.inf diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml b/UnitTestFr= ameworkPkg/UnitTestFrameworkPkg.ci.yaml index d8f8e024c476..be839d1af0a7 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml @@ -79,9 +79,14 @@ "AuditOnly": False, # Fails test but run in AuditOnly mo= de to collect log "IgnoreFiles": [ # use gitignore syntax to ignore erro= rs in matching files "Library/CmockaLib/cmocka/**/*.*", # not going to spell check= a submodule - "Library/GoogleTestLib/googletest/**/*.*" # not going to spel= l check a submodule + "Library/GoogleTestLib/googletest/**/*.*", # not going to spe= ll check a submodule + "Library/SubhookLib/subhook/**/*.*" # not going to spell chec= k a submodule ], "ExtendWords": [ # words to extend to the dictionary f= or this package + "Pointee", + "gmock", + "GMOCK", + "DSUBHOOK", "testcase", "testsuites", "cmocka", diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec b/UnitTestFramew= orkPkg/UnitTestFrameworkPkg.dec index 30b489915d4a..ef0a148d4876 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec @@ -26,6 +26,7 @@ [Includes.Common.Private] PrivateInclude Library/CmockaLib/cmocka/include/cmockery Library/GoogleTestLib/googletest/googletest + Library/GoogleTestLib/googletest/googlemock =20 [LibraryClasses] ## @libraryclass Allows save and restore unit test internal state @@ -36,6 +37,7 @@ [LibraryClasses] # GoogleTestLib|Include/Library/GoogleTestLib.h SubhookLib|Include/Library/SubhookLib.h + FunctionMockLib|Include/Library/FunctionMockLib.h =20 [LibraryClasses.Common.Private] ## @libraryclass Provides a unit test result report diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTe= stFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc index e77897bd326f..7866c36e6693 100644 --- a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc @@ -16,6 +16,7 @@ [LibraryClasses.common.HOST_APPLICATION] CmockaLib|UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf GoogleTestLib|UnitTestFrameworkPkg/Library/GoogleTestLib/GoogleTestLib.i= nf SubhookLib|UnitTestFrameworkPkg/Library/SubhookLib/SubhookLib.inf + FunctionMockLib|UnitTestFrameworkPkg/Library/FunctionMockLib/FunctionMoc= kLib.inf UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.i= nf DebugLib|UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.= inf MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationL= ibPosix/MemoryAllocationLibPosix.inf --=20 2.39.1.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#102521): https://edk2.groups.io/g/devel/message/102521 Mute This Topic: https://groups.io/mt/98066295/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-