本文整理汇总了C++中EFI_STANDARD_TEST_LIBRARY_PROTOCOL::RecordAssertion方法的典型用法代码示例。如果您正苦于以下问题:C++ EFI_STANDARD_TEST_LIBRARY_PROTOCOL::RecordAssertion方法的具体用法?C++ EFI_STANDARD_TEST_LIBRARY_PROTOCOL::RecordAssertion怎么用?C++ EFI_STANDARD_TEST_LIBRARY_PROTOCOL::RecordAssertion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EFI_STANDARD_TEST_LIBRARY_PROTOCOL
的用法示例。
在下文中一共展示了EFI_STANDARD_TEST_LIBRARY_PROTOCOL::RecordAssertion方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LocateDevicePathFromBlockIo
//
// TDS 5.3
//
EFI_STATUS
BBTestWriteBlocksFunctionAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
UINT32 MediaId;
BOOLEAN RemovableMedia;
BOOLEAN MediaPresent;
BOOLEAN LogicalPartition;
BOOLEAN ReadOnly;
BOOLEAN WriteCaching;
UINT32 BlockSize;
UINT32 IoAlign;
EFI_LBA LastBlock;
UINTN BufferSize;
UINT8 *Buffer;
UINT8 *Buffer2;
UINT8 *Buffer3;
UINT32 BlockNumber;
UINTN IndexI, IndexJ;
UINTN NewBufferSize;
EFI_LBA NewLba;
UINTN Remainder;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
CHAR16 *DevicePathStr;
EFI_TEST_ASSERTION AssertionTypeRead1;
EFI_TEST_ASSERTION AssertionTypeRead2;
EFI_TEST_ASSERTION AssertionTypeRead3;
EFI_TEST_ASSERTION AssertionTypeWrite1;
EFI_TEST_ASSERTION AssertionTypeWrite2;
EFI_TEST_ASSERTION AssertionTypeComp1;
EFI_TEST_ASSERTION AssertionTypeComp2;
EFI_STATUS StatusRead1;
EFI_STATUS StatusRead2;
EFI_STATUS StatusRead3;
EFI_STATUS StatusWrite1;
EFI_STATUS StatusWrite2;
UINTN CountComp1;
UINTN CountComp2;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
BlockIo = (EFI_BLOCK_IO_PROTOCOL *)ClientInterface;
//
// Locate & record DevicePath for further investigation
//
LocateDevicePathFromBlockIo (BlockIo, &DevicePath, StandardLib);
DevicePathStr = DevicePathToStr (DevicePath);
if (DevicePathStr != NULL) {
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"Current Device: %s",
DevicePathStr
);
Status = gtBS->FreePool (DevicePathStr);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
//.........这里部分代码省略.........
示例2:
//
// TDS 3.1
//
EFI_STATUS
BBTestResetFunctionAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_DEBUGPORT_PROTOCOL *DebugPort;
EFI_TEST_ASSERTION AssertionType;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
DebugPort = (EFI_DEBUGPORT_PROTOCOL *)ClientInterface;
//
// Assertion Point 3.1.2.1
// Invoke Reset and verify interface correctness within test case.
//
Status = DebugPort->Reset (DebugPort);
if (EFI_ERROR(Status)) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
} else {
AssertionType = EFI_TEST_ASSERTION_PASSED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gDebugPortBBTestFunctionAssertionGuid001,
L"EFI_DEBUGPORT_PROTOCOL.Reset - Invoke Reset and verify interface correctness within test case",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return EFI_SUCCESS;
}
示例3:
//
// TDS 4.1
//
EFI_STATUS
BBTestGetNextDeviceConformanceAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
EFI_TEST_ASSERTION AssertionType;
UINT32 Target;
UINT64 Lun;
UINT32 NewTarget;
UINT64 NewLun;
//
// Verify whether it is one of IHV interfaces
//
if (! IsIhvInterface (ClientInterface, SupportHandle)) {
return EFI_UNSUPPORTED;
}
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
ScsiPassThru = (EFI_SCSI_PASS_THRU_PROTOCOL *)ClientInterface;
//
// Assertion Point 4.1.2.1
// Call GetNextDevice() with invalid parameter.
//
NewTarget = 0xFFFFFFFF;
//
// Get First Device Target and Lun.
//
Status = ScsiPassThru->GetNextDevice (ScsiPassThru, &NewTarget, &NewLun);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"EFI_SCSI_PASS_THRU_PROTOCOL.GetNextDevice",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return EFI_UNSUPPORTED;
}
//
// Check point 1, call GetNextDevice with invalid Target.
//
Target = 0xEEEEEEEE;
Lun = NewLun;
Status = ScsiPassThru->GetNextDevice (ScsiPassThru, &Target, &Lun);
if (Status == EFI_INVALID_PARAMETER) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gScsiPassThruBBTestConformanceAssertionGuid002,
L"EFI_SCSI_PASS_THRU_PROTOCOL.GetNextDevice - call GetNextDevice with invalid Target.",
L"%a:%d:Status - %r, Target - %d, Lun - %ld",
__FILE__,
__LINE__,
Status,
Target,
Lun
//.........这里部分代码省略.........
示例4: CheckLongFileName
//
// TDS 4.1.6
//
EFI_STATUS
BBTestStrToFatFunctionAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_UNICODE_COLLATION2_PROTOCOL *UnicodeCollation;
UINTN Index;
UINTN SubIndex;
UINTN FatSize;
EFI_TEST_ASSERTION AssertionType;
//
// Test Data
//
CHAR16 *TestData[] ={
L"longfilename.c",
L"\x40\x50[]-\x20\x30",
L"\x40\x50.\x20\x30",
L"\x40\x50 \x20\x30",
L"\x40\x50\x1234\x20\x30",
L"\x40\x50\x1234\x20\x30",
L"filename.c",
L"longfilename.c"
};
CHAR8 Result[MAX_SIZE_OF_STRING + 1];
CHAR16 UnicodeBuf[MAX_SIZE_OF_STRING + 1];
BOOLEAN IsLongFileName;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
UnicodeCollation = (EFI_UNICODE_COLLATION2_PROTOCOL *)ClientInterface;
for (Index = 0; Index < sizeof (TestData) / sizeof (CHAR16*); Index++) {
//
// For each test data, test the StrToFat functionality.
//
for (SubIndex = 0; SubIndex < MAX_SIZE_OF_STRING; SubIndex++) {
Result[SubIndex] = 'x';
}
Result[MAX_SIZE_OF_STRING] = 0;
//
// FatSize is equal to the length of TestData[Index]
//
FatSize = GetStrLen16 (TestData[Index]);
IsLongFileName = UnicodeCollation->StrToFat (
UnicodeCollation,
TestData[Index],
FatSize,
Result
);
if (CheckStrToFat (TestData[Index], FatSize, Result, IsLongFileName) == TRUE &&
IsLongFileName == CheckLongFileName (TestData[Index], FatSize)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
//
// Change Char8 to Char16 for record log
//
UnicodeCollation->FatToStr (
UnicodeCollation,
FatSize,
//.........这里部分代码省略.........
示例5: EfiCommonLibZeroMem
//
// TDS 3.3
//
EFI_STATUS
BBTestReadFunctionManualTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_DEBUGPORT_PROTOCOL *DebugPort;
EFI_TEST_ASSERTION AssertionType;
UINTN BufferSize;
CHAR8 Buffer[20];
UINTN WaitIndex;
EFI_INPUT_KEY Key;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
DebugPort = (EFI_DEBUGPORT_PROTOCOL *)ClientInterface;
//
// Assertion Point 3.3.2.1
// Call Read() to send data to debug port with enough time.
//
BufferSize = 1;
EfiCommonLibZeroMem ((VOID*)Buffer, sizeof(Buffer));
//
// Wait for the input data.
//
Print (L"Please any key after input data.");
gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex);
gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key);
Status = DebugPort->Read (DebugPort, 1000, &BufferSize, (VOID*)Buffer);
if (EFI_ERROR(Status)) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
} else {
AssertionType = EFI_TEST_ASSERTION_PASSED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gDebugPortBBTestFunctionAssertionGuid006,
L"EFI_DEBUGPORT_PROTOCOL.Read - Invoke Read and verify interface correctness with enough time",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
//
// Verify the functionality manually.
//
Print (L"Please verify the input string is %s, right press \"Y\", wrong press \"N\"", Buffer);
//
// Get the input key.
//
while(1)
{
gtBS->WaitForEvent (1, &(gtST->ConIn->WaitForKey), &WaitIndex);
gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key);
if((Key.UnicodeChar == L'Y') || (Key.UnicodeChar == L'y') || (Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
break;
}
else {
Print (L"Please press \"Y\" or \"N\"");
}
}
if ((Key.UnicodeChar == L'N') || (Key.UnicodeChar == L'n')) {
AssertionType = EFI_TEST_ASSERTION_FAILED;
} else {
AssertionType = EFI_TEST_ASSERTION_PASSED;
//.........这里部分代码省略.........
示例6:
//
// TDS 4.1.2
//
EFI_STATUS
BBTestMetaiMatchFunctionAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_UNICODE_COLLATION2_PROTOCOL *UnicodeCollation;
UINTN Index;
BOOLEAN Result;
EFI_TEST_ASSERTION AssertionType;
//
// Test Data
//
METAIMATCH_TEST_DATA_FIELD TestData[] ={
{L"", L"\x30\x50zz\x40\x20", FALSE},
{L"\x30\x50*\x40\x20", L"", FALSE},
{L"", L"", TRUE},
{L"\x30\x50*\x40\x20", L"\x30\x50zz\x40\x20", TRUE},
{L"\x30\x50*\x40\x20", L"\x30\x50\x30\x20", FALSE},
{L"\x30\x50?\x40\x20", L"\x30\x50H\x40\x20", TRUE},
{L"\x30\x50?\x40\x20", L"\x30\x50\x40\x20", FALSE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
{L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
{L"\x30\x50[abcdZyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50w\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\[email protected]\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50*\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*?]\x40\x20", L"\x30\x50?\x40\x20", TRUE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50g\x40\x20", FALSE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50q\x40\x20", FALSE},
{L"\x30\x50[abcdzyxw!)(@#*]\x40\x20", L"\x30\x50W\x40\x20", TRUE},
//
// Index = 19
//
{L"[a-z]", L"b", TRUE},
{L"[a-z]", L"B", TRUE},
{L"[bcd]", L"B", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50r\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50R\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Z\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50z\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50Y\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50s\x40\x20", TRUE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50k\x40\x20", FALSE},
{L"\x30\x50[R-Z]\x40\x20", L"\x30\x50K\x40\x20", FALSE},
//
// Index = 30
//
{L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x20\x40\x20", TRUE},
{L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x25\x40\x20", TRUE},
{L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x22\x40\x20", TRUE},
{L"\x30\x50[\x20-\x25]\x40\x20", L"\x30\x50\x10\x40\x20", FALSE},
};
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
UnicodeCollation = (EFI_UNICODE_COLLATION2_PROTOCOL *)ClientInterface;
for (Index = 0; Index < sizeof (TestData) / sizeof (METAIMATCH_TEST_DATA_FIELD); Index ++) {
//
//.........这里部分代码省略.........
示例7: LoadEbcDriver
//
// TDS 4.1
//
EFI_STATUS
BBTestCreateThunkConformanceTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_TEST_ASSERTION AssertionType;
EFI_EBC_PROTOCOL *EbcInterface;
VOID *EbcEntryPoint;
EFI_IMAGE_ENTRY_POINT ThunkEntryPoint;
//
// Verify whether it is one of IHV interfaces
//
if (! IsIhvInterface (ClientInterface, SupportHandle)) {
return EFI_UNSUPPORTED;
}
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
return Status;
}
//
// Get the EFI_EBC_PROTOCOL Protocol interface to be tested
//
EbcInterface = (EFI_EBC_PROTOCOL *)ClientInterface;
//
// Register a callback for flushing the instruction cache so that created
// thunks can be flushed.
//
Status = EbcInterface->RegisterICacheFlush (EbcInterface, FlushICache);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"EFI_EBC_PROTOCOL.RegisterICacheFlush - Can't register callback function",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
//
// Load Ebc Driver
//
Status = LoadEbcDriver (&EbcEntryPoint);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_WARNING,
gTestGenericFailureGuid,
L"LoadEbcDriver - Can't load Ebc Driver and get the entry point",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
UnloadEbcDriver();
return Status;
}
//
// 4.1.2.1 Call CreateThunk() with Invalid Parameters
//
Status = EbcInterface->CreateThunk (
EbcInterface,
gDummyImageHandle,
(VOID *)((UINTN)EbcEntryPoint+1), // invalid
(VOID **)&ThunkEntryPoint
);
if (Status == EFI_INVALID_PARAMETER) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gEbcBBTestConformanceAssertionGuid001,
L"EFI_EBC_PROTOCOL.CreateThunk - Call CreateThunk() with Invalid Parameters",
//.........这里部分代码省略.........
示例8: AllocatePool
//
// TDS 3.4.2
//
EFI_STATUS
DevicePathUtilitiesAppendDeviceNodeConformanceTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_DEVICE_PATH_UTILITIES_PROTOCOL *DevicePathUtilities;
EFI_TEST_ASSERTION AssertionType;
EFI_DEVICE_PATH_PROTOCOL *pDevicePath1;
EFI_DEVICE_PATH_PROTOCOL *pDevicePath2;
EFI_DEVICE_PATH_PROTOCOL *pDevicePath3;
EFI_DEVICE_PATH_PROTOCOL *pDevicePath4;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR (Status)) {
return Status;
}
DevicePathUtilities = (EFI_DEVICE_PATH_UTILITIES_PROTOCOL *) ClientInterface;
//
// TDS 3.4.2.2.1
//
pDevicePath1 = (EFI_DEVICE_PATH *) AllocatePool (END_DEVICE_PATH_LENGTH);
if (pDevicePath1 == NULL) {
return EFI_OUT_OF_RESOURCES;
}
SetDevicePathEndNode (pDevicePath1);
pDevicePath2 = DevicePathUtilities->CreateDeviceNode (PCIRootNodeType, PCIRootNodeSubType, PCIRootNodeLength);
pDevicePath4 = DevicePathUtilities->AppendDeviceNode (pDevicePath1, pDevicePath2);
pDevicePath3 = DevicePathUtilities->AppendDeviceNode (NULL, pDevicePath2);
if ((pDevicePath3 != NULL) && (EfiCompareMem(pDevicePath3, pDevicePath4, DevicePathUtilities->GetDevicePathSize (pDevicePath3)) == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
if (pDevicePath3 != NULL) {
FreePool (pDevicePath3);
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gDevicePathUtilitiesBBTestFunctionAssertionGuid054,
L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - AppendDeviceNode should return a copy of DeviceNode if DevicePath is NULL",
L"%a:%d",
__FILE__,
(UINTN)__LINE__
);
//
// TDS 3.4.2.2.2
//
pDevicePath3 = DevicePathUtilities->AppendDeviceNode (pDevicePath4, NULL);
if ((pDevicePath3 != NULL) && (EfiCompareMem(pDevicePath3, pDevicePath4, DevicePathUtilities->GetDevicePathSize (pDevicePath3)) == 0)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
if (pDevicePath2 != NULL) {
FreePool(pDevicePath2);
}
if (pDevicePath3 != NULL) {
FreePool(pDevicePath3);
}
if (pDevicePath4 != NULL) {
FreePool(pDevicePath4);
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gDevicePathUtilitiesBBTestFunctionAssertionGuid055,
L"EFI_DEVICE_PATH_UTILITIES_PROTOCOL - AppendDeviceNode should return a copy of DevicePath if DeviceNode is NULL",
L"%a:%d",
__FILE__,
(UINTN)__LINE__
);
pDevicePath3 = DevicePathUtilities->AppendDeviceNode (NULL, NULL);
if ((pDevicePath3 != NULL) && (EfiCompareMem(pDevicePath3, pDevicePath1, DevicePathUtilities->GetDevicePathSize (pDevicePath3)) == 0)) {
//.........这里部分代码省略.........
示例9: LocateDevicePathFromSimpleTextOut
//
// TDS 4.2.3
//
EFI_STATUS
BBTestQueryModeConformanceAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleOut;
EFI_TEST_ASSERTION AssertionType;
EFI_SIMPLE_TEXT_OUTPUT_MODE ModeExpected;
UINTN ModeNumber[5];
UINTN Column, Row;
UINTN Index;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
CHAR16 *DevicePathStr;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
SimpleOut = (EFI_SIMPLE_TEXT_OUT_PROTOCOL *)ClientInterface;
//
// Get Device Path of current Simple_Text_Output_Protocol
// And out put device path or device name
//
Status = LocateDevicePathFromSimpleTextOut (SimpleOut, &DevicePath, StandardLib);
if (Status == EFI_SUCCESS) {
DevicePathStr = DevicePathToStr (DevicePath);
if (DevicePathStr != NULL) {
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"\r\nCurrent Device: %s",
DevicePathStr
);
Status = gtBS->FreePool (DevicePathStr);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.FreePool - Free pool",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
DevicePathStr = NULL;
}
} else {
Status = LocateGopFromSimpleTextOut (SimpleOut, &GraphicsOutput, StandardLib);
if (EFI_ERROR(Status)) {
//
// Console Splitter/StdErr
//
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"\r\nCurrent Device: ConsoleSplitter/StdErr"
);
} else {
//
// Console Splitter/ConOut
//
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"\r\nCurrent Device: ConsoleSplitter/ConOut"
);
}
//.........这里部分代码省略.........
示例10: LoadEbcDriver
//
// TDS 3.1
//
EFI_STATUS
BBTestCreateThunkBasicTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_TEST_ASSERTION AssertionType;
EFI_EBC_PROTOCOL *EbcInterface;
VOID *EbcEntryPoint;
EFI_IMAGE_ENTRY_POINT ThunkEntryPoint;
VOID *EbcDriverInterface;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
return Status;
}
//
// Get the EFI_EBC_PROTOCOL Protocol interface to be tested
//
EbcInterface = (EFI_EBC_PROTOCOL *)ClientInterface;
//
// Register a callback for flushing the instruction cache so that created
// thunks can be flushed.
//
Status = EbcInterface->RegisterICacheFlush (EbcInterface, FlushICache);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"EFI_EBC_PROTOCOL.RegisterICacheFlush - Can't register callback function",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
//
// 3.1.2.1 CreateThunk() Basic Functionality
//
//
// Load Ebc Driver
//
Status = LoadEbcDriver (&EbcEntryPoint);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_WARNING,
gTestGenericFailureGuid,
L"LoadEbcDriver - Can't load Ebc Driver and get the entry point",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
UnloadEbcDriver();
return Status;
}
//
// Create a thunk for the image's entry point. This will be the new
// entry point for the image.
//
Status = EbcInterface->CreateThunk (
EbcInterface,
gDummyImageHandle,
EbcEntryPoint,
(VOID **)&ThunkEntryPoint
);
if (Status == EFI_SUCCESS) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gEbcBBTestFunctionAssertionGuid001,
L"EFI_EBC_PROTOCOL.CreateThunk - Call CreateThunk to create ebc thunk",
L"%a:%d:Status - %r",
//.........这里部分代码省略.........
示例11: RestoreMode
//
// TDS 4.2.6
//
EFI_STATUS
BBTestSetCursorPositionConformanceAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_SIMPLE_TEXT_OUT_PROTOCOL *SimpleOut;
EFI_TEST_ASSERTION AssertionType;
EFI_SIMPLE_TEXT_OUTPUT_MODE ModeOrg, ModeExpected;
INT32 Mode;
UINTN ColumnTest[10], RowTest[10];
UINTN Column, Row;
UINTN Index;
EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
CHAR16 *DevicePathStr;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
SimpleOut = (EFI_SIMPLE_TEXT_OUT_PROTOCOL *)ClientInterface;
//
// Get Device Path of current Simple_Text_Output_Protocol
// And out put device path or device name
//
Status = LocateDevicePathFromSimpleTextOut (SimpleOut, &DevicePath, StandardLib);
if (Status == EFI_SUCCESS) {
DevicePathStr = DevicePathToStr (DevicePath);
if (DevicePathStr != NULL) {
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"\r\nCurrent Device: %s",
DevicePathStr
);
Status = gtBS->FreePool (DevicePathStr);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.FreePool - Free pool",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
DevicePathStr = NULL;
}
} else {
Status = LocateGopFromSimpleTextOut (SimpleOut, &GraphicsOutput, StandardLib);
if (EFI_ERROR(Status)) {
//
// Console Splitter/StdErr
//
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
L"\r\nCurrent Device: ConsoleSplitter/StdErr"
);
} else {
//
// Console Splitter/ConOut
//
StandardLib->RecordMessage (
StandardLib,
EFI_VERBOSE_LEVEL_DEFAULT,
//.........这里部分代码省略.........
示例12: MINIMUM
//
// TDS 5.5
//
EFI_STATUS
BBTestMediaIntegrityManualTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_BLOCK_IO_PROTOCOL *BlockIo;
EFI_TEST_ASSERTION AssertionType;
UINT32 MediaId;
BOOLEAN RemovableMedia;
BOOLEAN MediaPresent;
BOOLEAN LogicalPartition;
BOOLEAN ReadOnly;
BOOLEAN WriteCaching;
UINT32 BlockSize;
UINT32 IoAlign;
EFI_LBA LastBlock;
UINTN BufferSize;
UINT8 *Buffer;
UINT32 BlockNumber;
UINTN Index;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
CHAR16 *DevicePathStr;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
BlockIo = (EFI_BLOCK_IO_PROTOCOL *)ClientInterface;
//
// Initialize variable
//
MediaId = BlockIo->Media->MediaId;
RemovableMedia = BlockIo->Media->RemovableMedia;
MediaPresent = BlockIo->Media->MediaPresent;
LogicalPartition = BlockIo->Media->LogicalPartition;
ReadOnly = BlockIo->Media->ReadOnly;
WriteCaching = BlockIo->Media->WriteCaching;
BlockSize = BlockIo->Media->BlockSize;
IoAlign = BlockIo->Media->IoAlign;
LastBlock = BlockIo->Media->LastBlock;
BlockNumber = (UINT32) MINIMUM(LastBlock, MAX_NUMBER_OF_READ_BLOCK_BUFFER);
BufferSize = BlockNumber * BlockSize;
if (BufferSize == 0) {
BufferSize = 512;
}
//
// allocate buffer
//
Status = gtBS->AllocatePool (EfiBootServicesData, BufferSize, &Buffer);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.AllocatePool - Allocate buffer for testing",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
//
// Locate the Handle that the BlockIo interface is bound to
//
//.........这里部分代码省略.........
示例13: GetFpuControlWord
EFI_STATUS
BBTestFpuControlWordTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
UINT16 FpuCw;
EFI_TEST_ASSERTION AssertionType;
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// record assertion for the returned FPU control word.
//
Status = GetFpuControlWord(&FpuCw);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"Execution Mode - Could NOT get FPU control word",
L"%a:%d:Status - %r",
__FILE__,
__LINE__,
Status
);
return Status;
}
if ((sizeof(UINTN) == 4 && FpuCw == FPU_CONTROL_WORD_VALUE_IA32) ||
(sizeof(UINTN) == 8 && FpuCw == FPU_CONTROL_WORD_VALUE_X64)) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gBasicTestAssertionGuid001,
L"EFI_EXE_MODE - Get FPU control word",
L"%a:%d:FPU control word got %x",
__FILE__,
__LINE__,
FpuCw
);
return EFI_SUCCESS;
}
示例14: OpenIniFile
EFI_STATUS
PlatformSpecificElementsBbTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
/*++
Routine Description:
Check the platform specific elements, which defined in the EFI spec 1.10,
section 2.6.2.
--*/
{
EFI_STATUS Status;
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_TEST_PROFILE_LIBRARY_PROTOCOL *ProfileLib;
EFI_INI_FILE_HANDLE IniFile;
//
// Locate the standard test library protocol
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Locate the test profile library protocol
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiTestProfileLibraryGuid,
&ProfileLib
);
if (EFI_ERROR (Status)) {
return Status;
}
//
// Open the INI file
//
Status = OpenIniFile (
ProfileLib,
EFI_COMPLIANT_BB_TEST_INI_PATH,
EFI_COMPLIANT_BB_TEST_INI_FILE,
&IniFile
);
if (EFI_ERROR (Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_WARNING,
gTestGenericFailureGuid,
L"EFI Compliant - Cannot open INI file",
L"%a:%d",
__FILE__,
(UINTN)__LINE__
);
return Status;
}
//
// Check the console protocols
//
CheckConsoleProtocols (StandardLib, IniFile);
//
// Check the graphical console protocols
//
CheckGraphicalConsoleProtocols (StandardLib, IniFile);
//
// Check the pointer protocols
//
CheckPointerProtocols (StandardLib, IniFile);
//
// Check the boot from disk protocols
//
CheckBootFromDiskProtocols (StandardLib, IniFile);
//
// Check the boot from network protocols
//
CheckBootFromNetworkProtocols (StandardLib, IniFile);
//
// Check the UART support protocols
//
CheckUartProtocols (StandardLib, IniFile);
//
// Check the PCI support protocols
//.........这里部分代码省略.........
示例15: CopyUnicodeString
//
// TDS 4.1.4
//
EFI_STATUS
BBTestStrUprFunctionAutoTest (
IN EFI_BB_TEST_PROTOCOL *This,
IN VOID *ClientInterface,
IN EFI_TEST_LEVEL TestLevel,
IN EFI_HANDLE SupportHandle
)
{
EFI_STANDARD_TEST_LIBRARY_PROTOCOL *StandardLib;
EFI_STATUS Status;
EFI_UNICODE_COLLATION2_PROTOCOL *UnicodeCollation;
UINTN Index;
EFI_TEST_ASSERTION AssertionType;
//
// Test Data
//
CHAR16 *TestData[] ={
L"\x21\x22\x31\x32\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4A\x4B\x4C\x4D\x4E\x4F\x50\x51\x52\x53\x54\x55\x56\x57\x58\x59\x5Ax61\x62\x7D\x7E",
L"\x30\x50[abcdzyxw!)(@#*]\x40\x20\x30\x50\ab\x40\x20",
L"\x30\x50[A-D]\x40\x20\x30\x50f\x40\x20",
L""
};
CHAR16 TestDataSav[MAX_SIZE_OF_STRING + 1];
//
// Get the Standard Library Interface
//
Status = gtBS->HandleProtocol (
SupportHandle,
&gEfiStandardTestLibraryGuid,
&StandardLib
);
if (EFI_ERROR(Status)) {
StandardLib->RecordAssertion (
StandardLib,
EFI_TEST_ASSERTION_FAILED,
gTestGenericFailureGuid,
L"BS.HandleProtocol - Handle standard test library",
L"%a:%d:Status - %r",
__FILE__,
(UINTN)__LINE__,
Status
);
return Status;
}
UnicodeCollation = (EFI_UNICODE_COLLATION2_PROTOCOL *)ClientInterface;
for (Index = 0; Index < sizeof (TestData) / sizeof (CHAR16*); Index++) {
//
// Backup current test data
//
CopyUnicodeString (TestDataSav, TestData[Index]);
//
// For each test data, test the StrUpr functionality.
//
UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);
if (CheckStrUpr (TestDataSav, TestData[Index])) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gUnicodeCollationFunctionTestAssertionGuid005,
L"EFI_UNICODE_COLLATION_PROTOCOL.StrUpr - Verification of StrUpr interface",
L"%a:%d: Original=%s-- ToUpper=%s",
__FILE__,
(UINTN)__LINE__,
TestDataSav,
TestData[Index]
);
CopyUnicodeString (TestDataSav, TestData[Index]);
UnicodeCollation->StrLwr (UnicodeCollation, TestData[Index]);
UnicodeCollation->StrUpr (UnicodeCollation, TestData[Index]);
if (CheckStrEql (TestDataSav, TestData[Index])) {
AssertionType = EFI_TEST_ASSERTION_PASSED;
} else {
AssertionType = EFI_TEST_ASSERTION_FAILED;
}
StandardLib->RecordAssertion (
StandardLib,
AssertionType,
gUnicodeCollationFunctionTestAssertionGuid006,
//.........这里部分代码省略.........