TianoCore EDK2 master
|
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestLib.h>
#include <Library/ResetSystemLib.h>
Go to the source code of this file.
Macros | |
#define | UNIT_TEST_APP_NAME "DxeResetSystemLib Unit Tests" |
#define | UNIT_TEST_APP_VERSION "1.0" |
Functions | |
STATIC VOID EFIAPI | MockResetSystem (IN EFI_RESET_TYPE ResetType, IN EFI_STATUS ResetStatus, IN UINTN DataSize, IN VOID *ResetData OPTIONAL) |
UNIT_TEST_STATUS EFIAPI | ResetColdShouldIssueAColdReset (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | ResetWarmShouldIssueAWarmReset (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | ResetShutdownShouldIssueAShutdown (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | ResetPlatformSpecificShouldIssueAPlatformSpecificReset (IN UNIT_TEST_CONTEXT Context) |
UNIT_TEST_STATUS EFIAPI | ResetSystemShouldPassTheParametersThrough (IN UNIT_TEST_CONTEXT Context) |
STATIC EFI_STATUS EFIAPI | UnitTestingEntry (VOID) |
int | main (int argc, char *argv[]) |
Variables | |
EFI_RUNTIME_SERVICES | MockRuntime |
Unit tests of the DxeResetSystemLib instance of the ResetSystemLib class
Copyright (C) Microsoft Corporation. SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file DxeResetSystemLibUnitTest.c.
#define UNIT_TEST_APP_NAME "DxeResetSystemLib Unit Tests" |
Definition at line 25 of file DxeResetSystemLibUnitTest.c.
#define UNIT_TEST_APP_VERSION "1.0" |
Definition at line 26 of file DxeResetSystemLibUnitTest.c.
int main | ( | int | argc, |
char * | argv[] | ||
) |
Standard POSIX C entry point for host based unit test execution.
Definition at line 306 of file DxeResetSystemLibUnitTest.c.
STATIC VOID EFIAPI MockResetSystem | ( | IN EFI_RESET_TYPE | ResetType, |
IN EFI_STATUS | ResetStatus, | ||
IN UINTN | DataSize, | ||
IN VOID *ResetData | OPTIONAL | ||
) |
Resets the entire platform.
[in] | ResetType | The type of reset to perform. |
[in] | ResetStatus | The status code for the reset. |
[in] | DataSize | The size, in bytes, of ResetData. |
[in] | ResetData | For a ResetType of EfiResetCold, EfiResetWarm, or EfiResetShutdown the data buffer starts with a Null-terminated string, optionally followed by additional binary data. The string is a description that the caller may use to further indicate the reason for the system reset. For a ResetType of EfiResetPlatformSpecific the data buffer also starts with a Null-terminated string that is followed by an EFI_GUID that describes the specific type of reset to perform. |
Definition at line 46 of file DxeResetSystemLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI ResetColdShouldIssueAColdReset | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for ColdReset () API of the ResetSystemLib.
[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 105 of file DxeResetSystemLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI ResetPlatformSpecificShouldIssueAPlatformSpecificReset | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for ResetPlatformSpecific () API of the ResetSystemLib.
[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 192 of file DxeResetSystemLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI ResetShutdownShouldIssueAShutdown | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for ResetShutdown () API of the ResetSystemLib.
[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 163 of file DxeResetSystemLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI ResetSystemShouldPassTheParametersThrough | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for ResetSystem () API of the ResetSystemLib.
[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 221 of file DxeResetSystemLibUnitTest.c.
UNIT_TEST_STATUS EFIAPI ResetWarmShouldIssueAWarmReset | ( | IN UNIT_TEST_CONTEXT | Context | ) |
Unit test for WarmReset () API of the ResetSystemLib.
[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 134 of file DxeResetSystemLibUnitTest.c.
STATIC EFI_STATUS EFIAPI UnitTestingEntry | ( | VOID | ) |
Initialze the unit test framework, suite, and unit tests for the ResetSystemLib and run the ResetSystemLib unit test.
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 249 of file DxeResetSystemLibUnitTest.c.
EFI_RUNTIME_SERVICES MockRuntime |
Mock version of the UEFI Runtime Services Table
Definition at line 64 of file DxeResetSystemLibUnitTest.c.