* [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function
@ 2022-11-24 12:11 Jason Lou
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Jason Lou @ 2022-11-24 12:11 UTC (permalink / raw)
To: devel; +Cc: Jason Lou, Ray Ni, Eric Dong, Laszlo Ersek, Rahul Kumar
From: Jason Lou <yun.lou@intel.com>
Move the implementation of EfiMpServiceProtocol unit tests in a separate
function in preparation for developing the UEFI application and dynamic
command for the same unit tests.
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c | 30 +++++++++++++++-----
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h | 2 +-
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c
index 57f8ba3c06..5fe6369960 100644
--- a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c
@@ -187,18 +187,16 @@ MpServicesUnitTestWhoAmI (
}
/**
- Standard DXE driver or UEFI application entry point for unit test execution from DXE or UEFI Shell.
- Initialize the unit test framework, suite, and unit tests for the EfiMpServiceProtocol and run the unit test.
+ Initialize the unit test framework, suite and unit tests for the EfiMpServiceProtocol and run the unit tests.
- @param[in] ImageHandle The firmware allocated handle for the EFI image.
- @param[in] SystemTable A pointer to the EFI System Table.
+ @retval EFI_SUCCESS Initialize the unit test framework, suite, unit tests and run the unit tests successfully.
+ @retval Others Initialize the unit test framework, suite, unit tests or run the unit tests unsuccessfully.
**/
EFI_STATUS
EFIAPI
-DxeEntryPoint (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+EfiMpServiceProtocolUnitTest (
+ VOID
)
{
EFI_STATUS Status;
@@ -242,3 +240,21 @@ EXIT:
return Status;
}
+
+/**
+ Standard DXE driver or UEFI application entry point for unit test execution from DXE or UEFI Shell.
+ Initialize the unit test framework, suite, and unit tests for the EfiMpServiceProtocol and run the unit test.
+
+ @param[in] ImageHandle The firmware allocated handle for the EFI image.
+ @param[in] SystemTable A pointer to the EFI System Table.
+
+**/
+EFI_STATUS
+EFIAPI
+DxeEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return EfiMpServiceProtocolUnitTest ();
+}
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h
index abbbd2faba..d2b1633b4d 100644
--- a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h
@@ -1,5 +1,5 @@
/** @file
- Common header file for EfiMpServiceProtocolUnitTest DXE driver.
+ Common header file for EdkiiPeiMpServices2Ppi and EfiMpServiceProtocol unit test.
Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT
2022-11-24 12:11 [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Jason Lou
@ 2022-11-24 12:11 ` Jason Lou
2022-12-05 3:05 ` [edk2-devel] " Zhiguang Liu
2022-12-05 3:47 ` duntan
2022-12-05 3:04 ` [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Zhiguang Liu
2022-12-05 3:47 ` duntan
2 siblings, 2 replies; 6+ messages in thread
From: Jason Lou @ 2022-11-24 12:11 UTC (permalink / raw)
To: devel
Cc: Jason Lou, Ray Ni, Eric Dong, Laszlo Ersek, Rahul Kumar,
Zhiguang Liu, Dun Tan
From: Jason Lou <yun.lou@intel.com>
The code changes develop UEFI application and dynamic command for
EfiMpServiceProtocol unit tests based on current UnitTestFramework.
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
---
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c | 129 ++++++++++++++++++++
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf | 45 +++++++
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf | 43 +++++++
UefiCpuPkg/UefiCpuPkg.dsc | 8 ++
4 files changed, 225 insertions(+)
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c
new file mode 100644
index 0000000000..be65c3d678
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c
@@ -0,0 +1,129 @@
+/** @file
+ Produce "MpProtocolUnitTest" shell dynamic command.
+
+ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include <Library/UefiBootServicesTableLib.h>
+#include <Protocol/ShellDynamicCommand.h>
+#include "EfiMpServicesUnitTestCommom.h"
+
+CHAR16 *mMpProtocolUnitTestCommandHelp = L".TH MpProtocolUnitTest 0\r\n.SH NAME\r\nDisplay unit test results of EFI MP services protocol.\r\n";
+
+EFI_STATUS
+EFIAPI
+EfiMpServiceProtocolUnitTest (
+ VOID
+ );
+
+/**
+ This is the shell command handler function pointer callback type. This
+ function handles the command when it is invoked in the shell.
+
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
+ @param[in] SystemTable The pointer to the system table.
+ @param[in] ShellParameters The parameters associated with the command.
+ @param[in] Shell The instance of the shell protocol used in the context
+ of processing this command.
+
+ @return EFI_SUCCESS the operation was successful
+ @return other the operation failed.
+**/
+SHELL_STATUS
+EFIAPI
+MpProtocolUnitTestCommandHandler (
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN EFI_SYSTEM_TABLE *SystemTable,
+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,
+ IN EFI_SHELL_PROTOCOL *Shell
+ )
+{
+ return EfiMpServiceProtocolUnitTest ();
+}
+
+/**
+ This is the command help handler function pointer callback type. This
+ function is responsible for displaying help information for the associated
+ command.
+
+ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.
+ @param[in] Language The pointer to the language string to use.
+
+ @return string Pool allocated help string, must be freed by caller
+**/
+CHAR16 *
+EFIAPI
+MpProtocolUnitTestCommandGetHelp (
+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,
+ IN CONST CHAR8 *Language
+ )
+{
+ return AllocateCopyPool (StrSize (mMpProtocolUnitTestCommandHelp), mMpProtocolUnitTestCommandHelp);
+}
+
+EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mMpProtocolUnitTestDynamicCommand = {
+ L"MpProtocolUnitTest",
+ MpProtocolUnitTestCommandHandler,
+ MpProtocolUnitTestCommandGetHelp
+};
+
+/**
+ Entry point of MpProtocolUnitTest Dynamic Command.
+
+ Produce the DynamicCommand protocol to handle "MpProtocolUnitTest" command.
+
+ @param ImageHandle The image handle of the process.
+ @param SystemTable The EFI System Table pointer.
+
+ @retval EFI_SUCCESS Tftp command is executed successfully.
+ @retval EFI_ABORTED HII package was failed to initialize.
+ @retval others Other errors when executing MpProtocolUnitTest command.
+**/
+EFI_STATUS
+EFIAPI
+MpProtocolUnitTestCommandInitialize (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->InstallProtocolInterface (
+ &ImageHandle,
+ &gEfiShellDynamicCommandProtocolGuid,
+ EFI_NATIVE_INTERFACE,
+ &mMpProtocolUnitTestDynamicCommand
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
+
+/**
+ Driver unload handler.
+
+ @param ImageHandle The image handle of the process.
+
+ @retval EFI_SUCCESS The image is unloaded.
+ @retval Others Failed to unload the image.
+**/
+EFI_STATUS
+EFIAPI
+MpProtocolUnitTestUnload (
+ IN EFI_HANDLE ImageHandle
+ )
+{
+ EFI_STATUS Status;
+
+ Status = gBS->UninstallProtocolInterface (
+ ImageHandle,
+ &gEfiShellDynamicCommandProtocolGuid,
+ &mMpProtocolUnitTestDynamicCommand
+ );
+ ASSERT_EFI_ERROR (Status);
+
+ return Status;
+}
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf
new file mode 100644
index 0000000000..3fa287d1ae
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf
@@ -0,0 +1,45 @@
+## @file
+# DXE driver that provides Shell 'MpProtocolUnitTest' dynamic command to test EfiMpServiceProtocol.
+#
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = EfiMpServiceProtocolDynamicCmdUnitTest
+ FILE_GUID = 8C4624B1-58CC-4DF6-9E6D-09B38D67DFA6
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = MpProtocolUnitTestCommandInitialize
+ UNLOAD_IMAGE = MpProtocolUnitTestUnload
+
+[Sources]
+ EfiMpServicesUnitTestCommom.c
+ EfiMpServicesUnitTestCommom.h
+ EfiMpServiceProtocolUnitTest.c
+ EfiMpServiceProtocolDynamicCmdUnitTest.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ BaseMemoryLib
+ MemoryAllocationLib
+ UefiDriverEntryPoint
+ UefiBootServicesTableLib
+ UefiLib
+ UnitTestPersistenceLib
+ UnitTestLib
+
+[Protocols]
+ gEfiMpServiceProtocolGuid ## CONSUMES
+ gEfiShellDynamicCommandProtocolGuid ## PRODUCES
+
+[Depex]
+ TRUE
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf
new file mode 100644
index 0000000000..34c1ea96a6
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf
@@ -0,0 +1,43 @@
+## @file
+# UEFI application that tests EfiMpServiceProtocol in Shell.
+#
+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = MpProtocolUnitTest
+ FILE_GUID = 4CEE6399-A22C-4FFD-B148-3A56B1DD83F1
+ MODULE_TYPE = UEFI_APPLICATION
+ VERSION_STRING = 1.0
+ ENTRY_POINT = DxeEntryPoint
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64
+#
+
+[Sources]
+ EfiMpServicesUnitTestCommom.c
+ EfiMpServicesUnitTestCommom.h
+ EfiMpServiceProtocolUnitTest.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ UefiCpuPkg/UefiCpuPkg.dec
+
+[LibraryClasses]
+ BaseLib
+ DebugLib
+ BaseMemoryLib
+ MemoryAllocationLib
+ UefiApplicationEntryPoint
+ UefiBootServicesTableLib
+ UnitTestPersistenceLib
+ UnitTestLib
+
+[Protocols]
+ gEfiMpServiceProtocolGuid ## CONSUMES
diff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 67b0ce46e4..f9a46089d2 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -183,6 +183,14 @@
UefiCpuPkg/Library/CpuExceptionHandlerLib/UnitTest/PeiCpuExceptionHandlerLibUnitTest.inf
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EdkiiPeiMpServices2PpiPeiUnitTest.inf
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDxeUnitTest.inf
+ UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf {
+ <LibraryClasses>
+ UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf
+ }
+ UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf {
+ <LibraryClasses>
+ UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf
+ }
[Components.X64]
UefiCpuPkg/Library/CpuExceptionHandlerLib/UnitTest/DxeCpuExceptionHandlerLibUnitTest.inf
--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function
2022-11-24 12:11 [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Jason Lou
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
@ 2022-12-05 3:04 ` Zhiguang Liu
2022-12-05 3:47 ` duntan
2 siblings, 0 replies; 6+ messages in thread
From: Zhiguang Liu @ 2022-12-05 3:04 UTC (permalink / raw)
To: Jason Lou, devel
[-- Attachment #1: Type: text/plain, Size: 54 bytes --]
Reviewed-by: Zhiguang Liu < zhiguang.liu@intel.com >
[-- Attachment #2: Type: text/html, Size: 130 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
@ 2022-12-05 3:05 ` Zhiguang Liu
2022-12-05 3:47 ` duntan
1 sibling, 0 replies; 6+ messages in thread
From: Zhiguang Liu @ 2022-12-05 3:05 UTC (permalink / raw)
To: Jason Lou, devel
[-- Attachment #1: Type: text/plain, Size: 54 bytes --]
Reviewed-by: Zhiguang Liu < zhiguang.liu@intel.com >
[-- Attachment #2: Type: text/html, Size: 130 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function
2022-11-24 12:11 [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Jason Lou
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
2022-12-05 3:04 ` [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Zhiguang Liu
@ 2022-12-05 3:47 ` duntan
2 siblings, 0 replies; 6+ messages in thread
From: duntan @ 2022-12-05 3:47 UTC (permalink / raw)
To: devel@edk2.groups.io, Lou, Yun
Reviewed-by: Dun Tan <dun.tan@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Jason Lou
Sent: Thursday, November 24, 2022 8:12 PM
To: devel@edk2.groups.io
Cc: Lou, Yun <yun.lou@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>
Subject: [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function
From: Jason Lou <yun.lou@intel.com>
Move the implementation of EfiMpServiceProtocol unit tests in a separate function in preparation for developing the UEFI application and dynamic command for the same unit tests.
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
---
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c | 30 +++++++++++++++----- UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h | 2 +-
2 files changed, 24 insertions(+), 8 deletions(-)
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c
index 57f8ba3c06..5fe6369960 100644
--- a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolUnitTest.c
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProt
+++ ocolUnitTest.c
@@ -187,18 +187,16 @@ MpServicesUnitTestWhoAmI (
} /**- Standard DXE driver or UEFI application entry point for unit test execution from DXE or UEFI Shell.- Initialize the unit test framework, suite, and unit tests for the EfiMpServiceProtocol and run the unit test.+ Initialize the unit test framework, suite and unit tests for the EfiMpServiceProtocol and run the unit tests. - @param[in] ImageHandle The firmware allocated handle for the EFI image.- @param[in] SystemTable A pointer to the EFI System Table.+ @retval EFI_SUCCESS Initialize the unit test framework, suite, unit tests and run the unit tests successfully.+ @retval Others Initialize the unit test framework, suite, unit tests or run the unit tests unsuccessfully. **/ EFI_STATUS EFIAPI-DxeEntryPoint (- IN EFI_HANDLE ImageHandle,- IN EFI_SYSTEM_TABLE *SystemTable+EfiMpServiceProtocolUnitTest (+ VOID ) { EFI_STATUS Status;@@ -242,3 +240,21 @@ EXIT:
return Status; }++/**+ Standard DXE driver or UEFI application entry point for unit test execution from DXE or UEFI Shell.+ Initialize the unit test framework, suite, and unit tests for the EfiMpServiceProtocol and run the unit test.++ @param[in] ImageHandle The firmware allocated handle for the EFI image.+ @param[in] SystemTable A pointer to the EFI System Table.++**/+EFI_STATUS+EFIAPI+DxeEntryPoint (+ IN EFI_HANDLE ImageHandle,+ IN EFI_SYSTEM_TABLE *SystemTable+ )+{+ return EfiMpServiceProtocolUnitTest ();+}diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h
index abbbd2faba..d2b1633b4d 100644
--- a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUnitTestCommom.h
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServicesUni
+++ tTestCommom.h
@@ -1,5 +1,5 @@
/** @file- Common header file for EfiMpServiceProtocolUnitTest DXE driver.+ Common header file for EdkiiPeiMpServices2Ppi and EfiMpServiceProtocol unit test. Copyright (c) 2022, Intel Corporation. All rights reserved.<BR> --
2.28.0.windows.1
-=-=-=-=-=-=
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#96613): https://edk2.groups.io/g/devel/message/96613
Mute This Topic: https://groups.io/mt/95236455/6168883
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [dun.tan@intel.com] -=-=-=-=-=-=
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
2022-12-05 3:05 ` [edk2-devel] " Zhiguang Liu
@ 2022-12-05 3:47 ` duntan
1 sibling, 0 replies; 6+ messages in thread
From: duntan @ 2022-12-05 3:47 UTC (permalink / raw)
To: Lou, Yun, devel@edk2.groups.io
Reviewed-by: Dun Tan <dun.tan@intel.com>
-----Original Message-----
From: Lou, Yun <yun.lou@intel.com>
Sent: Thursday, November 24, 2022 8:12 PM
To: devel@edk2.groups.io
Cc: Lou, Yun <yun.lou@intel.com>; Ni, Ray <ray.ni@intel.com>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Liu, Zhiguang <zhiguang.liu@intel.com>; Tan, Dun <dun.tan@intel.com>
Subject: [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT
From: Jason Lou <yun.lou@intel.com>
The code changes develop UEFI application and dynamic command for EfiMpServiceProtocol unit tests based on current UnitTestFramework.
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
---
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c | 129 ++++++++++++++++++++
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf | 45 +++++++
UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf | 43 +++++++
UefiCpuPkg/UefiCpuPkg.dsc | 8 ++
4 files changed, 225 insertions(+)
diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.c
new file mode 100644
index 0000000000..be65c3d678
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProt
+++ ocolDynamicCmdUnitTest.c
@@ -0,0 +1,129 @@
+/** @file+ Produce "MpProtocolUnitTest" shell dynamic command.++ Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>++ SPDX-License-Identifier: BSD-2-Clause-Patent++**/++#include <Library/UefiBootServicesTableLib.h>+#include <Protocol/ShellDynamicCommand.h>+#include "EfiMpServicesUnitTestCommom.h"++CHAR16 *mMpProtocolUnitTestCommandHelp = L".TH MpProtocolUnitTest 0\r\n.SH NAME\r\nDisplay unit test results of EFI MP services protocol.\r\n";++EFI_STATUS+EFIAPI+EfiMpServiceProtocolUnitTest (+ VOID+ );++/**+ This is the shell command handler function pointer callback type. This+ function handles the command when it is invoked in the shell.++ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.+ @param[in] SystemTable The pointer to the system table.+ @param[in] ShellParameters The parameters associated with the command.+ @param[in] Shell The instance of the shell protocol used in the context+ of processing this command.++ @return EFI_SUCCESS the operation was successful+ @return other the operation failed.+**/+SHELL_STATUS+EFIAPI+MpProtocolUnitTestCommandHandler (+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,+ IN EFI_SYSTEM_TABLE *SystemTable,+ IN EFI_SHELL_PARAMETERS_PROTOCOL *ShellParameters,+ IN EFI_SHELL_PROTOCOL *Shell+ )+{+ return EfiMpServiceProtocolUnitTest ();+}++/**+ This is the command help handler function pointer callback type. This+ function is responsible for displaying help information for the associated+ command.++ @param[in] This The instance of the EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL.+ @param[in] Language The pointer to the language string to use.++ @return string Pool allocated help string, must be freed by caller+**/+CHAR16 *+EFIAPI+MpProtocolUnitTestCommandGetHelp (+ IN EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *This,+ IN CONST CHAR8 *Language+ )+{+ return AllocateCopyPool (StrSize (mMpProtocolUnitTestCommandHelp), mMpProtocolUnitTestCommandHelp);+}++EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL mMpProtocolUnitTestDynamicCommand = {+ L"MpProtocolUnitTest",+ MpProtocolUnitTestCommandHandler,+ MpProtocolUnitTestCommandGetHelp+};++/**+ Entry point of MpProtocolUnitTest Dynamic Command.++ Produce the DynamicCommand protocol to handle "MpProtocolUnitTest" command.++ @param ImageHandle The image handle of the process.+ @param SystemTable The EFI System Table pointer.++ @retval EFI_SUCCESS Tftp command is executed successfully.+ @retval EFI_ABORTED HII package was failed to initialize.+ @retval others Other errors when executing MpProtocolUnitTest command.+**/+EFI_STATUS+EFIAPI+MpProtocolUnitTestCommandInitialize (+ IN EFI_HANDLE ImageHandle,+ IN EFI_SYSTEM_TABLE *SystemTable+ )+{+ EFI_STATUS Status;++ Status = gBS->InstallProtocolInterface (+ &ImageHandle,+ &gEfiShellDynamicCommandProtocolGuid,+ EFI_NATIVE_INTERFACE,+ &mMpProtocolUnitTestDynamicCommand+ );+ ASSERT_EFI_ERROR (Status);++ return Status;+}++/**+ Driver unload handler.++ @param ImageHandle The image handle of the process.++ @retval EFI_SUCCESS The image is unloaded.+ @retval Others Failed to unload the image.+**/+EFI_STATUS+EFIAPI+MpProtocolUnitTestUnload (+ IN EFI_HANDLE ImageHandle+ )+{+ EFI_STATUS Status;++ Status = gBS->UninstallProtocolInterface (+ ImageHandle,+ &gEfiShellDynamicCommandProtocolGuid,+ &mMpProtocolUnitTestDynamicCommand+ );+ ASSERT_EFI_ERROR (Status);++ return Status;+}diff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf
new file mode 100644
index 0000000000..3fa287d1ae
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProt
+++ ocolDynamicCmdUnitTest.inf
@@ -0,0 +1,45 @@
+## @file+# DXE driver that provides Shell 'MpProtocolUnitTest' dynamic command to test EfiMpServiceProtocol.+#+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>+# SPDX-License-Identifier: BSD-2-Clause-Patent+#+##++[Defines]+ INF_VERSION = 0x00010005+ BASE_NAME = EfiMpServiceProtocolDynamicCmdUnitTest+ FILE_GUID = 8C4624B1-58CC-4DF6-9E6D-09B38D67DFA6+ MODULE_TYPE = DXE_DRIVER+ VERSION_STRING = 1.0+ ENTRY_POINT = MpProtocolUnitTestCommandInitialize+ UNLOAD_IMAGE = MpProtocolUnitTestUnload++[Sources]+ EfiMpServicesUnitTestCommom.c+ EfiMpServicesUnitTestCommom.h+ EfiMpServiceProtocolUnitTest.c+ EfiMpServiceProtocolDynamicCmdUnitTest.c++[Packages]+ MdePkg/MdePkg.dec+ MdeModulePkg/MdeModulePkg.dec+ UefiCpuPkg/UefiCpuPkg.dec++[LibraryClasses]+ BaseLib+ DebugLib+ BaseMemoryLib+ MemoryAllocationLib+ UefiDriverEntryPoint+ UefiBootServicesTableLib+ UefiLib+ UnitTestPersistenceLib+ UnitTestLib++[Protocols]+ gEfiMpServiceProtocolGuid ## CONSUMES+ gEfiShellDynamicCommandProtocolGuid ## PRODUCES++[Depex]+ TRUEdiff --git a/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf
new file mode 100644
index 0000000000..34c1ea96a6
--- /dev/null
+++ b/UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProt
+++ ocolShellUnitTest.inf
@@ -0,0 +1,43 @@
+## @file+# UEFI application that tests EfiMpServiceProtocol in Shell.+#+# Copyright (c) 2022, Intel Corporation. All rights reserved.<BR>+# SPDX-License-Identifier: BSD-2-Clause-Patent+#+##++[Defines]+ INF_VERSION = 0x00010005+ BASE_NAME = MpProtocolUnitTest+ FILE_GUID = 4CEE6399-A22C-4FFD-B148-3A56B1DD83F1+ MODULE_TYPE = UEFI_APPLICATION+ VERSION_STRING = 1.0+ ENTRY_POINT = DxeEntryPoint++#+# The following information is for reference only and not required by the build tools.+#+# VALID_ARCHITECTURES = IA32 X64+#++[Sources]+ EfiMpServicesUnitTestCommom.c+ EfiMpServicesUnitTestCommom.h+ EfiMpServiceProtocolUnitTest.c++[Packages]+ MdePkg/MdePkg.dec+ UefiCpuPkg/UefiCpuPkg.dec++[LibraryClasses]+ BaseLib+ DebugLib+ BaseMemoryLib+ MemoryAllocationLib+ UefiApplicationEntryPoint+ UefiBootServicesTableLib+ UnitTestPersistenceLib+ UnitTestLib++[Protocols]+ gEfiMpServiceProtocolGuid ## CONSUMESdiff --git a/UefiCpuPkg/UefiCpuPkg.dsc b/UefiCpuPkg/UefiCpuPkg.dsc
index 67b0ce46e4..f9a46089d2 100644
--- a/UefiCpuPkg/UefiCpuPkg.dsc
+++ b/UefiCpuPkg/UefiCpuPkg.dsc
@@ -183,6 +183,14 @@
UefiCpuPkg/Library/CpuExceptionHandlerLib/UnitTest/PeiCpuExceptionHandlerLibUnitTest.inf UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EdkiiPeiMpServices2PpiPeiUnitTest.inf UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDxeUnitTest.inf+ UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolDynamicCmdUnitTest.inf {+ <LibraryClasses>+ UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf+ }+ UefiCpuPkg/Test/UnitTest/EfiMpServicesPpiProtocol/EfiMpServiceProtocolShellUnitTest.inf {+ <LibraryClasses>+ UnitTestResultReportLib|UnitTestFrameworkPkg/Library/UnitTestResultReportLib/UnitTestResultReportLibConOut.inf+ } [Components.X64] UefiCpuPkg/Library/CpuExceptionHandlerLib/UnitTest/DxeCpuExceptionHandlerLibUnitTest.inf--
2.28.0.windows.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-12-05 3:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-24 12:11 [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Jason Lou
2022-11-24 12:11 ` [PATCH v1 2/2] UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT Jason Lou
2022-12-05 3:05 ` [edk2-devel] " Zhiguang Liu
2022-12-05 3:47 ` duntan
2022-12-05 3:04 ` [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function Zhiguang Liu
2022-12-05 3:47 ` duntan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox