]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Test/UnitTest/Library/BaseCryptLib/UnitTestMain.c
CryptoPkg: Apply uncrustify changes
[mirror_edk2.git] / CryptoPkg / Test / UnitTest / Library / BaseCryptLib / UnitTestMain.c
CommitLineData
694bfd6f
MC
1/** @file\r
2 This is a sample to demostrate the usage of the Unit Test Library that\r
3 supports the PEI, DXE, SMM, UEFI SHell, and host execution environments.\r
4\r
5 Copyright (c) Microsoft Corporation.<BR>\r
6 SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9#include "TestBaseCryptLib.h"\r
10\r
694bfd6f
MC
11/**\r
12 Initialize the unit test framework, suite, and unit tests for the\r
13 sample unit tests and run the unit tests.\r
14\r
15 @retval EFI_SUCCESS All test cases were dispatched.\r
16 @retval EFI_OUT_OF_RESOURCES There are not enough resources available to\r
17 initialize the unit tests.\r
18**/\r
19EFI_STATUS\r
20EFIAPI\r
21UefiTestMain (\r
22 VOID\r
23 )\r
24{\r
25 EFI_STATUS Status;\r
26 UNIT_TEST_FRAMEWORK_HANDLE Framework;\r
27\r
7c342378
MK
28 DEBUG ((DEBUG_INFO, "%a v%a\n", UNIT_TEST_NAME, UNIT_TEST_VERSION));\r
29 CreateUnitTest (UNIT_TEST_NAME, UNIT_TEST_VERSION, &Framework);\r
694bfd6f
MC
30\r
31 //\r
32 // Execute the tests.\r
33 //\r
34 Status = RunAllTestSuites (Framework);\r
35\r
36 if (Framework) {\r
37 FreeUnitTestFramework (Framework);\r
38 }\r
39\r
40 return Status;\r
41}\r
42\r
43/**\r
44 Standard PEIM entry point for target based unit test execution from PEI.\r
45**/\r
46EFI_STATUS\r
47EFIAPI\r
48PeiEntryPoint (\r
49 IN EFI_PEI_FILE_HANDLE FileHandle,\r
50 IN CONST EFI_PEI_SERVICES **PeiServices\r
51 )\r
52{\r
53 return UefiTestMain ();\r
54}\r
55\r
56/**\r
57 Standard UEFI entry point for target based unit test execution from DXE, SMM,\r
58 UEFI Shell.\r
59**/\r
60EFI_STATUS\r
61EFIAPI\r
62DxeEntryPoint (\r
63 IN EFI_HANDLE ImageHandle,\r
64 IN EFI_SYSTEM_TABLE *SystemTable\r
65 )\r
66{\r
67 return UefiTestMain ();\r
68}\r
69\r
70/**\r
71 Standard POSIX C entry point for host based unit test execution.\r
72**/\r
73int\r
74main (\r
7c342378
MK
75 int argc,\r
76 char *argv[]\r
694bfd6f
MC
77 )\r
78{\r
79 return UefiTestMain ();\r
80}\r