Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Jan 27, 2025
1 parent 5873690 commit 25cd448
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 1 addition & 2 deletions cmake/Tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ function(register_tests)
set_property(TEST ${test_name} PROPERTY LABELS ${TESTS_TEST_LABELS})
if (${TESTS_TEST_LABELS} MATCHES "DOUBLE")
#set_property(TEST ${test_name} PROPERTY ENVIRONMENT LD_PRELOAD=${CMAKE_BINARY_DIR}/limestone-double.so)
target_link_libraries(${test_name} PRIVATE ${CMAKE_BINARY_DIR}/fake-limestone.so)
set_property(TEST ${test_name} PROPERTY ENVIRONMENT LD_PRELOAD=${CMAKE_BINARY_DIR}/fake-limestone.so ASAN_OPTIONS=verify_asan_link_order=0)
set_property(TEST ${test_name} PROPERTY ENVIRONMENT LD_PRELOAD=$<TARGET_FILE:limestone-double> ASAN_OPTIONS=verify_asan_link_order=0)
endif()
endif()
else()
Expand Down
9 changes: 9 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ else ()
endif()
endif()

file (GLOB LIMESTONE_DOUBLE_SOURCES "test_double/doubles/limestone_double.cpp")
add_library(limestone-double ${LIMESTONE_DOUBLE_SOURCES})
target_link_libraries(limestone-double PRIVATE limestone)
target_include_directories(limestone-double
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include
)

register_tests(
TARGET shirakami
DEPENDS
Expand Down Expand Up @@ -193,6 +201,7 @@ else ()
PRIVATE ${tbb_prefix}tbbmalloc_proxy
PRIVATE yakushima
PRIVATE atomic
PRIVATE limestone-double
SOURCES ${TEST_WITH_DOUBLE_SOURCES}
TEST_LABELS "DOUBLE"
)
Expand Down
4 changes: 3 additions & 1 deletion test/test_double/blob_send_mock_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ class blob_send_mock_test : public ::testing::Test {
TEST_F(blob_send_mock_test, insert_update_blob) {
std::vector<std::pair<std::string, std::vector<limestone::api::blob_id_type>>> added;
// prepare

// test double
test_double::log_channel_add_entry1::hook_func = [&added] (
[[maybe_unused]] test_double::log_channel_add_entry1::orig_type orig_func,
[[maybe_unused]] limestone::api::log_channel* this_ptr,
Expand Down Expand Up @@ -69,7 +71,7 @@ TEST_F(blob_send_mock_test, insert_update_blob) {
};

Storage st{};
create_storage("", st);
create_storage("", st); // N.B. create_storage may call add_entry
Token s{};
ASSERT_EQ(Status::OK, enter(s));
added.clear();
Expand Down
2 changes: 1 addition & 1 deletion test/test_double/doubles/limestone_double.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <dlfcn.h>

#include "glog/logging.h"
#include "shirakami/logging.h" // span_printer for test-main
//#include "shirakami/logging.h" // span_printer for test-main

#include "limestone_double.h"

Expand Down

0 comments on commit 25cd448

Please sign in to comment.