Add test "arch_i386_paging"

This commit is contained in:
Alex Kotov 2021-12-19 08:40:23 +05:00
parent f659e2af97
commit fbfd178f59
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
3 changed files with 38 additions and 0 deletions

1
.gitignore vendored
View File

@ -44,6 +44,7 @@
/tests/multiboot2_print1
/tests/multiboot2_print2
/tests/test_arch_i386_paging
/tests/test_cmdline
/tests/test_elf
/tests/test_itoa

View File

@ -30,6 +30,7 @@ if ARCH_I386
libkernaux_a_SOURCES += src/arch/i386/asm.S
endif
libkernaux_a_SOURCES += src/arch/i386/paging.c
TESTS += tests/test_arch_i386_paging
endif
if WITH_ARCH_X86_64
@ -111,6 +112,10 @@ examples_units_human_SOURCES = \
$(libkernaux_a_SOURCES) \
examples/units_human.c
tests_test_arch_i386_paging_SOURCES = \
$(libkernaux_a_SOURCES) \
tests/test_arch_i386_paging.c
tests_multiboot2_print1_SOURCES = \
$(libkernaux_a_SOURCES) \
tests/multiboot2_print1.c

View File

@ -0,0 +1,32 @@
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <kernaux/arch/i386.h>
// TODO: There are some static asserts just for example.
__attribute__((unused))
static const int assert0[
sizeof(struct KernAux_Arch_I386_PDE) == sizeof(uint32_t) ? 1 : -1
];
__attribute__((unused))
static const int assert1[
sizeof(struct KernAux_Arch_I386_PTE) == sizeof(uint32_t) ? 1 : -1
];
__attribute__((unused))
static const int assert1[
sizeof(struct KernAux_Arch_I386_PageDir) == 1024 * sizeof(uint32_t) ? 1 : -1
];
__attribute__((unused))
static const int assert1[
sizeof(struct KernAux_Arch_I386_PageTable) == 1024 * sizeof(uint32_t) ? 1 : -1
];
int main()
{
return 0;
}