From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=fail (domain: intel.com, ip: , mailfrom: tengfen.sun@intel.com) Received: from mga12.intel.com (mga12.intel.com []) by groups.io with SMTP; Wed, 22 May 2019 00:21:27 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2019 00:21:26 -0700 X-ExtLoop1: 1 Received: from tiano-tengfens.ccr.corp.intel.com ([10.239.9.110]) by orsmga002.jf.intel.com with ESMTP; 22 May 2019 00:21:25 -0700 From: "Sun, Tengfen" To: devel@edk2.groups.io Cc: jiewen.yao@intel.com, liming.gao@intel.com, tengfen.sun@intel.com, chris.wu@intel.com Subject: [PATCH 4/4] [staging/HBFA PATCH]: UefiHostUnitTestPkg: Enable cmocka unit test build with CmockaHostUnitTestPkg Date: Wed, 22 May 2019 15:20:44 +0800 Message-Id: <20190522072044.12472-5-tengfen.sun@intel.com> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20190522072044.12472-1-tengfen.sun@intel.com> References: <20190522072044.12472-1-tengfen.sun@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- .../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 +or + Manually initialize and update the submodules after the clone operation on main project: + $ git clone + $ 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= 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 { + + 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