TianoCore EDK2 master
Loading...
Searching...
No Matches
CpuPageTableLibUnitTest.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <stddef.h>
#include <setjmp.h>
#include <cmocka.h>
#include <time.h>
#include <Uefi.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/UnitTestLib.h>
#include <Library/CpuPageTableLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/UnitTestHostBaseLib.h>
#include <Library/BaseCryptLib.h>
#include "../CpuPageTable.h"

Go to the source code of this file.

Data Structures

struct  CPU_PAGE_TABLE_LIB_RANDOM_TEST_CONTEXT
 

Macros

#define UNIT_TEST_APP_NAME   "Cpu Page Table Lib Unit Tests"
 
#define UNIT_TEST_APP_VERSION   "1.0"
 
#define ONLY_ONE_ONE_MAPPING   0x00000001
 
#define MANUAL_CHANGE_PAGE_TABLE   0x00000002
 
#define USE_RANDOM_ARRAY   0x00000004
 

Functions

UNIT_TEST_STATUS EFIAPI TestCaseforRandomTest (IN UNIT_TEST_CONTEXT Context)
 
VOID InitGlobalData (UINTN MemorySpace)
 
UNIT_TEST_STATUS IsPageTableValid (IN UINTN PageTable, IN PAGING_MODE PagingMode)
 
UINT64 GetMaxAddress (IN PAGING_MODE Mode)
 

Detailed Description

Copyright (c) 2022, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CpuPageTableLibUnitTest.h.

Macro Definition Documentation

◆ MANUAL_CHANGE_PAGE_TABLE

#define MANUAL_CHANGE_PAGE_TABLE   0x00000002

Definition at line 46 of file CpuPageTableLibUnitTest.h.

◆ ONLY_ONE_ONE_MAPPING

#define ONLY_ONE_ONE_MAPPING   0x00000001

Definition at line 41 of file CpuPageTableLibUnitTest.h.

◆ UNIT_TEST_APP_NAME

#define UNIT_TEST_APP_NAME   "Cpu Page Table Lib Unit Tests"

Definition at line 31 of file CpuPageTableLibUnitTest.h.

◆ UNIT_TEST_APP_VERSION

#define UNIT_TEST_APP_VERSION   "1.0"

Definition at line 32 of file CpuPageTableLibUnitTest.h.

◆ USE_RANDOM_ARRAY

#define USE_RANDOM_ARRAY   0x00000004

Definition at line 51 of file CpuPageTableLibUnitTest.h.

Function Documentation

◆ GetMaxAddress()

UINT64 GetMaxAddress ( IN PAGING_MODE  PagingMode)

Get max physical adrress supported by specific page mode

Parameters
[in]ModeThe paging mode.
Return values
maxaddress.

Get max physical address supported by specific page mode

Parameters
[in]PagingModeThe paging mode.
Return values
MaxAddress.

Definition at line 306 of file TestHelper.c.

◆ InitGlobalData()

VOID InitGlobalData ( UINTN  MemorySpace)

Init global data

Parameters
[in]MemorySpaceMemory space

Init global data.

Parameters
[in]MemorySpaceMemory space

Definition at line 31 of file TestHelper.c.

◆ IsPageTableValid()

UNIT_TEST_STATUS IsPageTableValid ( IN UINTN  PageTable,
IN PAGING_MODE  PagingMode 
)

Check if the Page table is valid

Parameters
[in]PageTableThe pointer to the page table.
[in]PagingModeThe paging mode.
Return values
UNIT_TEST_PASSEDIt is a valid Page Table

Definition at line 170 of file TestHelper.c.

◆ TestCaseforRandomTest()

UNIT_TEST_STATUS EFIAPI TestCaseforRandomTest ( IN UNIT_TEST_CONTEXT  Context)

Random Test

Parameters
[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.
Return values
UNIT_TEST_PASSEDThe Unit test has completed and the test case was successful.
UNIT_TEST_ERROR_TEST_FAILEDA test case assertion has failed.

Definition at line 1037 of file RandomTest.c.