LumaOS  v0.1.116
An experimental x86-64 OS
Loading...
Searching...
No Matches
tests.h File Reference

Tools for testing different parts of the kernel. More...

#include <lib/kstring.h>
#include <arch/x86_64/gdt.h>
#include <kernel/kprintf.h>
#include <kernel/tools.h>
#include <limits.h>
Include dependency graph for tests.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool test_memcpy (uint64_t dest, uint64_t b)
 Tests the memcpy utility.
bool test_memmove (uint64_t dest, uint64_t b)
 Tests the memmove utility.
bool test_memset (uint64_t dest, int value)
 Tests the memset utility.
bool test_memcmp (uint64_t dest, uint64_t b, int expected_value)
 Tests the memcmp utility.
bool test_strlen (const char *str, uint8_t expected_value)
 Tests the strlen utility.
bool test_access_byte (void)
 Tests the access byte utility for the gdt.
bool test_flag_byte (void)
 Tests the flag byte utility for the gdt.
void test_kprintf_values (void)
 Prints test data and the expected values for visual verification of kprintf.
void test_de_fault (void)
 Causes a Division error for handler testing.
void test_pf_read_fault (void)
 Causes a Page fault (read) for handler testing.
void test_pf_write_fault (void)
 Causes a Page fault (write) for handler testing.
void test_bp_fault (void)
 Triggers a Breakpoint for handler testing.

Detailed Description

Tools for testing different parts of the kernel.

Author
Matheus Boscariol
Since
31/10/2026

Definition in file tests.h.

Function Documentation

◆ test_access_byte()

bool test_access_byte ( void )

Tests the access byte utility for the gdt.

Returns
Does the requested access byte match the expected one

Definition at line 74 of file tests.c.

Here is the call graph for this function:

◆ test_bp_fault()

void test_bp_fault ( void )

Triggers a Breakpoint for handler testing.

Definition at line 131 of file tests.c.

◆ test_de_fault()

void test_de_fault ( void )

Causes a Division error for handler testing.

Definition at line 114 of file tests.c.

◆ test_flag_byte()

bool test_flag_byte ( void )

Tests the flag byte utility for the gdt.

Returns
Does the requested flag byte match the expected one

Definition at line 81 of file tests.c.

Here is the call graph for this function:

◆ test_kprintf_values()

void test_kprintf_values ( void )

Prints test data and the expected values for visual verification of kprintf.

Definition at line 90 of file tests.c.

Here is the call graph for this function:

◆ test_memcmp()

bool test_memcmp ( uint64_t dest,
uint64_t b,
int expected_value )

Tests the memcmp utility.

Parameters
destThe pointer to the first piece of data to compare
bThe pointer to the second piece of data to compare
expected_valueThe value expected to result
Returns
If the result of memcmp matched the expected value

Definition at line 57 of file tests.c.

Here is the call graph for this function:

◆ test_memcpy()

bool test_memcpy ( uint64_t dest,
uint64_t b )

Tests the memcpy utility.

Parameters
destThe destination data pointer
bThe source data pointer
Returns
If memcpy copied the correct value and at the right address

Definition at line 18 of file tests.c.

Here is the call graph for this function:

◆ test_memmove()

bool test_memmove ( uint64_t dest,
uint64_t b )

Tests the memmove utility.

Parameters
destThe destination data pointer
bThe source data pointer
Returns
If memmove copied the correct value and at the right address

Definition at line 28 of file tests.c.

Here is the call graph for this function:

◆ test_memset()

bool test_memset ( uint64_t dest,
int value )

Tests the memset utility.

Parameters
destThe destination data pointer
valueThe source data pointer
Returns
If memset set all the bytes to the correct value

Definition at line 38 of file tests.c.

Here is the call graph for this function:

◆ test_pf_read_fault()

void test_pf_read_fault ( void )

Causes a Page fault (read) for handler testing.

Definition at line 119 of file tests.c.

◆ test_pf_write_fault()

void test_pf_write_fault ( void )

Causes a Page fault (write) for handler testing.

Definition at line 123 of file tests.c.

◆ test_strlen()

bool test_strlen ( const char * str,
uint8_t expected_value )

Tests the strlen utility.

Parameters
strThe string to check the length of
expected_valueThe expected string length
Returns
Did the length match the expected length

Definition at line 67 of file tests.c.

Here is the call graph for this function: