From 499ece577c7f8351044e6c17dbd69a0ae16bf518 Mon Sep 17 00:00:00 2001 From: "Maxim [maxirmx] Samsonov" Date: Sat, 19 Oct 2024 20:37:53 +0300 Subject: [PATCH] tests second fs --- .github/workflows/lint.yml | 14 +- .github/workflows/macos.yml | 1 + CMakeLists.txt | 51 ++++-- include/tebako-io-root.h | 5 + include/tebako-io.h | 5 + .../{tebako-dft.h => tebako-memfs-table.h} | 7 +- include/{tebako-dfs.h => tebako-memfs.h} | 6 +- .../{tebako-mnt.h => tebako-mount-table.h} | 0 include/tebako-pch-pp.h | 1 + src/tebako-cmdline-helpers.cpp | 2 +- src/tebako-dfs.cpp | 31 +++- src/tebako-dirent.cpp | 2 +- src/tebako-fd.cpp | 2 +- src/tebako-io-root.cpp | 72 ++++++-- ...{tebako-dft.cpp => tebako-memfs-table.cpp} | 38 ++-- ...{tebako-mnt.cpp => tebako-mount-table.cpp} | 2 +- tests/resources/tebako-fs.cpp.in | 4 + tests/tebako-fs.h | 1 + tests/tests-dft.cpp | 130 -------------- tests/tests-fs-load.cpp | 44 ++--- tests/tests-fs-load2.cpp | 166 ++++++++++++++++++ tests/tests-memfs-table.cpp | 119 +++++++++++++ .../{tests-mnt.cpp => tests-mount-table.cpp} | 2 +- tests/tests-mount.cpp | 2 +- tests/tests-process-mps.cpp | 4 +- 25 files changed, 485 insertions(+), 226 deletions(-) rename include/{tebako-dft.h => tebako-memfs-table.h} (88%) rename include/{tebako-dfs.h => tebako-memfs.h} (95%) rename include/{tebako-mnt.h => tebako-mount-table.h} (100%) rename src/{tebako-dft.cpp => tebako-memfs-table.cpp} (76%) rename src/{tebako-mnt.cpp => tebako-mount-table.cpp} (98%) delete mode 100644 tests/tests-dft.cpp create mode 100644 tests/tests-fs-load2.cpp create mode 100644 tests/tests-memfs-table.cpp rename tests/{tests-mnt.cpp => tests-mount-table.cpp} (99%) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1976fc6a..0089d79a 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -63,10 +63,10 @@ jobs: source: '.' extensions: 'h,cpp,c' clangFormatVersion: 14 -# inplace: True -# - name: Commit changes -# uses: EndBug/add-and-commit@v9 -# with: -# message: clang-format fixes -# committer_name: GitHub Actions -# committer_email: actions@github.com + inplace: True + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + message: clang-format fixes + committer_name: GitHub Actions + committer_email: actions@github.com diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a2764dc7..2dac69d3 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -143,6 +143,7 @@ jobs: path: | ${{github.workspace}}/build/wr-bin ${{github.workspace}}/build/wr-tests + ${{github.workspace}}/build/fs2.bin test-on-macos-13-and-14: # The run on MacOS 14 is the amd64 on arm64 test diff --git a/CMakeLists.txt b/CMakeLists.txt index 15641da9..36b2b942 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -813,10 +813,10 @@ add_library(dwarfs-wr STATIC "src/tebako-io-helpers.cpp" "src/tebako-io-root.cpp" "src/tebako-kfd.cpp" - "src/tebako-mnt.cpp" + "src/tebako-mount-table.cpp" "src/tebako-mfs.cpp" "src/tebako-dfs.cpp" - "src/tebako-dft.cpp" + "src/tebako-memfs-table.cpp" "src/tebako-fd.cpp" "src/tebako-dirent.cpp" "include/tebako-cmdline-helpers.h" @@ -829,9 +829,9 @@ add_library(dwarfs-wr STATIC "include/tebako-io-inner.h" "include/tebako-io-root.h" "include/tebako-kfd.h" - "include/tebako-dfs.h" - "include/tebako-dft.h" - "include/tebako-mnt.h" + "include/tebako-memfs.h" + "include/tebako-memfs-table.h" + "include/tebako-mount-table.h" "include/tebako-mfs.h" "include/tebako-pch.h" "include/tebako-pch-pp.h" @@ -938,11 +938,21 @@ if(WITH_TESTS) BYPRODUCTS ${DATA_BIN_FILE_2} ) - add_dependencies(PACKAGED_FILESYSTEM_STEP_1 empty) + add_dependencies(PACKAGED_FILESYSTEM_STEP_1 empty ${DWARFS_PRJ}) add_dependencies(dwarfs-wr PACKAGED_FILESYSTEM_STEP_1) set(TESTS_OUTSIDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/test_files") + set(TESTS_THE_OTHER_MEMFS_IMAGE "${CMAKE_CURRENT_BINARY_DIR}/fs2.bin") + +# feat: exectable application stub +# add_executable(wr-mount "tests/tebako-fs2.cpp") +# if(WIN32) +# set(TESTS_THE_OTHER_MEMFS_IMAGE "${CMAKE_CURRENT_BINARY_DIR}/wr-mount.exe") +# else() +# set(TESTS_THE_OTHER_MEMFS_IMAGE "${CMAKE_CURRENT_BINARY_DIR}/wr-mount") +# endif() + if (WITH_LINK_TESTS) add_custom_target(PACKAGED_FILESYSTEM_STEP_2 ALL COMMAND ${CMAKE_COMMAND} -E chdir ${DATA_TEST_DIR} rm -rf h-link-to-file-2 s-link-to-file-1 s-link-to-dir-1 s-link-outside-of-memfs s-dir-outside-of-memfs @@ -1001,11 +1011,12 @@ if(WITH_TESTS) @ONLY ) - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/tebako-fs2.cpp.in - ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp - @ONLY - ) +# feat: exectable application stub +# configure_file( +# ${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/tebako-fs2.cpp.in +# ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp +# @ONLY +# ) if(IS_WINDOWS) add_custom_command( @@ -1013,11 +1024,12 @@ if(WITH_TESTS) COMMAND ${DEPS}/bin/incbin.exe ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs.cpp -o ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs0.c DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs.cpp ${DATA_BIN_FILE} ${INCBIN_PRJ} ) - add_custom_command( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs02.c - COMMAND ${DEPS}/bin/incbin.exe ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp -o ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs02.c - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp ${DATA_BIN_FILE_2} ${INCBIN_PRJ} - ) +# feat: exectable application stub +# add_custom_command( +# OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs02.c +# COMMAND ${DEPS}/bin/incbin.exe ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp -o ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs02.c +# DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/tests/tebako-fs2.cpp ${DATA_BIN_FILE_2} ${INCBIN_PRJ} +# ) endif(IS_WINDOWS) function(ADD_DWARFS_LIBRARY NAME PRJ APP_NM) @@ -1150,13 +1162,14 @@ else(IS_WINDOWS) ) add_dependencies(wr-tests PACKAGED_FILESYSTEM_STEP_3) - add_executable(wr-mount "tests/tebako-fs2.cpp") - add_dependencies(wr-mount PACKAGED_FILESYSTEM_STEP_1) +# feat: exectable application stub +# add_dependencies(wr-mount PACKAGED_FILESYSTEM_STEP_1) if(IS_WINDOWS) target_sources(wr-bin PUBLIC "tests/tebako-fs0.c" ) target_sources(wr-tests PUBLIC "tests/tebako-fs0.c") - target_sources(wr-mount PUBLIC "tests/tebako-fs02.c") +# feat: exectable application stub +# target_sources(wr-mount PUBLIC "tests/tebako-fs02.c") endif(IS_WINDOWS) if(RB_W32) diff --git a/include/tebako-io-root.h b/include/tebako-io-root.h index 90bcc2ba..5fd76ca2 100644 --- a/include/tebako-io-root.h +++ b/include/tebako-io-root.h @@ -39,6 +39,11 @@ int mount_root_memfs(const void* data, const char* decompress_ratio, const char* image_offset); +int mount_memfs(const void* data, + const unsigned int size, + const char* image_offset, + const char* path); + void unmount_root_memfs(void); int dwarfs_access(const std::string&, int amode, uid_t uid, gid_t gid, std::string& lnk) noexcept; diff --git a/include/tebako-io.h b/include/tebako-io.h index e64faebf..47fa8b94 100644 --- a/include/tebako-io.h +++ b/include/tebako-io.h @@ -53,6 +53,11 @@ int mount_root_memfs(const void* data, const char* decompress_ratio, const char* image_offset); +int mount_memfs(const void* data, + const unsigned int size, + const char* image_offset, + const char* path); + void unmount_root_memfs(void); char* tebako_getcwd(char* buf, size_t size); diff --git a/include/tebako-dft.h b/include/tebako-memfs-table.h similarity index 88% rename from include/tebako-dft.h rename to include/tebako-memfs-table.h index b53119e9..4f24e43a 100644 --- a/include/tebako-dft.h +++ b/include/tebako-memfs-table.h @@ -31,7 +31,7 @@ namespace tebako { -typedef std::map tebako_memfs_table; +typedef std::map> tebako_memfs_table; class sync_tebako_memfs_table { private: @@ -43,8 +43,9 @@ class sync_tebako_memfs_table { bool check(uint32_t index); void clear(void); void erase(uint32_t index); - memfs* get(uint32_t index); - bool insert(uint32_t index, memfs* fs); + std::shared_ptr get(uint32_t index); + bool insert(uint32_t index, std::shared_ptr fs); + uint32_t insert_auto(std::shared_ptr fs); }; diff --git a/include/tebako-dfs.h b/include/tebako-memfs.h similarity index 95% rename from include/tebako-dfs.h rename to include/tebako-memfs.h index eb85a78e..92c8183a 100644 --- a/include/tebako-dfs.h +++ b/include/tebako-memfs.h @@ -58,7 +58,7 @@ class memfs { private: const void* data; const unsigned int size; - uint32_t dwarfs_root; + uint32_t dwarfs_root_inode; dwarfs::filesystem_options fsopts; dwarfs::filesystem_v2 fs; @@ -79,6 +79,8 @@ class memfs { int load(const char* image_offset = "auto"); void set_image_offset_str(const char* image_offset = "auto"); + uint32_t get_root_inode(void) { return dwarfs_root_inode; } + void set_root_inode(uint32_t df_root_inode) { dwarfs_root_inode = df_root_inode; } int access(const std::string& path, int amode, uid_t uid, gid_t gid, std::string& lnk) noexcept; int inode_access(uint32_t inode, int amode, uid_t uid, gid_t gid) noexcept; @@ -105,7 +107,7 @@ class memfs { } int relative_stat(const std::string& path, struct stat* st, std::string& lnk, bool follow) noexcept { - return find_inode_abs(dwarfs_root, path, follow, lnk, st); + return find_inode_abs(dwarfs_root_inode, path, follow, lnk, st); } #if defined(TEBAKO_HAS_LSTAT) || defined(RB_W32) || defined(_WIN32) diff --git a/include/tebako-mnt.h b/include/tebako-mount-table.h similarity index 100% rename from include/tebako-mnt.h rename to include/tebako-mount-table.h diff --git a/include/tebako-pch-pp.h b/include/tebako-pch-pp.h index c269ab10..b244858a 100644 --- a/include/tebako-pch-pp.h +++ b/include/tebako-pch-pp.h @@ -35,6 +35,7 @@ #include #include +#include #include #include #include diff --git a/src/tebako-cmdline-helpers.cpp b/src/tebako-cmdline-helpers.cpp index 20a15f0d..a2baba9f 100644 --- a/src/tebako-cmdline-helpers.cpp +++ b/src/tebako-cmdline-helpers.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include diff --git a/src/tebako-dfs.cpp b/src/tebako-dfs.cpp index 4f28e906..c8955167 100644 --- a/src/tebako-dfs.cpp +++ b/src/tebako-dfs.cpp @@ -31,11 +31,12 @@ #include #include #include -#include +#include #include #include #include -#include +#include +#include using namespace dwarfs; @@ -66,7 +67,7 @@ memfs_options& memfs::options() return opts; } -memfs::memfs(const void* dt, const unsigned int sz, uint32_t df_root): data{dt}, size{sz}, dwarfs_root(df_root) +memfs::memfs(const void* dt, const unsigned int sz, uint32_t df_root_inode): data{dt}, size{sz}, dwarfs_root_inode(df_root_inode) { fsopts << options(); } @@ -77,21 +78,21 @@ int memfs::load(const char* image_offset) try { set_image_offset_str(image_offset); - fs = filesystem_v2(logger(), std::make_shared(data, size), fsopts, dwarfs_root, nullptr); + fs = filesystem_v2(logger(), std::make_shared(data, size), fsopts, dwarfs_root_inode, nullptr); LOG_TIMED_INFO << "Filesystem initialized"; } catch (stdfs::filesystem_error const& e) { LOG_ERROR << "Filesystem error: " << e.what(); - return 1; + return -1; } catch (std::exception const& e) { LOG_ERROR << "Error: " << e.what(); - return 1; + return -1; } catch (...) { LOG_ERROR << "Unexpected error"; - return 1; + return -1; } return 0; @@ -195,6 +196,20 @@ int memfs::find_inode(uint32_t start_from, continue; } } + else if (std::holds_alternative(*mount_point)) { + uint32_t index = std::get(*mount_point); + LOG_DEBUG << __func__ << " [ mount point --> memfs:\"" << index << "\" ]"; + auto next_memfs = tebako::sync_tebako_memfs_table::get_tebako_memfs_table().get(index); + if (next_memfs != nullptr) { + auto next_inode = next_memfs->get_root_inode(); + ret = next_memfs->find_inode(next_inode, (++p_iterator)->string(), follow_last, lnk, st); + } + else { + LOG_DEBUG << __func__ << " [ Memfs not mounted ]"; + TEBAKO_SET_LAST_ERROR(ENOENT); + ret = DWARFS_IO_ERROR; + } + } else { LOG_DEBUG << __func__ << " [ Invalid mount point type ]"; TEBAKO_SET_LAST_ERROR(ENOENT); @@ -336,7 +351,7 @@ int memfs::find_inode_root(const std::string& path, bool follow, std::string& ln auto adjusted_path = path.substr(path[TEBAKO_MOUNT_POINT_LENGTH] == '\0' ? TEBAKO_MOUNT_POINT_LENGTH : TEBAKO_MOUNT_POINT_LENGTH + 1); - ret = find_inode_abs(dwarfs_root, adjusted_path, follow, lnk, st); + ret = find_inode_abs(dwarfs_root_inode, adjusted_path, follow, lnk, st); } return ret; } diff --git a/src/tebako-dirent.cpp b/src/tebako-dirent.cpp index cf89c48c..ce1cc137 100644 --- a/src/tebako-dirent.cpp +++ b/src/tebako-dirent.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include using namespace std; diff --git a/src/tebako-fd.cpp b/src/tebako-fd.cpp index df46e03b..48c702bd 100644 --- a/src/tebako-fd.cpp +++ b/src/tebako-fd.cpp @@ -34,7 +34,7 @@ #include #include #include -#include +#include using namespace std; diff --git a/src/tebako-io-root.cpp b/src/tebako-io-root.cpp index ae2b87cc..793dc9df 100644 --- a/src/tebako-io-root.cpp +++ b/src/tebako-io-root.cpp @@ -31,45 +31,52 @@ #include #include #include -#include -#include +#include +#include #include #include #include #include #include -#include +#include using namespace dwarfs; namespace tebako { template -int root_memfs_call(Functor&& fn, Args&&... args) +int memfs_call(Functor&& fn, uint32_t fs_index, Args&&... args) { int ret = DWARFS_IO_ERROR; - auto fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(0); + auto fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(fs_index); if (fs == nullptr) { TEBAKO_SET_LAST_ERROR(ENOENT); } else { - ret = (fs->*fn)(std::forward(args)...); + ret = ((*fs).*fn)(std::forward(args)...); } return ret; } +template +int root_memfs_call(Functor&& fn, Args&&... args) +{ + return memfs_call(fn, 0, std::forward(args)...); +} + template int inode_memfs_call(Functor&& fn, uint32_t inode, Args&&... args) { int ret = DWARFS_IO_ERROR; + uint32_t fs_index = (inode >> 29) & 0x7; // Higher three bits is memfs index - auto fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(0); + auto fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(fs_index); if (fs == nullptr) { TEBAKO_SET_LAST_ERROR(ENOENT); } else { - ret = (fs->*fn)(inode, std::forward(args)...); + ret = ((*fs).*fn)(inode, std::forward(args)...); } return ret; } @@ -84,6 +91,39 @@ static void release_memfs_resources(void) tebako_drop_cwd(); } +static int load_memfs(const void* data, + const unsigned int size, + const char* image_offset) +{ + LOG_PROXY(debug_logger_policy, memfs::logger()); + LOG_INFO << PRJ_NAME << " mount memfs "; + + int index = sync_tebako_memfs_table::get_tebako_memfs_table().insert_auto(std::make_shared(data, size)); + auto fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(index); + if (fs != nullptr && fs->load(image_offset) != 0) + { + TEBAKO_SET_LAST_ERROR(ENOMEM); + sync_tebako_memfs_table::get_tebako_memfs_table().erase(index); + index = -1; + } + return index; +} + +int mount_memfs(const void* data, + const unsigned int size, + const char* image_offset, + const char* path) +{ + bool res = false; + int index = load_memfs(data, size, image_offset); + if (index != -1) + { + int root_index = sync_tebako_memfs_table::get_tebako_memfs_table().get(0)->get_root_inode(); + res = sync_tebako_mount_table::get_tebako_mount_table().insert(root_index, path, index); + } + return res ? index : -1; +} + int mount_root_memfs(const void* data, const unsigned int size, const char* debuglevel, @@ -93,7 +133,7 @@ int mount_root_memfs(const void* data, const char* decompress_ratio, const char* image_offset) { - int ret = 1; + int ret = -1; std::set_terminate([]() { std::cerr << "Unhandled exception" << std::endl; std::abort(); @@ -116,10 +156,10 @@ int mount_root_memfs(const void* data, sync_tebako_memfs_table::get_tebako_memfs_table().erase(0); } - sync_tebako_memfs_table::get_tebako_memfs_table().insert(0, new memfs(data, size)); + sync_tebako_memfs_table::get_tebako_memfs_table().insert(0, std::make_shared(data, size)); fs = sync_tebako_memfs_table::get_tebako_memfs_table().get(0); - ret = fs->load(image_offset); - if (ret == 0) { + if (fs->load(image_offset) == 0) { + ret = 0; tebako_init_cwd(memfs::logger(), memfs::options().debuglevel >= logger::DEBUG); } else { @@ -214,6 +254,14 @@ int mount_root_memfs(const void* data, return tebako::mount_root_memfs(data, size, debuglevel, cachesize, workers, mlock, decompress_ratio, image_offset); } +int mount_memfs(const void* data, + const unsigned int size, + const char* image_offset, + const char* path) +{ + return tebako::mount_memfs(data, size, image_offset, path); +} + void unmount_root_memfs(void) { tebako::unmount_root_memfs(); diff --git a/src/tebako-dft.cpp b/src/tebako-memfs-table.cpp similarity index 76% rename from src/tebako-dft.cpp rename to src/tebako-memfs-table.cpp index 21761397..6b85f7c2 100644 --- a/src/tebako-dft.cpp +++ b/src/tebako-memfs-table.cpp @@ -31,12 +31,12 @@ #include #include #include -#include -#include +#include +#include #include #include #include -#include +#include using namespace dwarfs; @@ -58,9 +58,6 @@ bool sync_tebako_memfs_table::check(uint32_t index) void sync_tebako_memfs_table::clear(void) { auto p_memfs_table = s_tebako_memfs_table.wlock(); - for (auto& pair : *p_memfs_table) { - delete pair.second; - } p_memfs_table->clear(); } @@ -68,12 +65,9 @@ void sync_tebako_memfs_table::erase(uint32_t index) { auto p_memfs_table = s_tebako_memfs_table.wlock(); auto p_memfs = p_memfs_table->extract(index); - if (p_memfs) { - delete p_memfs.mapped(); - } } -memfs* sync_tebako_memfs_table::get(uint32_t index) +std::shared_ptr sync_tebako_memfs_table::get(uint32_t index) { auto p_memfs_table = s_tebako_memfs_table.rlock(); auto p_memfs = p_memfs_table->find(index); @@ -83,10 +77,32 @@ memfs* sync_tebako_memfs_table::get(uint32_t index) return nullptr; } -bool sync_tebako_memfs_table::insert(uint32_t index, memfs* fs) +bool sync_tebako_memfs_table::insert(uint32_t index, std::shared_ptr fs) { auto p_memfs_table = s_tebako_memfs_table.wlock(); return p_memfs_table->emplace(index, fs).second; } +uint32_t sync_tebako_memfs_table::insert_auto(std::shared_ptr fs) { + uint32_t index = 1; + auto p_memfs_table = s_tebako_memfs_table.wlock(); + + for (const auto& pair : *p_memfs_table) { + if (pair.first > index) { + break; // Stop as soon as we find the gap + } + else if (pair.first == index) { + ++index; // Move to the next expected index + } + } + + if (index > 7) { // Only three bits to store memfs index + return 0; + } + fs->set_root_inode(index << 29); + p_memfs_table->emplace(index, fs); + return index; +} + + } // namespace tebako diff --git a/src/tebako-mnt.cpp b/src/tebako-mount-table.cpp similarity index 98% rename from src/tebako-mnt.cpp rename to src/tebako-mount-table.cpp index 81973614..7254f1b6 100644 --- a/src/tebako-mnt.cpp +++ b/src/tebako-mount-table.cpp @@ -30,7 +30,7 @@ #include #include -#include +#include namespace tebako { sync_tebako_mount_table& sync_tebako_mount_table::get_tebako_mount_table(void) diff --git a/tests/resources/tebako-fs.cpp.in b/tests/resources/tebako-fs.cpp.in index 68dda4c7..d2d45d8c 100644 --- a/tests/resources/tebako-fs.cpp.in +++ b/tests/resources/tebako-fs.cpp.in @@ -43,6 +43,10 @@ const char * tests_outside_dir(void) { return "@TESTS_OUTSIDE_DIR@"; } +const char * tests_the_other_memfs_image(void) { + return "@TESTS_THE_OTHER_MEMFS_IMAGE@"; +} + #ifdef __cplusplus } #endif diff --git a/tests/tebako-fs.h b/tests/tebako-fs.h index 0243ad82..bc8ecbb9 100644 --- a/tests/tebako-fs.h +++ b/tests/tebako-fs.h @@ -39,6 +39,7 @@ extern "C" { const char* tests_log_level(void); const char* tests_outside_dir(void); +const char * tests_the_other_memfs_image(void); #ifdef __cplusplus } diff --git a/tests/tests-dft.cpp b/tests/tests-dft.cpp deleted file mode 100644 index cdf2d7b0..00000000 --- a/tests/tests-dft.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/** - * - * Copyright (c) 2024, [Ribose Inc](https://www.ribose.com). - * All rights reserved. - * This file is a part of tebako (libdwarfs-wr) - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - -#include "tests.h" - -struct tebako_dirent; - -#include -#include - -namespace tebako { - -class SyncTebakoMemfsTableTest : public ::testing::Test { -protected: - void SetUp() override { - // Set up code if needed - } - - void TearDown() override { - // Clean up code if needed - sync_tebako_memfs_table::get_tebako_memfs_table().clear(); - } -}; - -TEST_F(SyncTebakoMemfsTableTest, get_tebako_memfs_table) { - auto& table1 = sync_tebako_memfs_table::get_tebako_memfs_table(); - auto& table2 = sync_tebako_memfs_table::get_tebako_memfs_table(); - EXPECT_EQ(&table1, &table2); // Ensure that the same instance is returned -} - -TEST_F(SyncTebakoMemfsTableTest, check_existing_index) { - auto& table = sync_tebako_memfs_table::get_tebako_memfs_table(); - table.insert(1, new memfs("AAA", 3)); - - EXPECT_TRUE(table.check(1)); // Check if the entry exists -} - -TEST_F(SyncTebakoMemfsTableTest, check_non_existing_index) { - auto& table = sync_tebako_memfs_table::get_tebako_memfs_table(); - EXPECT_FALSE(table.check(999)); // Check if a non-existing entry does not exist -} - -TEST_F(SyncTebakoMemfsTableTest, clear_table) { - auto& table = sync_tebako_memfs_table::get_tebako_memfs_table(); - table.insert(2, new memfs("BBB", 3)); - - table.clear(); // Clear the table - - EXPECT_FALSE(table.check(1)); // Ensure the entry is removed -} - -static void add_entries(sync_tebako_memfs_table& table, int start, int end) { - for (int i = start; i < end; ++i) { - table.insert(100 + i, new memfs("III", 3)); - } -} - -static void check_entries(sync_tebako_memfs_table& table, int start, int end, std::atomic& success_count) { - for (int i = start; i < end; ++i) { - if (table.check(100 + i)) { - success_count++; - } - } -} - -TEST_F(SyncTebakoMemfsTableTest, concurrent_add_and_check) { - auto& table = sync_tebako_memfs_table::get_tebako_memfs_table(); - std::atomic success_count(0); - - std::thread t1(add_entries, std::ref(table), 0, 500); - std::thread t2(add_entries, std::ref(table), 500, 1000); - std::thread t3(check_entries, std::ref(table), 0, 1000, std::ref(success_count)); - t1.join(); - t2.join(); - - std::thread t4(check_entries, std::ref(table), 0, 1000, std::ref(success_count)); - - t3.join(); - t4.join(); - - EXPECT_GE(success_count, 1000); -} - -TEST_F(SyncTebakoMemfsTableTest, concurrent_clear) { - auto& table = sync_tebako_memfs_table::get_tebako_memfs_table(); - std::atomic success_count(0); - - // Add entries before starting the test - add_entries(table, 0, 1000); - - std::thread t1(check_entries, std::ref(table), 0, 1000, std::ref(success_count)); - std::thread t2(&sync_tebako_memfs_table::clear, &table); - t1.join(); - std::thread t3(&sync_tebako_memfs_table::clear, &table); - t2.join(); - t3.join(); - - success_count = 0; - std::thread t4(check_entries, std::ref(table), 0, 1000, std::ref(success_count)); - t4.join(); - EXPECT_EQ(success_count, 0); -} - -} // namespace tebako diff --git a/tests/tests-fs-load.cpp b/tests/tests-fs-load.cpp index 4fe66398..9be66d3d 100644 --- a/tests/tests-fs-load.cpp +++ b/tests/tests-fs-load.cpp @@ -60,35 +60,27 @@ class LoadTests : public testing::Test { } }; -TEST(LoadTests, smoke) -{ - int i = 1; - EXPECT_EQ(1, i); -} - -//#if __MACH__ || defined(_WIN32) -TEST(LoadTests, tebako_load_invalid_filesystem) +TEST_F(LoadTests, tebako_load_invalid_filesystem) { const unsigned char data[] = "This is broken filesystem image"; int ret = mount_root_memfs(&data[0], sizeof(data) / sizeof(data[0]), tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, "0" /* image_offset */ ); - EXPECT_EQ(1, ret); + EXPECT_EQ(-1, ret); unmount_root_memfs(); } -//#endif -TEST(LoadTests, tebako_load_invalid_parameter) +TEST_F(LoadTests, tebako_load_invalid_parameter) { int ret = mount_root_memfs(&gfsData[0], gfsSize, "invalid parameter" /*debuglevel*/, NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, NULL /* image_offset */ ); - EXPECT_EQ(1, ret); + EXPECT_EQ(-1, ret); unmount_root_memfs(); } -TEST(LoadTests, tebako_load_valid_filesystem) +TEST_F(LoadTests, tebako_load_valid_filesystem) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, NULL /* image_offset */ @@ -98,7 +90,7 @@ TEST(LoadTests, tebako_load_valid_filesystem) unmount_root_memfs(); } -TEST(LoadTests, tebako_load_valid_filesystem_with_offset_auto) +TEST_F(LoadTests, tebako_load_valid_filesystem_with_offset_auto) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, "auto" /* image_offset */ @@ -108,28 +100,28 @@ TEST(LoadTests, tebako_load_valid_filesystem_with_offset_auto) unmount_root_memfs(); } -TEST(LoadTests, tebako_load_valid_filesystem_with_offset_wrong) +TEST_F(LoadTests, tebako_load_valid_filesystem_with_offset_wrong) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, "1024" /* image_offset */ ); - EXPECT_EQ(1, ret); + EXPECT_EQ(-1, ret); unmount_root_memfs(); } -TEST(LoadTests, tebako_load_with_offset_invalid) +TEST_F(LoadTests, tebako_load_with_offset_invalid) { int ret = mount_root_memfs(&gfsData[0], // &data[0], gfsSize, // sizeof(data)/sizeof(data[0]), tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, "xxx" /* image_offset */ ); - EXPECT_EQ(1, ret); + EXPECT_EQ(-1, ret); unmount_root_memfs(); } -TEST(LoadTests, tebako_load_valid_filesystem_with_decompress_ratio) +TEST_F(LoadTests, tebako_load_valid_filesystem_with_decompress_ratio) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, "0.6" /* decompress_ratio*/, "auto" /* image_offset */ @@ -139,17 +131,17 @@ TEST(LoadTests, tebako_load_valid_filesystem_with_decompress_ratio) unmount_root_memfs(); } -TEST(LoadTests, tebako_load_valid_filesystem_with_invalid_decompress_ratio) +TEST_F(LoadTests, tebako_load_valid_filesystem_with_invalid_decompress_ratio) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, "1.6" /* decompress_ratio*/, "auto" /* image_offset */ ); - EXPECT_EQ(1, ret); + EXPECT_EQ(-1, ret); unmount_root_memfs(); } -TEST(LoadTests, tebako_stat_not_loaded_filesystem) +TEST_F(LoadTests, tebako_stat_not_loaded_filesystem) { struct STAT_TYPE buf; int ret = tebako_stat(TEBAKIZE_PATH("file.txt"), &buf); @@ -157,7 +149,7 @@ TEST(LoadTests, tebako_stat_not_loaded_filesystem) EXPECT_EQ(ENOENT, errno); } -TEST(LoadTests, tebako_access_not_loaded_filesystem) +TEST_F(LoadTests, tebako_access_not_loaded_filesystem) { struct STAT_TYPE buf; int ret = tebako_access(TEBAKIZE_PATH("file.txt"), W_OK); @@ -165,7 +157,7 @@ TEST(LoadTests, tebako_access_not_loaded_filesystem) EXPECT_EQ(ENOENT, errno); } -TEST(LoadTests, tebako_open_not_loaded_filesystem) +TEST_F(LoadTests, tebako_open_not_loaded_filesystem) { struct STAT_TYPE buf; int ret = tebako_open(2, TEBAKIZE_PATH("file.txt"), O_RDONLY); @@ -173,7 +165,7 @@ TEST(LoadTests, tebako_open_not_loaded_filesystem) EXPECT_EQ(ENOENT, errno); } -TEST(LoadTests, tebako_close_all_fd) +TEST_F(LoadTests, tebako_close_all_fd) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, NULL /* image_offset */ @@ -195,7 +187,7 @@ TEST(LoadTests, tebako_close_all_fd) #endif } -TEST(LoadTests, tebako_close_all_dir) +TEST_F(LoadTests, tebako_close_all_dir) { int ret = mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), NULL /* cachesize*/, NULL /* workers */, NULL /* mlock */, NULL /* decompress_ratio*/, NULL /* image_offset */ diff --git a/tests/tests-fs-load2.cpp b/tests/tests-fs-load2.cpp new file mode 100644 index 00000000..159add16 --- /dev/null +++ b/tests/tests-fs-load2.cpp @@ -0,0 +1,166 @@ +/** + * + * Copyright (c) 2021-2024, [Ribose Inc](https://www.ribose.com). + * All rights reserved. + * This file is a part of tebako (libdwarfs-wr) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + *CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + *EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + *PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + *BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + *IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + **/ +#include +#include "tests.h" + +struct tebako_dirent; + +#include +#include +#include + +namespace { +class LoadTests2 : public ::testing::Test { +public: + static std::vector buffer; + static std::streamsize size; + +protected: +#ifdef _WIN32 + static void invalidParameterHandler(const wchar_t* p1, + const wchar_t* p2, + const wchar_t* p3, + unsigned int p4, + uintptr_t p5) + { + // Just return to pass execution to standard library + // otherwise exception will be thrown by MSVC runtime + return; + } +#endif + + static void SetUpTestSuite() { +#ifdef _WIN32 + _set_invalid_parameter_handler(invalidParameterHandler); + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX | SEM_NOOPENFILEERRORBOX); +#endif + // Load image for the second filesystem + std::string filename = tests_the_other_memfs_image(); + std::ifstream file(filename, std::ios::binary | std::ios::ate); + if (!file) { + FAIL() << "Failed to open file: " << filename; + } + + size = file.tellg(); + file.seekg(0, std::ios::beg); + + buffer.resize(size); + if (!file.read(buffer.data(), size)) { + FAIL() << "Failed to read file: " << filename; + } + } + + static void TearDownTestSuite() + { + } + + void SetUp() override + { + mount_root_memfs(&gfsData[0], gfsSize, tests_log_level(), nullptr, nullptr, nullptr, nullptr, nullptr ); + } + + void TearDown() override + { + unmount_root_memfs(); + } +}; + +// Define static members +std::vector LoadTests2::buffer; +std::streamsize LoadTests2::size; + + +TEST_F(LoadTests2, tebako_load_valid_filesystem) +{ + int ret = mount_memfs(buffer.data(), size, "auto", "dummy"); + EXPECT_LE(1, ret); + +} + +TEST_F(LoadTests2, tebako_load_invalid_filesystem) +{ + const unsigned char data[] = "This is broken filesystem image"; + int ret = mount_memfs(&data[0], sizeof(data) / sizeof(data[0]), nullptr, "dummy"); + EXPECT_EQ(-1, ret); + + // Check that root fs is alive + struct STAT_TYPE buf; + errno = 0; + ret = tebako_stat(TEBAKIZE_PATH("file.txt"), &buf); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, errno); +} + +TEST_F(LoadTests2, tebako_load_with_offset_invalid) +{ + int ret = mount_memfs(buffer.data(), size, "xxx", "dummy"); + EXPECT_EQ(-1, ret); + + // Check that root fs is alive + struct STAT_TYPE buf; + errno = 0; + ret = tebako_stat(TEBAKIZE_PATH("file.txt"), &buf); + EXPECT_EQ(0, ret); + EXPECT_EQ(0, errno); +} + +TEST_F(LoadTests2, tebako_stat_not_loaded_filesystem) +{ + tebako::sync_tebako_mount_table& mount_table = tebako::sync_tebako_mount_table::get_tebako_mount_table(); + mount_table.insert(0, "m-dir-at-second-memfs", 5); + + struct STAT_TYPE buf; + int ret = tebako_stat(TEBAKIZE_PATH("m-dir-at-second-memfs/file.txt"), &buf); + EXPECT_EQ(-1, ret); + EXPECT_EQ(ENOENT, errno); +} + +TEST_F(LoadTests2, tebako_access_not_loaded_filesystem) +{ + tebako::sync_tebako_mount_table& mount_table = tebako::sync_tebako_mount_table::get_tebako_mount_table(); + mount_table.insert(0, "m-dir-at-second-memfs", 5); + + struct STAT_TYPE buf; + int ret = tebako_access(TEBAKIZE_PATH("m-dir-at-second-memfs/file.txt"), W_OK); + EXPECT_EQ(-1, ret); + EXPECT_EQ(ENOENT, errno); +} + +TEST_F(LoadTests2, tebako_open_not_loaded_filesystem) +{ + tebako::sync_tebako_mount_table& mount_table = tebako::sync_tebako_mount_table::get_tebako_mount_table(); + mount_table.insert(0, "m-dir-at-second-memfs", 5); + + struct STAT_TYPE buf; + int ret = tebako_open(2, TEBAKIZE_PATH("m-dir-at-second-memfs/file.txt"), O_RDONLY); + EXPECT_EQ(-1, ret); + EXPECT_EQ(ENOENT, errno); +} + +} // namespace diff --git a/tests/tests-memfs-table.cpp b/tests/tests-memfs-table.cpp new file mode 100644 index 00000000..14e8f21a --- /dev/null +++ b/tests/tests-memfs-table.cpp @@ -0,0 +1,119 @@ +/** + * + * Copyright (c) 2024, [Ribose Inc](https://www.ribose.com). + * All rights reserved. + * This file is a part of tebako (libdwarfs-wr) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; + * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#include "tests.h" + +struct tebako_dirent; + +#include +#include + +namespace tebako { + +class MemfsTableTests : public ::testing::Test { + protected: + sync_tebako_memfs_table& memfs_table = sync_tebako_memfs_table::get_tebako_memfs_table(); + + void SetUp() override { memfs_table.clear(); } + + void TearDown() override { memfs_table.clear(); } +}; + +TEST_F(MemfsTableTests, test_singleton_retrieval) +{ + auto& instance1 = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + auto& instance2 = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + EXPECT_EQ(&instance1, &instance2); // Both should be the same instance +} + +TEST_F(MemfsTableTests, test_clear) +{ + auto& memfs_table = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + memfs_table.insert(1, std::make_shared("Test1", 5)); + memfs_table.insert(2, std::make_shared("Test2", 5)); + + EXPECT_TRUE(memfs_table.check(1)); + EXPECT_TRUE(memfs_table.check(2)); + + memfs_table.clear(); // Clear the table + EXPECT_FALSE(memfs_table.check(1)); + EXPECT_FALSE(memfs_table.check(2)); +} + +TEST_F(MemfsTableTests, test_erase) { + auto& memfs_table = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + memfs_table.insert(1, std::make_shared("TestA", 5)); + + EXPECT_TRUE(memfs_table.check(1)); + + memfs_table.erase(1); // Erase the entry + EXPECT_FALSE(memfs_table.check(1)); +} + +TEST_F(MemfsTableTests, test_get) { + auto& memfs_table = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + auto fs = std::make_shared("Test3", 5); + memfs_table.insert(1, fs); + + EXPECT_EQ(memfs_table.get(1), fs); // Should return the same pointer + EXPECT_EQ(memfs_table.get(2), nullptr); // Non-existing index should return nullptr +} + +TEST_F(MemfsTableTests, test_insert_auto) { + auto& memfs_table = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + memfs_table.clear(); // Ensure the table is empty + + EXPECT_EQ(memfs_table.insert_auto(std::make_shared("Test01", 6)), 1); // Should insert at 1 + EXPECT_EQ(memfs_table.insert_auto(std::make_shared("Test02", 6)), 2); // Should insert at 2 + EXPECT_EQ(memfs_table.insert_auto(std::make_shared("Test03", 6)), 3); // Should insert at 3 + + // Fill up the remaining slots + memfs_table.insert_auto(std::make_shared("Test04", 6)); // 4 + memfs_table.insert_auto(std::make_shared("Test05", 6)); // 5 + memfs_table.insert_auto(std::make_shared("Test06", 6)); // 6 + memfs_table.insert_auto(std::make_shared("Test07", 6)); // 7 + + EXPECT_EQ(memfs_table.insert_auto(std::make_shared("Test08", 6)), 0); // No more valid indices +} + +TEST_F(MemfsTableTests, test_concurrent_access) { + auto& memfs_table = tebako::sync_tebako_memfs_table::get_tebako_memfs_table(); + memfs_table.clear(); + + std::thread t1([&]() { memfs_table.insert(1, std::make_shared("Test4", 5)); }); + std::thread t2([&]() { memfs_table.insert(2, std::make_shared("Test5", 5)); }); + + t1.join(); + t2.join(); + + EXPECT_TRUE(memfs_table.check(1)); + EXPECT_TRUE(memfs_table.check(2)); +} + +} // namespace tebako diff --git a/tests/tests-mnt.cpp b/tests/tests-mount-table.cpp similarity index 99% rename from tests/tests-mnt.cpp rename to tests/tests-mount-table.cpp index 58778a6f..6ab62926 100644 --- a/tests/tests-mnt.cpp +++ b/tests/tests-mount-table.cpp @@ -28,7 +28,7 @@ */ #include "tests.h" -#include +#include namespace tebako { diff --git a/tests/tests-mount.cpp b/tests/tests-mount.cpp index aa97f635..389dfa28 100644 --- a/tests/tests-mount.cpp +++ b/tests/tests-mount.cpp @@ -28,7 +28,7 @@ */ #include "tests.h" -#include +#include namespace tebako { diff --git a/tests/tests-process-mps.cpp b/tests/tests-process-mps.cpp index 0d6faa9c..af4f2663 100644 --- a/tests/tests-process-mps.cpp +++ b/tests/tests-process-mps.cpp @@ -30,7 +30,7 @@ #include "tests.h" #include #include -#include +#include #include namespace tebako { @@ -136,7 +136,7 @@ TEST_F(ProcessMountpointsTest, invalid_path) } // Test: Multiple valid mount points -TEST_F(ProcessMountpointsTest, MultipleValidMountPoints) +TEST_F(ProcessMountpointsTest, mltiple_valid_mountpoints) { std::vector mountpoints = {"directory-1/mpoint1:target1", "directory-1/mpoint2:target2", "directory-1/mpoint3:target3"};