diff options
Diffstat (limited to 'kernel/include')
| -rw-r--r-- | kernel/include/kernel/test_support/filesystem/storage_boot_module_fixture.hpp | 32 | ||||
| -rw-r--r-- | kernel/include/kernel/test_support/filesystem/storage_boot_module_vfs_fixture.hpp | 9 |
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 |
