Tools for testing different parts of the kernel.
More...
#include <kernel/tests.h>
#include <lib/kstring.h>
#include <arch/x86_64/gdt.h>
#include <kernel/kprintf.h>
#include <kernel/tools.h>
#include <limits.h>
Go to the source code of this file.
|
| bool | test_memcpy (uint64_t dest, uint64_t src) |
| | Tests the memcpy utility.
|
| bool | test_memmove (uint64_t dest, uint64_t src) |
| | Tests the memmove utility.
|
| bool | test_memset (uint64_t dest, int value) |
| | Tests the memset utility.
|
| bool | test_memcmp (uint64_t a, 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.
|
Tools for testing different parts of the kernel.
- Author
- Matheus Boscariol
- Since
- 31/10/2026
- Copyright
- (c) 2026 Matheus Boscariol. Licensed under GNU AGPL-3.0.
Definition in file tests.c.
◆ 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.
◆ 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.
◆ 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.
◆ test_memcmp()
| bool test_memcmp |
( |
uint64_t | dest, |
|
|
uint64_t | b, |
|
|
int | expected_value ) |
Tests the memcmp utility.
- Parameters
-
| dest | The pointer to the first piece of data to compare |
| b | The pointer to the second piece of data to compare |
| expected_value | The value expected to result |
- Returns
- If the result of memcmp matched the expected value
Definition at line 57 of file tests.c.
◆ test_memcpy()
| bool test_memcpy |
( |
uint64_t | dest, |
|
|
uint64_t | b ) |
Tests the memcpy utility.
- Parameters
-
| dest | The destination data pointer |
| b | The source data pointer |
- Returns
- If memcpy copied the correct value and at the right address
Definition at line 18 of file tests.c.
◆ test_memmove()
| bool test_memmove |
( |
uint64_t | dest, |
|
|
uint64_t | b ) |
Tests the memmove utility.
- Parameters
-
| dest | The destination data pointer |
| b | The source data pointer |
- Returns
- If memmove copied the correct value and at the right address
Definition at line 28 of file tests.c.
◆ test_memset()
| bool test_memset |
( |
uint64_t | dest, |
|
|
int | value ) |
Tests the memset utility.
- Parameters
-
| dest | The destination data pointer |
| value | The source data pointer |
- Returns
- If memset set all the bytes to the correct value
Definition at line 38 of file tests.c.
◆ 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
-
| str | The string to check the length of |
| expected_value | The expected string length |
- Returns
- Did the length match the expected length
Definition at line 67 of file tests.c.