From 39f0a0bc0d05fd6da2731c883dde50a7d796ec82 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Tue, 9 Apr 2024 23:00:08 +0200 Subject: [PATCH] Basic testing infrastructure --- .idea/codeStyles/Project.xml | 141 ++++++++++++------ .idea/editor.xml | 103 +++++++++++++ CMakeLists.txt | 4 + ficus-toolchain/build-newlib.sh | 2 +- .../newlib-4.4.0.20231231/.idea/workspace.xml | 136 ++++++++++++++++- src/CMakeLists.txt | 12 +- src/arch/x86/boot.cpp | 4 +- src/arch/x86/gdt.cpp | 4 +- src/arch/x86/idt.cpp | 4 +- src/arch/x86/kmain.cpp | 4 +- src/arch/x86/kmem.cpp | 2 +- src/arch/x86/limine_modules.cpp | 2 +- src/arch/x86/memman.cpp | 4 +- src/arch/x86/misc.cpp | 5 +- src/arch/x86/{misc.hpp => misc.h} | 11 +- src/arch/x86/paging.cpp | 4 +- src/arch/x86/serial.cpp | 5 +- src/arch/x86/{serial.hpp => serial.h} | 10 +- src/arch/x86/syscalls.cpp | 4 +- src/arch/x86/task.cpp | 4 +- src/iso/limine.cfg | 2 + src/kernel/CMakeLists.txt | 1 + src/kernel/LockGuard.hpp | 2 +- src/kernel/Spinlock.hpp | 2 +- src/kernel/{templates => }/TestTemplates.cpp | 2 +- src/kernel/{templates => }/TestTemplates.hpp | 0 src/kernel/VMA.cpp | 2 +- src/kernel/{asserts.hpp => assert.h} | 4 +- src/kernel/asserts.cpp | 2 +- src/kernel/cppsupport.cpp | 4 +- src/kernel/mutex.cpp | 2 +- src/kernel/templates/CMakeLists.txt | 8 +- src/kernel/templates/CircularBuffer.hpp | 2 +- src/kernel/templates/List.hpp | 2 +- src/kernel/templates/PointersCollection.hpp | 3 +- src/kernel/templates/SkipList.hpp | 5 +- src/kernel/templates/String.hpp | 18 +-- src/kernel/templates/Vector.hpp | 13 +- src/kernel/templates/stl/stl_alloc.h | 4 +- src/kernel/templates/stl/stl_config.h | 2 +- src/test/init.c | 2 + src/uapi/CMakeLists.txt | 2 +- src/unit-tests/CMakeLists.txt | 13 ++ src/unit-tests/templates/CMakeLists.txt | 12 ++ src/unit-tests/templates/SkipListTest.cpp | 69 +++++++++ 45 files changed, 529 insertions(+), 114 deletions(-) create mode 100644 .idea/editor.xml rename src/arch/x86/{misc.hpp => misc.h} (95%) rename src/arch/x86/{serial.hpp => serial.h} (80%) rename src/kernel/{templates => }/TestTemplates.cpp (99%) rename src/kernel/{templates => }/TestTemplates.hpp (100%) rename src/kernel/{asserts.hpp => assert.h} (89%) create mode 100644 src/unit-tests/CMakeLists.txt create mode 100644 src/unit-tests/templates/CMakeLists.txt create mode 100644 src/unit-tests/templates/SkipListTest.cpp diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml index de855dd11..9d9682f88 100644 --- a/.idea/codeStyles/Project.xml +++ b/.idea/codeStyles/Project.xml @@ -6,48 +6,105 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + diff --git a/.idea/editor.xml b/.idea/editor.xml new file mode 100644 index 000000000..7642db2b5 --- /dev/null +++ b/.idea/editor.xml @@ -0,0 +1,103 @@ + + + + + \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 64d155541..dd89e5ef0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,4 +5,8 @@ project(ficus C CXX ASM_NASM) set(CMAKE_CXX_STANDARD 17) set(CMAKE_C_STANDARD 11) +if (TEST_MODE) + enable_testing() +endif () + add_subdirectory(./src/) diff --git a/ficus-toolchain/build-newlib.sh b/ficus-toolchain/build-newlib.sh index a34579058..0421dc7a3 100755 --- a/ficus-toolchain/build-newlib.sh +++ b/ficus-toolchain/build-newlib.sh @@ -14,7 +14,7 @@ cd newlib # rm -rf build mkdir -p build cd build -../newlib-4.4.0.20231231/configure --enable-newlib-supplied-syscalls --prefix=/usr --target=$TARGET +#../newlib-4.4.0.20231231/configure --enable-newlib-supplied-syscalls --prefix=/usr --target=$TARGET make -j$(nproc) all make DESTDIR="$FICUS_ROOT/sysroot" install cp -r "$FICUS_ROOT/sysroot/usr"/x86_64-ficus/* "$FICUS_ROOT/sysroot/usr" diff --git a/ficus-toolchain/newlib/newlib-4.4.0.20231231/.idea/workspace.xml b/ficus-toolchain/newlib/newlib-4.4.0.20231231/.idea/workspace.xml index 9657981e2..1e95f8be8 100644 --- a/ficus-toolchain/newlib/newlib-4.4.0.20231231/.idea/workspace.xml +++ b/ficus-toolchain/newlib/newlib-4.4.0.20231231/.idea/workspace.xml @@ -4143,8 +4143,51 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +