-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add faketime tests #4883
Add faketime tests #4883
Conversation
Co-authored-by: Theodore Tsirpanis <theodore.tsirpanis@tiledb.com>
Co-authored-by: Theodore Tsirpanis <theodore.tsirpanis@tiledb.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of adding another test executable, how about you redefine the tiledb_timing_unit
test to run tiledb_unit
while LD_PRELOAD
ing libfaketime?
@teo-tsirpanis do you mean through cmake variables, or as a subprocess through One reason to do it this way is so that we can add a specific test to ensure that faketime is doing what we want (like in the corresponding tiledb-py test) |
@@ -362,6 +362,45 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU | |||
) | |||
endif() | |||
|
|||
# Only produce timing tests for UNIX based systems (faketime constraint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a note about how this test works (we link libfaketime, and set the environment override at the bottom so that it applies).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to LD_PRELOAD
@ihnorton I mean the former. The difference of my proposal from the current arrangement is that we will build only one |
test/CMakeLists.txt
Outdated
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} | ||
) | ||
|
||
set_property(TEST tiledb_timing_unit PROPERTY ENVIRONMENT_MODIFICATION "FAKETIME=set:2020-12-24 20:30:00;LD_PRELOAD=set:${CMAKE_BINARY_DIR}/vcpkg_installed/x64-linux/lib/liblibfaketime.so") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should call find_library
to get the path. And instead of if not on Windows, you should write if the library was not found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
ports/libfaketime/CMakeLists.txt
Outdated
install(EXPORT ${PROJECT_NAME} | ||
FILE unofficial-${PROJECT_NAME}-targets.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/unofficial-${PROJECT_NAME} | ||
NAMESPACE unofficial::libfaketime:: | ||
) | ||
|
||
include(GNUInstallDirs) | ||
include(CMakePackageConfigHelpers) | ||
|
||
configure_package_config_file( | ||
unofficial-${PROJECT_NAME}-config.cmake.in | ||
unofficial-${PROJECT_NAME}-config.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/unofficial-${PROJECT_NAME}) | ||
|
||
write_basic_package_version_file( | ||
unofficial-${PROJECT_NAME}-config-version.cmake | ||
VERSION ${CMAKE_PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need the exported targets anymore. And they are not necessary for the port on second thought since libfaketime does not have dependencies on its own.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -0,0 +1,38 @@ | |||
cmake_minimum_required(VERSION 3.12) | |||
|
|||
project(faketime VERSION 0.9.10) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
project(faketime VERSION 0.9.10) | |
project(faketime) |
The version is not needed here. You don't have to change this now (to avoid restarting CI), just keep it in mind when upstreaming the port.
Tested locally and it fails on 2.20.0 so it should be ready to merge |
Rebased onto main branch from: #4843
This PR introduces timing tests that run with mocked time. During the test all calls to acquire timestamp, either by using posix
time()
or modern C++std::chrono::clock::now()
are mocked and should return the same timestamp. This way we should be able to test sub-millisecond writes/reads.This PR adds:
These tests are supposed to fail on TileDB version 2.20.0:
https://github.com/dudoslav/TileDB/actions/runs/8535232007/job/23381209269#step:14:97
TYPE: NO_HISTORY
DESC: Add faketime tests