UnitTestFrameworkPkg: Add gmock support to GoogleTestLib

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

* 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 <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Chris Johnson <chris.n.johnson@intel.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
Chris Johnson
2023-03-24 16:43:10 -07:00
committed by mergify[bot]
parent caa389625f
commit d0252b8fc1
12 changed files with 297 additions and 18 deletions

View File

@@ -16,7 +16,7 @@
LIBRARY_CLASS = CmockaLib|HOST_APPLICATION
#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]

View File

@@ -0,0 +1,7 @@
/** @file
Macro-only FunctionMockLib library instance with no services.
Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

View File

@@ -0,0 +1,31 @@
## @file
# This module provides FunctionMockLib Library implementation.
#
# Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
[Defines]
INF_VERSION = 0x00010018
BASE_NAME = FunctionMockLib
MODULE_UNI_FILE = FunctionMockLib.uni
FILE_GUID = DF1CAF2F-D584-4EC1-9ABF-07E8B10AD560
MODULE_TYPE = HOST_APPLICATION
VERSION_STRING = 0.1
LIBRARY_CLASS = FunctionMockLib
#
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
FunctionMockLib.c
[LibraryClasses]
GoogleTestLib
SubhookLib
[Packages]
MdePkg/MdePkg.dec
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec

View File

@@ -0,0 +1,11 @@
// /** @file
// This module provides FunctionMockLib Library implementation.
//
// Copyright (c) 2023, Intel Corporation. All rights reserved.<BR>
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// **/
#string STR_MODULE_ABSTRACT #language en-US "FunctionMockLib Library implementation"
#string STR_MODULE_DESCRIPTION #language en-US "This module provides FunctionMockLib Library implementation."

View File

@@ -7,30 +7,27 @@
##
[Defines]
INF_VERSION = 0x00010005
INF_VERSION = 0x00010018
BASE_NAME = GoogleTestLib
MODULE_UNI_FILE = GoogleTestLib.uni
FILE_GUID = A90E4751-AD30-43CC-980B-01E356B49ADF
MODULE_TYPE = BASE
MODULE_TYPE = HOST_APPLICATION
VERSION_STRING = 0.1
LIBRARY_CLASS = GoogleTestLib|HOST_APPLICATION
LIBRARY_CLASS = GoogleTestLib
#
# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
# VALID_ARCHITECTURES = IA32 X64
#
[Sources]
googletest/googletest/src/gtest-all.cc
googletest/googlemock/src/gmock-all.cc
[Packages]
MdePkg/MdePkg.dec
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec
[BuildOptions]
MSFT:*_*_*_CC_FLAGS == /c /EHsc /Zi
MSFT:NOOPT_*_*_CC_FLAGS = /Od
GCC:*_*_*_CC_FLAGS == -g -c
GCC:NOOPT_*_*_CC_FLAGS = -O0
GCC:*_*_IA32_CC_FLAGS = -m32
GCC:*_*_X64_CC_FLAGS = -m64
MSFT:*_*_*_CC_FLAGS == /c /EHsc /Zi /Od
GCC:*_*_IA32_CC_FLAGS == -g -c -fshort-wchar -O0 -m32
GCC:*_*_X64_CC_FLAGS == -g -c -fshort-wchar -O0 -m64

View File

@@ -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.<BR>
//
// SPDX-License-Identifier: BSD-2-Clause-Patent
//
// **/