From nobody Mon Feb 9 10:48:40 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+54057+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+54057+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 158109924305083.05533751054793; Fri, 7 Feb 2020 10:14:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UVclYY1788612xjO6GXMlF3Y; Fri, 07 Feb 2020 10:14:02 -0800 X-Received: from mga06.intel.com (mga06.intel.com []) by mx.groups.io with SMTP id smtpd.web12.9025.1581099240821545376 for ; Fri, 07 Feb 2020 10:14:01 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 07 Feb 2020 10:14:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,414,1574150400"; d="scan'208";a="250500546" X-Received: from unknown (HELO mdkinney-MOBL2.amr.corp.intel.com) ([10.241.98.74]) by orsmga002.jf.intel.com with ESMTP; 07 Feb 2020 10:14:00 -0800 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Sean Brogan , Bret Barkelew Subject: [edk2-devel] [Patch v2 07/11] UnitTestFrameworkPkg: Add DSC, DSC INC, and YAML files Date: Fri, 7 Feb 2020 10:13:50 -0800 Message-Id: <20200207181354.31632-8-michael.d.kinney@intel.com> In-Reply-To: <20200207181354.31632-1-michael.d.kinney@intel.com> References: <20200207181354.31632-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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: 7BHARGcMYZBpFHOZKS1l5fazx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1581099242; bh=2KHDbnhJxEgclDBvVckRbBM9OR/ziCHKxsCSYvzZZr0=; h=Cc:Date:From:Reply-To:Subject:To; b=Xnkrw48swcygBO7CY9yIco2KBWpdV0N76OEMBzWxZq8cTcLVD//jpnOPyKcBeofCj8O a4Cfok8g5exhPQqT7oqkSMY3pcQ17itsRvD4APf073KbczaG+1Vnq4Gx7jYlQkntgPI+U R/ux25Q2dYafkaua22TyIva7x5+odfk+92Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" https://bugzilla.tianocore.org/show_bug.cgi?id=3D2505 * DSC in root of package file to perform a package build of the UnitTestFrameworkPkg and build sample unit test for all supported target environments. * DSC file in Test directory to build the sample unit test for the host environment. * UnitTestFrameworkPkgTarget.dsc.inc - DSC include file to !include when building unit tests for target environments. * UnitTestFrameworkPkgHost.dsc.inc - DSC include file to !include when building unit tests for target environments. * YAML file with set of CI checks to perform on UnitTestFrameworkPkg. Cc: Sean Brogan Cc: Bret Barkelew Signed-off-by: Michael D Kinney Reviewed-by: Bret Barkelew Reviewed-by: Sean Brogan --- .../Test/UnitTestFrameworkPkgHostTest.dsc | 33 ++++++++ .../UnitTestFrameworkPkg.ci.yaml | 76 +++++++++++++++++++ UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc | 34 +++++++++ .../UnitTestFrameworkPkgHost.dsc.inc | 56 ++++++++++++++ .../UnitTestFrameworkPkgTarget.dsc.inc | 58 ++++++++++++++ 5 files changed, 257 insertions(+) create mode 100644 UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.= dsc create mode 100644 UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml create mode 100644 UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc create mode 100644 UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc create mode 100644 UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc diff --git a/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc b/U= nitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc new file mode 100644 index 0000000000..701e7299d7 --- /dev/null +++ b/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc @@ -0,0 +1,33 @@ +## @file +# UnitTestFrameworkPkg DSC file used to build host-based unit tests. +# +# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME =3D UnitTestFrameworkPkgHostTest + PLATFORM_GUID =3D C7F97D6D-54AC-45A9-8197-CC99B20CC7EC + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/UnitTestFrameworkPkg/HostTest + SUPPORTED_ARCHITECTURES =3D IA32|X64 + BUILD_TARGETS =3D NOOPT + SKUID_IDENTIFIER =3D DEFAULT + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc + +[Components] + # + # Build HOST_APPLICATION that tests the SampleUnitTest + # + UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestH= ost.inf + + # + # Build Libraries + # + UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.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 new file mode 100644 index 0000000000..0164859505 --- /dev/null +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml @@ -0,0 +1,76 @@ +## @file +# CI configuration for UnitTestFrameworkPkg +# +# Copyright (c) Microsoft Corporation +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + ## options defined .pytool/Plugin/CompilerPlugin + "CompilerPlugin": { + "DscPath": "UnitTestFrameworkPkg.dsc" + }, + ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin + "HostUnitTestCompilerPlugin": { + "DscPath": "Test/UnitTestFrameworkPkgHostTest.dsc" + }, + ## options defined .pytool/Plugin/CharEncodingCheck + "CharEncodingCheck": { + "IgnoreFiles": [] + }, + + ## options defined .pytool/Plugin/DependencyCheck + "DependencyCheck": { + "AcceptableDependencies": [ + "MdePkg/MdePkg.dec", + "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec" + ], + # For host based unit tests + "AcceptableDependencies-HOST_APPLICATION":[], + # For UEFI shell based apps + "AcceptableDependencies-UEFI_APPLICATION":[ + "MdeModulePkg/MdeModulePkg.dec", + "ShellPkg/ShellPkg.dec" + ], + "IgnoreInf": [] + }, + ## options defined .pytool/Plugin/DscCompleteCheck + "DscCompleteCheck": { + "DscPath": "UnitTestFrameworkPkg.dsc", + "IgnoreInf": [] + }, + ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck + "HostUnitTestDscCompleteCheck": { + "IgnoreInf": [], + "DscPath": "Test/UnitTestFrameworkPkgHostTest.dsc" + }, + ## options defined .pytool/Plugin/GuidCheck + "GuidCheck": { + "IgnoreGuidName": [], + "IgnoreGuidValue": [], + "IgnoreFoldersAndFiles": [], + "IgnoreDuplicates": [] + }, + ## options defined .pytool/Plugin/LibraryClassCheck + "LibraryClassCheck": { + "IgnoreHeaderFile": [] + }, + + ## options defined .pytool/Plugin/SpellCheck + "SpellCheck": { + "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 + ], + "ExtendWords": [ # words to extend to the dictionary f= or this package + "cmocka", + "buildmodule", + "criterium", + "pytool", + "pytools", + "NOFAILURE", + "DHAVE" # build flag for cmocka in the INF + ], + "IgnoreStandardPaths": [], # Standard Plugin defined paths that = should be ignore + "AdditionalIncludePaths": [] # Additional paths to spell check (wi= ldcards supported) + } +} diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc b/UnitTestFramew= orkPkg/UnitTestFrameworkPkg.dsc new file mode 100644 index 0000000000..0ad4482273 --- /dev/null +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc @@ -0,0 +1,34 @@ +## @file +# UnitTestFrameworkPkg +# +# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + PLATFORM_NAME =3D UnitTestFrameworkPkg + PLATFORM_GUID =3D 7420CC7E-334E-4EFF-B974-A39613455168 + PLATFORM_VERSION =3D 1.00 + DSC_SPECIFICATION =3D 0x00010005 + OUTPUT_DIRECTORY =3D Build/UnitTestFrameworkPkg + SUPPORTED_ARCHITECTURES =3D IA32|X64|EBC|ARM|AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE|NOOPT + SKUID_IDENTIFIER =3D DEFAULT + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc + +[Components] + UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.inf + UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersiste= nceLibNull.inf + UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRepor= tLibDebugLib.inf + UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.inf + UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultRepor= tLibConOut.inf + UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbC= lass.inf + UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/Unit= TestPersistenceLibSimpleFileSystem.inf + + UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestD= xe.inf + UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestP= ei.inf + UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestS= mm.inf + UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestU= efiShell.inf diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTe= stFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc new file mode 100644 index 0000000000..e954968efc --- /dev/null +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc @@ -0,0 +1,56 @@ +## @file +# UnitTestFrameworkPkg DSC include file for host based test DSC +# +# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +!include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc + +[LibraryClasses.common.HOST_APPLICATION] + CmockaLib|UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf + UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.i= nf + DebugLib|UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.= inf + MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationL= ibPosix/MemoryAllocationLibPosix.inf + +[BuildOptions] + GCC:*_*_*_CC_FLAGS =3D -fno-pie + +[BuildOptions.common.EDKII.HOST_APPLICATION] + # + # MSFT + # + MSFT:*_*_*_DLINK_FLAGS =3D=3D /out:"$(BIN_DIR)\$(BASE_NAME).e= xe" /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /IGNORE:4001 /NOLOGO /SUBSYSTEM:CONS= OLE /DEBUG /NODEFAULTLIB:libcmt.lib libcmtd.lib + MSFT:*_*_IA32_DLINK_FLAGS =3D /MACHINE:I386 + MSFT:*_*_X64_DLINK_FLAGS =3D /MACHINE:AMD64 + + MSFT:*_VS2015_IA32_DLINK_FLAGS =3D /LIBPATH:"%VS2015_PREFIX%Lib" /LIB= PATH:"%VS2015_PREFIX%VC\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion= %\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" + MSFT:*_VS2015x86_IA32_DLINK_FLAGS =3D /LIBPATH:"%VS2015_PREFIX%Lib" /LIB= PATH:"%VS2015_PREFIX%VC\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion= %\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" + MSFT:*_VS2017_IA32_DLINK_FLAGS =3D /LIBPATH:"%VCToolsInstallDir%lib\x= 86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" + MSFT:*_VS2019_IA32_DLINK_FLAGS =3D /LIBPATH:"%VCToolsInstallDir%lib\x= 86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86" + + MSFT:*_VS2015_X64_DLINK_FLAGS =3D /LIBPATH:"%VS2015_PREFIX%VC\Lib\AM= D64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%W= indowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" + MSFT:*_VS2015x86_X64_DLINK_FLAGS =3D /LIBPATH:"%VS2015_PREFIX%VC\Lib\AM= D64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%W= indowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" + MSFT:*_VS2017_X64_DLINK_FLAGS =3D /LIBPATH:"%VCToolsInstallDir%lib\x= 64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" + MSFT:*_VS2019_X64_DLINK_FLAGS =3D /LIBPATH:"%VCToolsInstallDir%lib\x= 64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%Wi= ndowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64" + + # + # GCC + # + GCC:*_*_IA32_DLINK_FLAGS =3D=3D -o $(BIN_DIR)/$(BASE_NAME) -m32 -no-pie + GCC:*_*_X64_DLINK_FLAGS =3D=3D -o $(BIN_DIR)/$(BASE_NAME) -m64 -no-pie + GCC:*_*_*_DLINK2_FLAGS =3D=3D -lgcov + + # + # Need to do this link via gcc and not ld as the pathing to libraries ch= anges from OS version to OS version + # + XCODE:*_*_IA32_DLINK_PATH =3D=3D gcc + XCODE:*_*_IA32_CC_FLAGS =3D -I$(WORKSPACE)/EmulatorPkg/Unix/Host/X11Incl= udeHack + XCODE:*_*_IA32_DLINK_FLAGS =3D=3D -arch i386 -o $(BIN_DIR)/Host -L/usr/X= 11R6/lib -lXext -lX11 -framework Carbon + XCODE:*_*_IA32_ASM_FLAGS =3D=3D -arch i386 -g + + XCODE:*_*_X64_DLINK_PATH =3D=3D gcc + XCODE:*_*_X64_DLINK_FLAGS =3D=3D -o $(BIN_DIR)/Host -L/usr/X11R6/lib -lX= ext -lX11 -framework Carbon -Wl,-no_pie + XCODE:*_*_X64_ASM_FLAGS =3D=3D -g + XCODE:*_*_X64_CC_FLAGS =3D -O0 -target x86_64-apple-darwin -I$(WORKSPACE= )/EmulatorPkg/Unix/Host/X11IncludeHack "-DEFIAPI=3D__attribute__((ms_abi))" diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/Unit= TestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc new file mode 100644 index 0000000000..c29b056fca --- /dev/null +++ b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc @@ -0,0 +1,58 @@ +## @file +# UnitTestFrameworkPkg DSC include file for target based test DSC +# +# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[LibraryClasses] + # + # Entry point + # + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + + UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.inf + UnitTestPersistenceLib|UnitTestFrameworkPkg/Library/UnitTestPersistenceL= ibNull/UnitTestPersistenceLibNull.inf + UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultRepor= tLib/UnitTestResultReportLibDebugLib.inf + +[LibraryClasses.ARM, LibraryClasses.AARCH64] + # + # It is not possible to prevent ARM compiler calls to generic intrinsic = functions. + # This library provides the instrinsic functions generated by a given co= mpiler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM imag= es. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + + # + # Since software stack checking may be heuristically enabled by the comp= iler + # include BaseStackCheckLib unconditionally. + # + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + +[LibraryClasses.common.PEIM] + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultRepor= tLib/UnitTestResultReportLibConOut.inf + +[PcdsFixedAtBuild] + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17 + +[BuildOptions] + MSFT:*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES + GCC:*_*_*_CC_FLAGS =3D -D DISABLE_NEW_DEPRECATED_INTERFACES --=20 2.21.0.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 (#54057): https://edk2.groups.io/g/devel/message/54057 Mute This Topic: https://groups.io/mt/71060085/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-