OpenCore  1.0.8
OpenCore Bootloader
Loading...
Searching...
No Matches
TestAtapiPath.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Uefi.h>
#include <UserMemory.h>
#include <Protocol/BlockIo.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DevicePathLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/OcDevicePathLib.h>
#include <Library/OcDebugLogLib.h>

Go to the source code of this file.

Functions

VOID DebugPrintDevicePath (UINTN ErrorLevel, CONST CHAR8 *Message, EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
STATIC VOID Check (BOOLEAN Condition, CONST CHAR8 *Description)
 
STATIC EFI_STATUS EFIAPI MockHandleProtocol (EFI_HANDLE Handle, EFI_GUID *Protocol, VOID **Interface)
 
STATIC EFI_STATUS EFIAPI MockLocateHandleBuffer (EFI_LOCATE_SEARCH_TYPE SearchType, EFI_GUID *Protocol, VOID *SearchKey, UINTN *Count, EFI_HANDLE **HandleBuffer)
 
STATIC EFI_STATUS EFIAPI MockLocateDevicePath (EFI_GUID *Protocol, EFI_DEVICE_PATH_PROTOCOL **DevicePath, EFI_HANDLE *Handle)
 
STATIC VOID Reset (VOID)
 
STATIC VOID Run (CONST CHAR8 *Name, CONST UINT8 *Input, UINTN Size, BOOLEAN Expected)
 
STATIC VOID TestVirtioCleanup (VOID)
 
int main (int argc, char **argv)
 

Variables

STATIC CONST UINT8 mImage []
 
STATIC UINT8 mPaths [3][86]
 
STATIC EFI_BLOCK_IO_MEDIA mMedia [3]
 
STATIC EFI_BLOCK_IO_PROTOCOL mBlockIo [3]
 
STATIC UINTN mHandleCount
 
STATIC BOOLEAN mAlreadyValid
 
STATIC BOOLEAN mRejectFixed
 
STATIC BOOLEAN mNoHandles
 
STATIC BOOLEAN mRequireRootFix
 
STATIC UINT32 mTests
 

Detailed Description

Regression tests for the generic device path resolver with mocked disks. SPDX-License-Identifier: BSD-3-Clause

Definition in file TestAtapiPath.c.

Function Documentation

◆ Check()

STATIC VOID Check ( BOOLEAN Condition,
CONST CHAR8 * Description )

Definition at line 50 of file TestAtapiPath.c.

◆ DebugPrintDevicePath()

VOID DebugPrintDevicePath ( UINTN ErrorLevel,
CONST CHAR8 * Message,
EFI_DEVICE_PATH_PROTOCOL * DevicePath )

Definition at line 23 of file TestAtapiPath.c.

◆ main()

int main ( int argc,
char ** argv )

Definition at line 283 of file TestAtapiPath.c.

◆ MockHandleProtocol()

STATIC EFI_STATUS EFIAPI MockHandleProtocol ( EFI_HANDLE Handle,
EFI_GUID * Protocol,
VOID ** Interface )

Definition at line 64 of file TestAtapiPath.c.

◆ MockLocateDevicePath()

STATIC EFI_STATUS EFIAPI MockLocateDevicePath ( EFI_GUID * Protocol,
EFI_DEVICE_PATH_PROTOCOL ** DevicePath,
EFI_HANDLE * Handle )

Definition at line 118 of file TestAtapiPath.c.

◆ MockLocateHandleBuffer()

STATIC EFI_STATUS EFIAPI MockLocateHandleBuffer ( EFI_LOCATE_SEARCH_TYPE SearchType,
EFI_GUID * Protocol,
VOID * SearchKey,
UINTN * Count,
EFI_HANDLE ** HandleBuffer )

Definition at line 92 of file TestAtapiPath.c.

◆ Reset()

STATIC VOID Reset ( VOID )

Definition at line 177 of file TestAtapiPath.c.

◆ Run()

STATIC VOID Run ( CONST CHAR8 * Name,
CONST UINT8 * Input,
UINTN Size,
BOOLEAN Expected )

Definition at line 208 of file TestAtapiPath.c.

◆ TestVirtioCleanup()

STATIC VOID TestVirtioCleanup ( VOID )

Definition at line 246 of file TestAtapiPath.c.

Variable Documentation

◆ mAlreadyValid

STATIC BOOLEAN mAlreadyValid

Definition at line 42 of file TestAtapiPath.c.

◆ mBlockIo

STATIC EFI_BLOCK_IO_PROTOCOL mBlockIo[3]

Definition at line 40 of file TestAtapiPath.c.

◆ mHandleCount

STATIC UINTN mHandleCount

Definition at line 41 of file TestAtapiPath.c.

◆ mImage

STATIC CONST UINT8 mImage[]
Initial value:
= {
2, 1, 12, 0, 0xd0, 0x41, 3, 0x0a, 0, 0, 0, 0,
1, 1, 6, 0, 0, 0x1c, 1, 1, 6, 0, 0, 0,
3, 1, 8, 0, 0, 1, 0, 0,
4, 4, 16, 0, '1', 0, '0', 0, '0', 0, ':', 0,'A',0, 0, 0,
0x7f, 0xff, 4, 0
}

Definition at line 31 of file TestAtapiPath.c.

◆ mMedia

STATIC EFI_BLOCK_IO_MEDIA mMedia[3]

Definition at line 39 of file TestAtapiPath.c.

◆ mNoHandles

STATIC BOOLEAN mNoHandles

Definition at line 44 of file TestAtapiPath.c.

◆ mPaths

STATIC UINT8 mPaths[3][86]

Definition at line 38 of file TestAtapiPath.c.

◆ mRejectFixed

STATIC BOOLEAN mRejectFixed

Definition at line 43 of file TestAtapiPath.c.

◆ mRequireRootFix

STATIC BOOLEAN mRequireRootFix

Definition at line 45 of file TestAtapiPath.c.

◆ mTests

STATIC UINT32 mTests

Definition at line 46 of file TestAtapiPath.c.