]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UnitTestFrameworkPkg: Add DSC, DSC INC, and YAML files
authorMichael D Kinney <michael.d.kinney@intel.com>
Wed, 22 Jan 2020 18:12:56 +0000 (10:12 -0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Fri, 7 Feb 2020 19:18:53 +0000 (19:18 +0000)
https://bugzilla.tianocore.org/show_bug.cgi?id=2505

* 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 <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bret Barkelew <Bret.Barkelew@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc [new file with mode: 0644]
UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml [new file with mode: 0644]
UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc [new file with mode: 0644]
UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc [new file with mode: 0644]
UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc [new file with mode: 0644]

diff --git a/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc b/UnitTestFrameworkPkg/Test/UnitTestFrameworkPkgHostTest.dsc
new file mode 100644 (file)
index 0000000..701e729
--- /dev/null
@@ -0,0 +1,33 @@
+## @file\r
+# UnitTestFrameworkPkg DSC file used to build host-based unit tests.\r
+#\r
+# Copyright (c) Microsoft Corporation.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  PLATFORM_NAME           = UnitTestFrameworkPkgHostTest\r
+  PLATFORM_GUID           = C7F97D6D-54AC-45A9-8197-CC99B20CC7EC\r
+  PLATFORM_VERSION        = 0.1\r
+  DSC_SPECIFICATION       = 0x00010005\r
+  OUTPUT_DIRECTORY        = Build/UnitTestFrameworkPkg/HostTest\r
+  SUPPORTED_ARCHITECTURES = IA32|X64\r
+  BUILD_TARGETS           = NOOPT\r
+  SKUID_IDENTIFIER        = DEFAULT\r
+\r
+!include UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc\r
+\r
+[Components]\r
+  #\r
+  # Build HOST_APPLICATION that tests the SampleUnitTest\r
+  #\r
+  UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestHost.inf\r
+\r
+  #\r
+  # Build Libraries\r
+  #\r
+  UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf\r
+  UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf\r
+  UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.inf\r
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.ci.yaml
new file mode 100644 (file)
index 0000000..0164859
--- /dev/null
@@ -0,0 +1,76 @@
+## @file\r
+# CI configuration for UnitTestFrameworkPkg\r
+#\r
+# Copyright (c) Microsoft Corporation\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+    ## options defined .pytool/Plugin/CompilerPlugin\r
+    "CompilerPlugin": {\r
+        "DscPath": "UnitTestFrameworkPkg.dsc"\r
+    },\r
+    ## options defined .pytool/Plugin/HostUnitTestCompilerPlugin\r
+    "HostUnitTestCompilerPlugin": {\r
+        "DscPath": "Test/UnitTestFrameworkPkgHostTest.dsc"\r
+    },\r
+    ## options defined .pytool/Plugin/CharEncodingCheck\r
+    "CharEncodingCheck": {\r
+        "IgnoreFiles": []\r
+    },\r
+\r
+    ## options defined .pytool/Plugin/DependencyCheck\r
+    "DependencyCheck": {\r
+        "AcceptableDependencies": [\r
+            "MdePkg/MdePkg.dec",\r
+            "UnitTestFrameworkPkg/UnitTestFrameworkPkg.dec"\r
+        ],\r
+        # For host based unit tests\r
+        "AcceptableDependencies-HOST_APPLICATION":[],\r
+        # For UEFI shell based apps\r
+        "AcceptableDependencies-UEFI_APPLICATION":[\r
+            "MdeModulePkg/MdeModulePkg.dec",\r
+            "ShellPkg/ShellPkg.dec"\r
+        ],\r
+        "IgnoreInf": []\r
+    },\r
+    ## options defined .pytool/Plugin/DscCompleteCheck\r
+    "DscCompleteCheck": {\r
+        "DscPath": "UnitTestFrameworkPkg.dsc",\r
+        "IgnoreInf": []\r
+    },\r
+    ## options defined .pytool/Plugin/HostUnitTestDscCompleteCheck\r
+    "HostUnitTestDscCompleteCheck": {\r
+        "IgnoreInf": [],\r
+        "DscPath": "Test/UnitTestFrameworkPkgHostTest.dsc"\r
+    },\r
+    ## options defined .pytool/Plugin/GuidCheck\r
+    "GuidCheck": {\r
+        "IgnoreGuidName": [],\r
+        "IgnoreGuidValue": [],\r
+        "IgnoreFoldersAndFiles": [],\r
+        "IgnoreDuplicates": []\r
+    },\r
+    ## options defined .pytool/Plugin/LibraryClassCheck\r
+    "LibraryClassCheck": {\r
+        "IgnoreHeaderFile": []\r
+    },\r
+\r
+    ## options defined .pytool/Plugin/SpellCheck\r
+    "SpellCheck": {\r
+        "AuditOnly": False,           # Fails test but run in AuditOnly mode to collect log\r
+        "IgnoreFiles": [             # use gitignore syntax to ignore errors in matching files\r
+            "/Library/CmockaLib/cmocka/**/*.*"  # not going to spell check a submodule\r
+        ],\r
+        "ExtendWords": [             # words to extend to the dictionary for this package\r
+            "cmocka",\r
+            "buildmodule",\r
+            "criterium",\r
+            "pytool",\r
+            "pytools",\r
+            "NOFAILURE",\r
+            "DHAVE" # build flag for cmocka in the INF\r
+        ],\r
+        "IgnoreStandardPaths": [],   # Standard Plugin defined paths that should be ignore\r
+        "AdditionalIncludePaths": [] # Additional paths to spell check (wildcards supported)\r
+    }\r
+}\r
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc b/UnitTestFrameworkPkg/UnitTestFrameworkPkg.dsc
new file mode 100644 (file)
index 0000000..0ad4482
--- /dev/null
@@ -0,0 +1,34 @@
+## @file\r
+# UnitTestFrameworkPkg\r
+#\r
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r
+#\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  PLATFORM_NAME           = UnitTestFrameworkPkg\r
+  PLATFORM_GUID           = 7420CC7E-334E-4EFF-B974-A39613455168\r
+  PLATFORM_VERSION        = 1.00\r
+  DSC_SPECIFICATION       = 0x00010005\r
+  OUTPUT_DIRECTORY        = Build/UnitTestFrameworkPkg\r
+  SUPPORTED_ARCHITECTURES = IA32|X64|EBC|ARM|AARCH64\r
+  BUILD_TARGETS           = DEBUG|RELEASE|NOOPT\r
+  SKUID_IDENTIFIER        = DEFAULT\r
+\r
+!include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc\r
+\r
+[Components]\r
+  UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersistenceLibNull.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestBootLibNull/UnitTestBootLibNull.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestBootLibUsbClass/UnitTestBootLibUsbClass.inf\r
+  UnitTestFrameworkPkg/Library/UnitTestPersistenceLibSimpleFileSystem/UnitTestPersistenceLibSimpleFileSystem.inf\r
+\r
+  UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestDxe.inf\r
+  UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestPei.inf\r
+  UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestSmm.inf\r
+  UnitTestFrameworkPkg/Test/UnitTest/Sample/SampleUnitTest/SampleUnitTestUefiShell.inf\r
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgHost.dsc.inc
new file mode 100644 (file)
index 0000000..e954968
--- /dev/null
@@ -0,0 +1,56 @@
+## @file\r
+# UnitTestFrameworkPkg DSC include file for host based test DSC\r
+#\r
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+!include UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc\r
+\r
+[LibraryClasses.common.HOST_APPLICATION]\r
+  CmockaLib|UnitTestFrameworkPkg/Library/CmockaLib/CmockaLib.inf\r
+  UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLibCmocka.inf\r
+  DebugLib|UnitTestFrameworkPkg/Library/Posix/DebugLibPosix/DebugLibPosix.inf\r
+  MemoryAllocationLib|UnitTestFrameworkPkg/Library/Posix/MemoryAllocationLibPosix/MemoryAllocationLibPosix.inf\r
+\r
+[BuildOptions]\r
+  GCC:*_*_*_CC_FLAGS = -fno-pie\r
+\r
+[BuildOptions.common.EDKII.HOST_APPLICATION]\r
+  #\r
+  # MSFT\r
+  #\r
+  MSFT:*_*_*_DLINK_FLAGS            == /out:"$(BIN_DIR)\$(BASE_NAME).exe" /pdb:"$(BIN_DIR)\$(BASE_NAME).pdb" /IGNORE:4001 /NOLOGO /SUBSYSTEM:CONSOLE /DEBUG /NODEFAULTLIB:libcmt.lib libcmtd.lib\r
+  MSFT:*_*_IA32_DLINK_FLAGS         = /MACHINE:I386\r
+  MSFT:*_*_X64_DLINK_FLAGS          = /MACHINE:AMD64\r
+\r
+  MSFT:*_VS2015_IA32_DLINK_FLAGS    = /LIBPATH:"%VS2015_PREFIX%Lib" /LIBPATH:"%VS2015_PREFIX%VC\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"\r
+  MSFT:*_VS2015x86_IA32_DLINK_FLAGS = /LIBPATH:"%VS2015_PREFIX%Lib" /LIBPATH:"%VS2015_PREFIX%VC\Lib" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"\r
+  MSFT:*_VS2017_IA32_DLINK_FLAGS    = /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"\r
+  MSFT:*_VS2019_IA32_DLINK_FLAGS    = /LIBPATH:"%VCToolsInstallDir%lib\x86" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x86" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x86"\r
+\r
+  MSFT:*_VS2015_X64_DLINK_FLAGS     = /LIBPATH:"%VS2015_PREFIX%VC\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"\r
+  MSFT:*_VS2015x86_X64_DLINK_FLAGS  = /LIBPATH:"%VS2015_PREFIX%VC\Lib\AMD64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"\r
+  MSFT:*_VS2017_X64_DLINK_FLAGS     = /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"\r
+  MSFT:*_VS2019_X64_DLINK_FLAGS     = /LIBPATH:"%VCToolsInstallDir%lib\x64" /LIBPATH:"%UniversalCRTSdkDir%lib\%UCRTVersion%\ucrt\x64" /LIBPATH:"%WindowsSdkDir%lib\%WindowsSDKLibVersion%\um\x64"\r
+\r
+  #\r
+  # GCC\r
+  #\r
+  GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/$(BASE_NAME) -m32 -no-pie\r
+  GCC:*_*_X64_DLINK_FLAGS  == -o $(BIN_DIR)/$(BASE_NAME) -m64 -no-pie\r
+  GCC:*_*_*_DLINK2_FLAGS   == -lgcov\r
+\r
+  #\r
+  # Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version\r
+  #\r
+  XCODE:*_*_IA32_DLINK_PATH == gcc\r
+  XCODE:*_*_IA32_CC_FLAGS = -I$(WORKSPACE)/EmulatorPkg/Unix/Host/X11IncludeHack\r
+  XCODE:*_*_IA32_DLINK_FLAGS == -arch i386 -o $(BIN_DIR)/Host -L/usr/X11R6/lib -lXext -lX11 -framework Carbon\r
+  XCODE:*_*_IA32_ASM_FLAGS == -arch i386 -g\r
+\r
+  XCODE:*_*_X64_DLINK_PATH == gcc\r
+  XCODE:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -L/usr/X11R6/lib -lXext -lX11 -framework Carbon -Wl,-no_pie\r
+  XCODE:*_*_X64_ASM_FLAGS == -g\r
+  XCODE:*_*_X64_CC_FLAGS = -O0 -target x86_64-apple-darwin -I$(WORKSPACE)/EmulatorPkg/Unix/Host/X11IncludeHack "-DEFIAPI=__attribute__((ms_abi))"\r
diff --git a/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc b/UnitTestFrameworkPkg/UnitTestFrameworkPkgTarget.dsc.inc
new file mode 100644 (file)
index 0000000..c29b056
--- /dev/null
@@ -0,0 +1,58 @@
+## @file\r
+# UnitTestFrameworkPkg DSC include file for target based test DSC\r
+#\r
+# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[LibraryClasses]\r
+  #\r
+  # Entry point\r
+  #\r
+  PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf\r
+  UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf\r
+  UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf\r
+\r
+  BaseLib|MdePkg/Library/BaseLib/BaseLib.inf\r
+  BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf\r
+  DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf\r
+  MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf\r
+  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf\r
+  PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf\r
+  PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf\r
+  PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf\r
+  UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
+\r
+  UnitTestLib|UnitTestFrameworkPkg/Library/UnitTestLib/UnitTestLib.inf\r
+  UnitTestPersistenceLib|UnitTestFrameworkPkg/Library/UnitTestPersistenceLibNull/UnitTestPersistenceLibNull.inf\r
+  UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibDebugLib.inf\r
+\r
+[LibraryClasses.ARM, LibraryClasses.AARCH64]\r
+  #\r
+  # It is not possible to prevent ARM compiler calls to generic intrinsic functions.\r
+  # This library provides the instrinsic functions generated by a given compiler.\r
+  # [LibraryClasses.ARM] and NULL mean link this library into all ARM images.\r
+  #\r
+  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf\r
+\r
+  #\r
+  # Since software stack checking may be heuristically enabled by the compiler\r
+  # include BaseStackCheckLib unconditionally.\r
+  #\r
+  NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf\r
+\r
+[LibraryClasses.common.PEIM]\r
+  HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf\r
+  MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf\r
+  PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/PeiServicesTablePointerLib.inf\r
+\r
+[LibraryClasses.common.UEFI_APPLICATION]\r
+  UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf\r
+\r
+[PcdsFixedAtBuild]\r
+  gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x17\r
+\r
+[BuildOptions]\r
+  MSFT:*_*_*_CC_FLAGS = -D DISABLE_NEW_DEPRECATED_INTERFACES\r
+  GCC:*_*_*_CC_FLAGS  = -D DISABLE_NEW_DEPRECATED_INTERFACES\r