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