* [PATCH 1/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Add cmocka submodule.
2019-05-22 7:20 [PATCH 0/4] [staging/HBFA PATCH]: Enable cmocka unit test build with submodule Sun, Tengfen
@ 2019-05-22 7:20 ` Sun, Tengfen
2019-05-22 7:20 ` [PATCH 2/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Enable CmockaHostUnitTestPkg build Sun, Tengfen
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Sun, Tengfen @ 2019-05-22 7:20 UTC (permalink / raw)
To: devel; +Cc: jiewen.yao, liming.gao, tengfen.sun, chris.wu
Add cmocka submodule to improve the current build process.
REF: https://edk2.groups.io/g/devel/message/39893
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Tengfen Sun <tengfen.sun@intel.com>
---
.gitmodules | 3 +++
HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka | 1 +
2 files changed, 4 insertions(+)
create mode 100644 .gitmodules
create mode 160000 HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000000..b85f2bd60241
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka"]
+ path = HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka
+ url = https://git.cryptomilk.org/projects/cmocka.git
diff --git a/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka
new file mode 160000
index 000000000000..546bd5092424
--- /dev/null
+++ b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/cmocka
@@ -0,0 +1 @@
+Subproject commit 546bd50924245f4ca7292a3ef6a92504aa375455
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Enable CmockaHostUnitTestPkg build.
2019-05-22 7:20 [PATCH 0/4] [staging/HBFA PATCH]: Enable cmocka unit test build with submodule Sun, Tengfen
2019-05-22 7:20 ` [PATCH 1/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Add cmocka submodule Sun, Tengfen
@ 2019-05-22 7:20 ` Sun, Tengfen
2019-05-22 7:20 ` [PATCH 3/4] [staging/HBFA PATCH]: UefiHostUnitTestCasePkg: Add CmockaLib Sun, Tengfen
2019-05-22 7:20 ` [PATCH 4/4] [staging/HBFA PATCH]: UefiHostUnitTestPkg: Enable cmocka unit test build with CmockaHostUnitTestPkg Sun, Tengfen
3 siblings, 0 replies; 5+ messages in thread
From: Sun, Tengfen @ 2019-05-22 7:20 UTC (permalink / raw)
To: devel; +Cc: jiewen.yao, liming.gao, tengfen.sun, chris.wu
Enable build for CmockaHostUnitTestPkg with cmocka submodule.
REF: https://edk2.groups.io/g/devel/message/39893
Signed-off-by: Tengfen Sun <tengfen.sun@intel.com>
---
.../CmockaHostUnitTestPkg.dec | 16 +++++++++
.../CmockaHostUnitTestPkg.dsc | 22 +++++++++++++
.../Library/CmockaLib/CmockaLib.inf | 33 +++++++++++++++++++
.../Library/CmockaLib/CmockaLib.uni | 16 +++++++++
4 files changed, 87 insertions(+)
create mode 100644 HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
create mode 100644 HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dsc
create mode 100644 HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
create mode 100644 HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.uni
diff --git a/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec b/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
new file mode 100644
index 000000000000..85b41b1165d4
--- /dev/null
+++ b/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
@@ -0,0 +1,16 @@
+## @file CmockaHostUnitTestPkg.dec
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ DEC_SPECIFICATION = 0x00010005
+ PACKAGE_NAME = CmockaHostUnitTestPkg
+ PACKAGE_GUID = 09566709-F1CA-4365-BB99-FC7869BE4E1C
+ PACKAGE_VERSION = 0.1
+
+[Includes]
+ Library/CmockaLib/cmocka/include
+ Library/CmockaLib/cmocka/include/cmockery
\ No newline at end of file
diff --git a/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dsc b/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dsc
new file mode 100644
index 000000000000..27868fc5e050
--- /dev/null
+++ b/HBFA/CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dsc
@@ -0,0 +1,22 @@
+## @file CmockaHostUnitTestPkg.dsc
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ PLATFORM_NAME = CmockaHostUnitTestPkg
+ PLATFORM_GUID = AD571B20-0E74-4513-AE17-E557079A9756
+ PLATFORM_VERSION = 0.1
+ DSC_SPECIFICATION = 0x00010005
+ OUTPUT_DIRECTORY = Build/CmockaHostUnitTestPkg
+ SUPPORTED_ARCHITECTURES = IA32|X64
+ BUILD_TARGETS = DEBUG|RELEASE
+ SKUID_IDENTIFIER = DEFAULT
+
+[LibraryClasses]
+ CmockaLib|CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
+
+[Components]
+ CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
\ No newline at end of file
diff --git a/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
new file mode 100644
index 000000000000..dc9f48347625
--- /dev/null
+++ b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
@@ -0,0 +1,33 @@
+## @file
+# This module provides Cmocka Library implementation.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = CmockaLib
+ MODULE_UNI_FILE = CmockaLib.uni
+ FILE_GUID = F1662152-3399-49AC-BE44-CAA97575FACE
+ MODULE_TYPE = BASE
+ VERSION_STRING = 0.1
+ LIBRARY_CLASS = CmockaLib
+ DEFINE CMOCKA_PATH = cmocka
+
+#
+# VALID_ARCHITECTURES = IA32 X64 ARM AARCH64
+#
+
+[Sources]
+ $(CMOCKA_PATH)/src/cmocka.c
+
+[Packages]
+ CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
+
+[BuildOptions]
+ MSFT:*_*_*_CC_FLAGS == /c /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1 /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1 -DHAVE_VSNPRINTF -DHAVE_SNPRINTF
+
+ GCC:*_*_IA32_CC_FLAGS == -m32 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
+ GCC:*_*_X64_CC_FLAGS == -m64 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
diff --git a/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.uni b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.uni
new file mode 100644
index 000000000000..5a114b934554
--- /dev/null
+++ b/HBFA/CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.uni
@@ -0,0 +1,16 @@
+// /** @file
+// This module provides Cmocka Library implementation.
+//
+// This module provides Cmocka Library implementation.
+//
+// Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+//
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+//
+// **/
+
+
+#string STR_MODULE_ABSTRACT #language en-US "Cmocka Library implementation"
+
+#string STR_MODULE_DESCRIPTION #language en-US "This module provides Cmocka Library implementation."
+
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/4] [staging/HBFA PATCH]: UefiHostUnitTestCasePkg: Add CmockaLib
2019-05-22 7:20 [PATCH 0/4] [staging/HBFA PATCH]: Enable cmocka unit test build with submodule Sun, Tengfen
2019-05-22 7:20 ` [PATCH 1/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Add cmocka submodule Sun, Tengfen
2019-05-22 7:20 ` [PATCH 2/4] [staging/HBFA PATCH]: CmockaHostUnitTestPkg: Enable CmockaHostUnitTestPkg build Sun, Tengfen
@ 2019-05-22 7:20 ` Sun, Tengfen
2019-05-22 7:20 ` [PATCH 4/4] [staging/HBFA PATCH]: UefiHostUnitTestPkg: Enable cmocka unit test build with CmockaHostUnitTestPkg Sun, Tengfen
3 siblings, 0 replies; 5+ messages in thread
From: Sun, Tengfen @ 2019-05-22 7:20 UTC (permalink / raw)
To: devel; +Cc: jiewen.yao, liming.gao, tengfen.sun, chris.wu
Add CmockaLib into UefiHostUnitTestCasePkg.dsc
REF: https://edk2.groups.io/g/devel/message/39893
Signed-off-by: Tengfen Sun <tengfen.sun@intel.com>
---
.../UefiHostUnitTestCasePkg.dsc | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/HBFA/UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc b/HBFA/UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc
index d116062eb2d3..8fe1f5b76b7b 100644
--- a/HBFA/UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc
+++ b/HBFA/UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc
@@ -99,6 +99,7 @@
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
UnitTestLib|UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf
UnitTestAssertLib|UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf
+ CmockaLib|CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
!endif
!if $(OPENSSL_TEST_ENABLE)
@@ -181,6 +182,16 @@
!endif
[Components]
+!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
+ CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf {
+ <BuildOptions>
+ MSFT:*_*_*_CC_FLAGS == /c /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1 /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1 -DHAVE_VSNPRINTF -DHAVE_SNPRINTF
+
+ GCC:*_*_IA32_CC_FLAGS == -m32 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
+ GCC:*_*_X64_CC_FLAGS == -m64 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
+ }
+!endif
+
UefiHostUnitTestCasePkg/TestCase/FatPkg/FatPei/TestPeiGpt.inf {
<LibraryClasses>
NULL|UefiHostUnitTestCasePkg/TestCase/FatPkg/FatPei/Override/FatPei.inf
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 4/4] [staging/HBFA PATCH]: UefiHostUnitTestPkg: Enable cmocka unit test build with CmockaHostUnitTestPkg
2019-05-22 7:20 [PATCH 0/4] [staging/HBFA PATCH]: Enable cmocka unit test build with submodule Sun, Tengfen
` (2 preceding siblings ...)
2019-05-22 7:20 ` [PATCH 3/4] [staging/HBFA PATCH]: UefiHostUnitTestCasePkg: Add CmockaLib Sun, Tengfen
@ 2019-05-22 7:20 ` Sun, Tengfen
3 siblings, 0 replies; 5+ messages in thread
From: Sun, Tengfen @ 2019-05-22 7:20 UTC (permalink / raw)
To: devel; +Cc: jiewen.yao, liming.gao, tengfen.sun, chris.wu
In order to improve the current build process, enable cmocka unit test build with CmockaHostUnitTestPkg.
REF: https://edk2.groups.io/g/devel/message/39893
Signed-off-by: Tengfen Sun <tengfen.sun@intel.com>
---
.../UnitTestAssertLibcmocka.inf | 4 +-
.../UnitTestLibcmocka/UnitTestLibcmocka.inf | 2 +
HBFA/UefiHostUnitTestPkg/ReadMe-cmocka.txt | 85 ++++---------------
.../SampleUnitTestcmocka.inf | 2 +
.../UefiHostUnitTestBuildOption.dsc | 40 +++------
.../UefiHostUnitTestPkg.dsc | 8 ++
6 files changed, 44 insertions(+), 97 deletions(-)
diff --git a/HBFA/UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf b/HBFA/UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf
index ef780e1fb0db..fd6098a3136b 100644
--- a/HBFA/UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf
+++ b/HBFA/UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf
@@ -15,11 +15,13 @@
[LibraryClasses]
BaseMemoryLib
+ CmockaLib
[Packages]
MdePkg/MdePkg.dec
UnitTestPkg/UnitTestPkg.dec
UefiHostUnitTestPkg/UefiHostUnitTestPkg.dec
-
+ CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
+
[Sources]
UnitTestAssertLib.c
diff --git a/HBFA/UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf b/HBFA/UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf
index 376c57d33fac..68bd26c4b7db 100644
--- a/HBFA/UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf
+++ b/HBFA/UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf
@@ -17,12 +17,14 @@
BaseLib
MemoryAllocationLib
OsServiceLib
+ CmockaLib
[Packages]
MdePkg/MdePkg.dec
UnitTestPkg/UnitTestPkg.dec
UefiHostTestPkg/UefiHostTestPkg.dec
UefiHostUnitTestPkg/UefiHostUnitTestPkg.dec
+ CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
[Sources]
UnitTestLib.c
diff --git a/HBFA/UefiHostUnitTestPkg/ReadMe-cmocka.txt b/HBFA/UefiHostUnitTestPkg/ReadMe-cmocka.txt
index b1d3781ba5fc..f4b8d51f3058 100644
--- a/HBFA/UefiHostUnitTestPkg/ReadMe-cmocka.txt
+++ b/HBFA/UefiHostUnitTestPkg/ReadMe-cmocka.txt
@@ -1,77 +1,26 @@
How to run cmocka for UEFI code.
=========================
-0) download CMake (http://www.cmake.org/)
-
-1) install cmocka-1.1.5
-Part A: Install cmocka in linux
-1.1 download cmocka-1.1.5.tar.xz (https://cmocka.org/) and unzip it ($tar xJvf cmocka-1.1.5.tar.xz)
-1.2 build
- $ cd cmocka-1.1.5
- $ mkdir build
- $ cd build
- $ export CFLAGS=-m32
- $ export CXXFLAGS=-m32
- $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -D WITH_STATIC_LIB=ON ..
- $ make
- $ sudo sh -c "echo '<...>/cmocka-1.1.5/build/src' >> /etc/ld.so.conf"
- $ sudo ldconfig
- $ cd ..
- $ mkdir build64
- $ cd build64
- $ export CFLAGS=-m64
- $ export CXXFLAGS=-m64
- $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -D WITH_STATIC_LIB=ON ..
- $ make
- $ sudo sh -c "echo '<...>/cmocka-1.1.5/build64/src' >> /etc/ld.so.conf"
- $ sudo ldconfig
-
- the lib is at ./src/libcmocka-static.a, ./src/libcmocka.so
-
-1.3 export CMOCKA_INC_PATH=<...>/cmocka-1.1.5/include
- export CMOCKA_LIB_PATH=<...>/cmocka-1.1.5/build/src
- export CMOCKA_LIB_PATH_64=<...>/cmocka-1.1.5/build64/src
- export CMOCKA_LIB_NAME=cmocka[-static]
- export CMOCKA_LIB_NAME_64=cmocka[-static]
-
-Part B: Install cmocka in windows
-1.1 download cmocka-1.1.5 from https://cmocka.org/, and unzip cmocka-1.1.5.tar.xz
-1.2 open visual studio dev command prompt, to go
- cd <...>\cmocka-1.1.5\
- mkdir build
- cd build
- cmake -G "Visual Studio 14 2015" -D WITH_STATIC_LIB=ON ..
-
- mkdir build64
- cd build64
- cmake -G "Visual Studio 14 2015 Win64" -D WITH_STATIC_LIB=ON ..
-
-1.3 load solution at cmocka.sln, and build the solution.
- or type:
- devenv cmocka.sln /Build [Debug|Release] /Project cmocka[-static]
-
- static lib can be found at:
- cmocka-1.1.5\[build|build64]\src\[Debug|Release]\cmocka-static.lib
-
- dynamic lib can be found at:
- cmocka-1.1.5\[build|build64]\src\[Debug|Release]\cmocka.[lib|dll]
-
-1.4 set CMOCKA_INC_PATH=<...>\cmocka-1.1.5\include
- set CMOCKA_LIB_PATH=<...>\cmocka-1.1.5\build\src\[Debug|Release]
- set CMOCKA_LIB_PATH_64=<...>\cmocka-1.1.5\build64\src\[Debug|Release]
- set CMOCKA_LIB_NAME=cmocka[-static].lib
- set CMOCKA_LIB_NAME_64=cmocka[-static].lib
-
-1.5 add env path, only for dynamic lib build
- Add %CMOCKA_LIB_PATH% to %PATH%, for IA32 run.
- Add %CMOCKA_LIB_PATH_64% to %PATH%, for X64 run.
+1) install cmocka
+ Cmocka repository was added as one submodule of HBFA project.
+ The user can use the following commands to clone both main HBFA repo and Cmocka submodule:
+ Add the "--recursive" flag to the git clone command:
+ $ git clone --recursive <HBFA_REPO_URL>
+or
+ Manually initialize and update the submodules after the clone operation on main project:
+ $ git clone <HBFA_REPO_URL>
+ $ git submodule update --init --recursive
+
+ And use the following combined commands to pull the remote submodule updates
+(e.g. Updating the new supported Cmocka release tag):
+ $ git pull --recurse-submodules && git submodule update --recursive
2) run sample code (Basic Mode)
Part A: Build in Linux
- build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t GCC5 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA --disable-include-path-check
+ build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t GCC5 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA
<...>/Build/UefiHostUnitTestCasePkg/DEBUG_GCC5/X64/TestBaseSafeIntLib
Part B: Build in Windows
- build -p UefiHostUnitTestCasePkg\UefiHostUnitTestCasePkg.dsc -a X64 -t VS2015x86 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA --disable-include-path-check
+ build -p UefiHostUnitTestCasePkg\UefiHostUnitTestCasePkg.dsc -a X64 -t VS2015x86 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA
<...>\Build\UefiHostUnitTestCasePkg\DEBUG_VS2015x86\X64\TestBaseSafeIntLib.exe
You may see below. Have fun
@@ -108,12 +57,12 @@ Int Safe Lib Unit Test Application v0.1
set environment variable: CMOCKA_XML_FILE=<test.xml>
Build in Linux
- build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t GCC5 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA -DUNIT_TEST_XML_MODE --disable-include-path-check
+ build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t GCC5 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA -DUNIT_TEST_XML_MODE
export CMOCKA_XML_FILE=TestBaseSafeIntLib.X64.xml
./Build/UefiHostUnitTestCasePkg/DEBUG_GCC5/X64/TestBaseSafeIntLib
Build in Windows
- build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t VS2015x86 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA -DUNIT_TEST_XML_MODE --disable-include-path-check
+ build -p UefiHostUnitTestCasePkg/UefiHostUnitTestCasePkg.dsc -a X64 -t VS2015x86 -DUNIT_TEST_FRAMEWORK_MODE=CMOCKA -DUNIT_TEST_XML_MODE
set CMOCKA_XML_FILE=TestBaseSafeIntLib.X64.xml
<...>\Build\UefiHostUnitTestCasePkg\DEBUG_VS2015x86\X64\TestBaseSafeIntLib.exe
diff --git a/HBFA/UefiHostUnitTestPkg/Sample/SampleUnitTestcmocka/SampleUnitTestcmocka.inf b/HBFA/UefiHostUnitTestPkg/Sample/SampleUnitTestcmocka/SampleUnitTestcmocka.inf
index 5c7fb45b3dd6..f33c0b612acf 100644
--- a/HBFA/UefiHostUnitTestPkg/Sample/SampleUnitTestcmocka/SampleUnitTestcmocka.inf
+++ b/HBFA/UefiHostUnitTestPkg/Sample/SampleUnitTestcmocka/SampleUnitTestcmocka.inf
@@ -23,6 +23,7 @@
MdePkg/MdePkg.dec
UnitTestPkg/UnitTestPkg.dec
UefiHostUnitTestPkg/UefiHostUnitTestPkg.dec
+ CmockaHostUnitTestPkg/CmockaHostUnitTestPkg.dec
[Protocols]
@@ -33,6 +34,7 @@
UnitTestLib
UnitTestAssertLib
PrintLib
+ CmockaLib
[Guids]
diff --git a/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestBuildOption.dsc b/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestBuildOption.dsc
index 74450f03a935..2835741e2ef7 100644
--- a/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestBuildOption.dsc
+++ b/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestBuildOption.dsc
@@ -25,10 +25,6 @@
GCC:*_*_*_CC_FLAGS = -I"$(CUNIT_INC_PATH)"
!endif
-!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- GCC:*_*_*_CC_FLAGS = -I"$(CMOCKA_INC_PATH)"
-!endif
-
MSFT:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE /DHOST_DEBUG_MESSAGE=1
MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE /DHOST_DEBUG_MESSAGE=1
MSFT:DEBUG_*_*_CC_FLAGS = /Od /GL-
@@ -37,10 +33,6 @@
MSFT:*_*_*_CC_FLAGS = /I"%CUNIT_INC_PATH%"
!endif
-!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- MSFT:*_*_*_CC_FLAGS = /I"%CMOCKA_INC_PATH%"
-!endif
-
[BuildOptions.common.EDKII.USER_DEFINED]
MSFT:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
MSFT:*_VS2015_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /NODEFAULTLIB /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
@@ -55,10 +47,10 @@
!endif
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- MSFT:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /LIBPATH:"%CMOCKA_LIB_PATH%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME%
- MSFT:*_VS2015_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /LIBPATH:"%CMOCKA_LIB_PATH%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME%
- MSFT:*_VS2015x86_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /LIBPATH:"%CMOCKA_LIB_PATH%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME%
- MSFT:*_VS2017_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /LIBPATH:"%CMOCKA_LIB_PATH%" /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME%
+ MSFT:*_*_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2015_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2015x86_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib" /LIBPATH:"$(VCINSTALLDIR)\PlatformSdk\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2017_IA32_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:I386 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
!endif
MSFT:*_*_IA32_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
@@ -79,10 +71,10 @@
!endif
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%CMOCKA_LIB_PATH_64%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME_64%
- MSFT:*_VS2015_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%CMOCKA_LIB_PATH_64%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME_64%
- MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%CMOCKA_LIB_PATH_64%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME_64%
- MSFT:*_VS2017_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /LIBPATH:"%CMOCKA_LIB_PATH_64%" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib %CMOCKA_LIB_NAME_64%
+ MSFT:*_*_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2015_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2015x86_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"$(VCINSTALLDIR)\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
+ MSFT:*_VS2017_X64_DLINK_FLAGS == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /base:0x10000000 /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" /NOLOGO /SUBSYSTEM:CONSOLE /IGNORE:4086 /MAP /OPT:REF /DEBUG /MACHINE:AMD64 /LTCG Kernel32.lib MSVCRTD.lib vcruntimed.lib ucrtd.lib Gdi32.lib User32.lib Winmm.lib Advapi32.lib
!endif
MSFT:*_*_X64_CC_FLAGS == /nologo /W4 /WX /Gy /c /D UNICODE /Od /FIAutoGen.h /EHs-c- /GF /Gs8192 /Zi /Gm /D _CRT_SECURE_NO_WARNINGS /D _CRT_SECURE_NO_DEPRECATE
@@ -95,10 +87,6 @@
MSFT:*_*_*_CC_FLAGS = /I"%CUNIT_INC_PATH%"
!endif
-!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- MSFT:*_*_*_CC_FLAGS = /I"%CMOCKA_INC_PATH%"
-!endif
-
GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m32 -L/usr/X11R6/lib
GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h
GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
@@ -111,8 +99,8 @@
!endif
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m32 -L/usr/X11R6/lib -L$(CMOCKA_LIB_PATH)
- GCC:*_*_IA32_DLINK2_FLAGS == -Wno-error -no-pie -l$(CMOCKA_LIB_NAME)
+ GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m32 -L/usr/X11R6/lib
+ GCC:*_*_IA32_DLINK2_FLAGS == -Wno-error -no-pie
!endif
GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m64 -L/usr/X11R6/lib
@@ -129,8 +117,8 @@
!endif
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m64 -L/usr/X11R6/lib -L$(CMOCKA_LIB_PATH_64)
- GCC:*_*_X64_DLINK2_FLAGS == -Wno-error -no-pie -l$(CMOCKA_LIB_NAME_64)
+ GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m64 -L/usr/X11R6/lib
+ GCC:*_*_X64_DLINK2_FLAGS == -Wno-error -no-pie
!endif
GCC:*_GCC5_*_CC_FLAGS = -fstack-protector -fstack-protector-strong -fstack-protector-all
@@ -143,7 +131,3 @@
!if $(UNIT_TEST_FRAMEWORK_MODE) == CUNIT
GCC:*_*_*_CC_FLAGS = -I"$(CUNIT_INC_PATH)"
!endif
-
-!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
- GCC:*_*_*_CC_FLAGS = -I"$(CMOCKA_INC_PATH)"
-!endif
diff --git a/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestPkg.dsc b/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestPkg.dsc
index 59ab6700d2c6..0f56d1ebfb22 100644
--- a/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestPkg.dsc
+++ b/HBFA/UefiHostUnitTestPkg/UefiHostUnitTestPkg.dsc
@@ -84,6 +84,7 @@
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
UnitTestLib|UefiHostUnitTestPkg/Library/UnitTestLibcmocka/UnitTestLibcmocka.inf
UnitTestAssertLib|UefiHostUnitTestPkg/Library/UnitTestAssertLibcmocka/UnitTestAssertLibcmocka.inf
+ CmockaLib|CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf
!endif
[LibraryClasses.common.USER_DEFINED]
@@ -96,6 +97,13 @@
!endif
!if $(UNIT_TEST_FRAMEWORK_MODE) == CMOCKA
+ CmockaHostUnitTestPkg/Library/CmockaLib/CmockaLib.inf {
+ <BuildOptions>
+ MSFT:*_*_*_CC_FLAGS == /c /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 /D _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT=1 /D _CRT_NONSTDC_NO_WARNINGS=1 /D _CRT_SECURE_NO_WARNINGS=1 -DHAVE_VSNPRINTF -DHAVE_SNPRINTF
+
+ GCC:*_*_IA32_CC_FLAGS == -m32 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
+ GCC:*_*_X64_CC_FLAGS == -m64 -O0 -g -fprofile-arcs -ftest-coverage -std=gnu99 -Wpedantic -Wall -Wshadow -Wmissing-prototypes -Wcast-align -Werror=address -Wstrict-prototypes -Werror=strict-prototypes -Wwrite-strings -Werror=write-strings -Werror-implicit-function-declaration -Wpointer-arith -Werror=pointer-arith -Wdeclaration-after-statement -Werror=declaration-after-statement -Wreturn-type -Werror=return-type -Wuninitialized -Werror=uninitialized -Werror=strict-overflow -Wstrict-overflow=2 -Wno-format-zero-length -Wmissing-field-initializers -Wformat-security -Werror=format-security -fno-common -Wformat -fno-common -fstack-protector-strong -DHAVE_SIGNAL_H
+ }
UefiHostUnitTestPkg/Sample/SampleUnitTestcmocka/SampleUnitTestcmocka.inf
!endif
--
2.21.0.windows.1
^ permalink raw reply related [flat|nested] 5+ messages in thread