TianoCore EDK2 master
|
#include <PiPei.h>
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/DebugLib.h>
#include <Library/UnitTestLib.h>
#include <Library/PrintLib.h>
Go to the source code of this file.
Macros | |
#define | UNIT_TEST_NAME "Sample Unit Test Generate Exception" |
#define | UNIT_TEST_VERSION "0.1" |
Functions | |
VOID EFIAPI | TestSuiteEnableAsserts (VOID) |
VOID EFIAPI | TestSuiteDisableAsserts (VOID) |
UINTN | DivideWithNoParameterChecking (UINTN Dividend, UINTN Divisor) |
UNIT_TEST_STATUS EFIAPI | GenerateUnexpectedException (IN UNIT_TEST_CONTEXT Context) |
EFI_STATUS EFIAPI | UefiTestMain (VOID) |
EFI_STATUS EFIAPI | PeiEntryPoint (IN EFI_PEI_FILE_HANDLE FileHandle, IN CONST EFI_PEI_SERVICES **PeiServices) |
EFI_STATUS EFIAPI | DxeEntryPoint (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) |
int | main (int argc, char *argv[]) |
This is a sample to demonstrate the usage of the Unit Test Library that supports the PEI, DXE, SMM, UEFI Shell, and host execution environments. This test case generates an exception. For some host-based environments, this is a fatal condition that terminates the unit tests and no additional test cases are executed. On other environments, this condition may be report a unit test failure and continue with additional unit tests.
Copyright (c) 2024, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SampleUnitTestGenerateException.c.
#define UNIT_TEST_NAME "Sample Unit Test Generate Exception" |
Definition at line 20 of file SampleUnitTestGenerateException.c.
#define UNIT_TEST_VERSION "0.1" |
Definition at line 21 of file SampleUnitTestGenerateException.c.
Definition at line 54 of file SampleUnitTestGenerateException.c.
EFI_STATUS EFIAPI DxeEntryPoint | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
Standard UEFI entry point for target based unit test execution from DXE, SMM, UEFI Shell.
Definition at line 186 of file SampleUnitTestGenerateException.c.
UNIT_TEST_STATUS EFIAPI GenerateUnexpectedException | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Sample unit test the triggers an unexpected exception
[in] | Context | [Optional] An optional parameter that enables: 1) test-case reuse with varied parameters and 2) test-case re-entry for Target tests that need a reboot. This parameter is a VOID* and it is the responsibility of the test author to ensure that the contents are well understood by all test cases that may consume it. |
UNIT_TEST_PASSED | The Unit test has completed and the test case was successful. |
UNIT_TEST_ERROR_TEST_FAILED | A test case assertion has failed. |
Definition at line 82 of file SampleUnitTestGenerateException.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Standard POSIX C entry point for host based unit test execution.
Definition at line 198 of file SampleUnitTestGenerateException.c.
EFI_STATUS EFIAPI PeiEntryPoint | ( | IN EFI_PEI_FILE_HANDLE | FileHandle, |
IN CONST EFI_PEI_SERVICES ** | PeiServices | ||
) |
Standard PEIM entry point for target based unit test execution from PEI.
Definition at line 172 of file SampleUnitTestGenerateException.c.
VOID EFIAPI TestSuiteDisableAsserts | ( | VOID | ) |
Unit-Test Test Suite Setup (before) function that disables ASSERT() macros.
Definition at line 43 of file SampleUnitTestGenerateException.c.
VOID EFIAPI TestSuiteEnableAsserts | ( | VOID | ) |
Unit-Test Test Suite Setup (before) function that enables ASSERT() macros.
Definition at line 28 of file SampleUnitTestGenerateException.c.
EFI_STATUS EFIAPI UefiTestMain | ( | VOID | ) |
Initialize the unit test framework, suite, and unit tests for the sample unit tests and run the unit tests.
EFI_SUCCESS | All test cases were dispatched. |
EFI_OUT_OF_RESOURCES | There are not enough resources available to initialize the unit tests. |
Definition at line 108 of file SampleUnitTestGenerateException.c.