aboutsummaryrefslogtreecommitdiff
path: root/kernel/include
diff options
context:
space:
mode:
authorLukas Oesch <lukas.oesch@ost.ch>2026-04-15 23:42:14 +0200
committerLukas Oesch <lukas.oesch@ost.ch>2026-04-15 23:42:14 +0200
commit888471f23e7f07749b4bc9a2fa70992062b6e4d0 (patch)
tree9503b5be4194e5c4f7d5cbfb06c1881d379b65ef /kernel/include
parent1113e812359a66591b0854a9f723ab8cd8b09274 (diff)
parent69068165f49ca204025410ab02546318997edaa3 (diff)
downloadteachos-888471f23e7f07749b4bc9a2fa70992062b6e4d0.tar.xz
teachos-888471f23e7f07749b4bc9a2fa70992062b6e4d0.zip
Merge branch 'fmorgner/develop-BA-FS26/kernel-bht-speedup' into 'develop-BA-FS26'
Improve build-host test speed using memory mapping See merge request teachos/kernel!25
Diffstat (limited to 'kernel/include')
-rw-r--r--kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp32
-rw-r--r--kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp9
2 files changed, 28 insertions, 13 deletions
diff --git a/kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp b/kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp
index ee658e2..4b49684 100644
--- a/kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp
+++ b/kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp
@@ -3,11 +3,10 @@
#include "kapi/boot_module/boot_module_registry.hpp"
-#include <kstd/string>
-#include <kstd/vector>
-
#include <cstddef>
#include <filesystem>
+#include <string>
+#include <vector>
namespace kernel::tests::filesystem
{
@@ -16,16 +15,33 @@ namespace kernel::tests::filesystem
~storage_boot_module_fixture();
auto setup_modules(std::size_t module_count, std::size_t module_size = 4096) -> void;
- auto setup_modules_from_img(kstd::vector<kstd::string> const & module_names,
- kstd::vector<std::filesystem::path> const & img_paths) -> void;
+ auto setup_modules_from_img(std::vector<std::string> const & module_names,
+ std::vector<std::filesystem::path> const & img_paths) -> void;
protected:
+ struct mapped_image
+ {
+ explicit mapped_image(std::filesystem::path path);
+ ~mapped_image();
+
+ mapped_image(mapped_image const &) = delete;
+ auto operator=(mapped_image const &) -> mapped_image & = delete;
+
+ mapped_image(mapped_image &&) noexcept;
+ auto operator=(mapped_image &&) noexcept -> mapped_image &;
+
+ int file_descriptor;
+ std::byte * mapping;
+ std::size_t size;
+ };
+
kapi::boot_modules::boot_module_registry m_registry{};
- kstd::vector<kstd::string> m_module_names{};
- kstd::vector<kstd::vector<std::byte>> m_module_data{};
+ std::vector<std::string> m_module_names{};
+ std::vector<std::vector<std::byte>> m_module_data{};
+ std::vector<mapped_image> m_mapped_images{};
private:
- auto setup_module_from_img(kstd::string const & module_name, std::filesystem::path const & img_path) -> void;
+ auto setup_module_from_img(std::string const & module_name, std::filesystem::path const & img_path) -> void;
};
} // namespace kernel::tests::filesystem
diff --git a/kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp b/kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp
index 98012b0..bd1c289 100644
--- a/kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp
+++ b/kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp
@@ -3,11 +3,10 @@
#include "kernel/test_support/filesystem/storage_boot_module_fixture.hpp"
-#include <kstd/string>
-#include <kstd/vector>
-
#include <cstddef>
#include <filesystem>
+#include <string>
+#include <vector>
namespace kernel::tests::filesystem
{
@@ -16,8 +15,8 @@ namespace kernel::tests::filesystem
~storage_boot_module_vfs_fixture();
auto setup_modules_and_init_vfs(std::size_t module_count, std::size_t module_size = 4096) -> void;
- auto setup_modules_from_img_and_init_vfs(kstd::vector<kstd::string> const & module_names,
- kstd::vector<std::filesystem::path> const & img_paths) -> void;
+ auto setup_modules_from_img_and_init_vfs(std::vector<std::string> const & module_names,
+ std::vector<std::filesystem::path> const & img_paths) -> void;
};
} // namespace kernel::tests::filesystem