Prepare to add fdb implementation
Fixes a end iter deref and remove rpath from test
This commit is contained in:
@@ -184,14 +184,23 @@ if(BUILD_TESTING)
|
|||||||
add_executable(driver TestDriver.cpp FacadeFuzz.cpp)
|
add_executable(driver TestDriver.cpp FacadeFuzz.cpp)
|
||||||
target_compile_options(driver PRIVATE ${TEST_FLAGS})
|
target_compile_options(driver PRIVATE ${TEST_FLAGS})
|
||||||
target_link_libraries(driver PRIVATE ${PROJECT_NAME})
|
target_link_libraries(driver PRIVATE ${PROJECT_NAME})
|
||||||
|
set_target_properties(driver PROPERTIES SKIP_BUILD_RPATH ON)
|
||||||
|
if(APPLE)
|
||||||
|
set(LD_PATH DYLD_LIBRARY_PATH)
|
||||||
|
else()
|
||||||
|
set(LD_PATH LD_LIBRARY_PATH)
|
||||||
|
endif()
|
||||||
foreach(TEST ${CORPUS_TESTS})
|
foreach(TEST ${CORPUS_TESTS})
|
||||||
get_filename_component(hash ${TEST} NAME)
|
get_filename_component(hash ${TEST} NAME)
|
||||||
add_test(NAME versioned_map_blackbox_${hash} COMMAND driver ${TEST})
|
add_test(NAME versioned_map_blackbox_${hash} COMMAND driver ${TEST})
|
||||||
|
set_tests_properties(
|
||||||
|
versioned_map_blackbox_${hash}
|
||||||
|
PROPERTIES ENVIRONMENT ${LD_PATH}=${CMAKE_BINARY_DIR}/versioned-map)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
add_executable(bench Bench.cpp)
|
add_executable(bench Bench.cpp)
|
||||||
target_compile_options(bench PRIVATE ${TEST_FLAGS})
|
|
||||||
target_link_libraries(bench PRIVATE ${PROJECT_NAME} nanobench)
|
target_link_libraries(bench PRIVATE ${PROJECT_NAME} nanobench)
|
||||||
|
set_target_properties(bench PROPERTIES SKIP_BUILD_RPATH ON)
|
||||||
|
|
||||||
# symbol visibility tests
|
# symbol visibility tests
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
12
Facade.h
12
Facade.h
@@ -44,9 +44,6 @@ struct Facade {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint8_t zero_[] = {0};
|
|
||||||
static const String zero{zero_, 1};
|
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
weaselab::VersionedMap::Iterator iter = versionedIter[1];
|
weaselab::VersionedMap::Iterator iter = versionedIter[1];
|
||||||
weaselab::VersionedMap::Iterator endIter = versionedIter[0];
|
weaselab::VersionedMap::Iterator endIter = versionedIter[0];
|
||||||
@@ -123,13 +120,11 @@ struct Facade {
|
|||||||
m.type == weaselab::VersionedMap::Set || m.param2Len == 0
|
m.type == weaselab::VersionedMap::Set || m.param2Len == 0
|
||||||
? weaselab::VersionedMap::Key{m.param1, m.param1Len + 1}
|
? weaselab::VersionedMap::Key{m.param1, m.param1Len + 1}
|
||||||
: weaselab::VersionedMap::Key{m.param2, m.param2Len};
|
: weaselab::VersionedMap::Key{m.param2, m.param2Len};
|
||||||
auto c = unversionedIter->first <=> mBegin;
|
for (; unversionedIter != facade->unversioned.end() &&
|
||||||
for (; unversionedIter != facade->unversioned.end() && c < 0 &&
|
(unversionedIter->first <=> mBegin) < 0 && limit > 0;) {
|
||||||
limit > 0;) {
|
|
||||||
result.push_back(*unversionedIter);
|
result.push_back(*unversionedIter);
|
||||||
--limit;
|
--limit;
|
||||||
++unversionedIter;
|
++unversionedIter;
|
||||||
c = unversionedIter->first <=> mBegin;
|
|
||||||
}
|
}
|
||||||
if (limit == 0) {
|
if (limit == 0) {
|
||||||
return result;
|
return result;
|
||||||
@@ -147,7 +142,8 @@ struct Facade {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (m.type == weaselab::VersionedMap::Set || m.param2Len == 0) {
|
if (m.type == weaselab::VersionedMap::Set || m.param2Len == 0) {
|
||||||
if (unversionedIter != facade->unversioned.end() && c == 0) {
|
if (unversionedIter != facade->unversioned.end() &&
|
||||||
|
(unversionedIter->first <=> mBegin) == 0) {
|
||||||
++unversionedIter;
|
++unversionedIter;
|
||||||
}
|
}
|
||||||
assert(unversionedIter ==
|
assert(unversionedIter ==
|
||||||
|
@@ -596,7 +596,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
|||||||
|
|
||||||
finger.clear();
|
finger.clear();
|
||||||
|
|
||||||
bool ignored;
|
bool ignored = false;
|
||||||
finger.push(root, ignored);
|
finger.push(root, ignored);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@@ -810,7 +810,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
|||||||
Finger finger;
|
Finger finger;
|
||||||
if (continueKey.len == 0) {
|
if (continueKey.len == 0) {
|
||||||
// Set finger to last entry in tree
|
// Set finger to last entry in tree
|
||||||
bool ignored;
|
bool ignored = false;
|
||||||
finger.push(latestRoot, ignored);
|
finger.push(latestRoot, ignored);
|
||||||
uint32_t c;
|
uint32_t c;
|
||||||
while ((c = child<std::memory_order_relaxed>(finger.backNode(), true,
|
while ((c = child<std::memory_order_relaxed>(finger.backNode(), true,
|
||||||
@@ -1120,7 +1120,7 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() {
|
|||||||
|
|
||||||
// Handle decrementing end
|
// Handle decrementing end
|
||||||
if (impl->finger.searchPathSize() == 0) {
|
if (impl->finger.searchPathSize() == 0) {
|
||||||
bool ignored;
|
bool ignored = false;
|
||||||
impl->finger.push(
|
impl->finger.push(
|
||||||
impl->map->roots.getThreadSafeHandle().rootForVersion(impl->version),
|
impl->map->roots.getThreadSafeHandle().rootForVersion(impl->version),
|
||||||
ignored);
|
ignored);
|
||||||
@@ -1247,7 +1247,7 @@ VersionedMap::Iterator VersionedMap::begin(int64_t version) const {
|
|||||||
result.impl = new (safe_malloc(sizeof(Iterator::Impl))) Iterator::Impl();
|
result.impl = new (safe_malloc(sizeof(Iterator::Impl))) Iterator::Impl();
|
||||||
result.impl->version = version;
|
result.impl->version = version;
|
||||||
|
|
||||||
bool ignored;
|
bool ignored = false;
|
||||||
result.impl->finger.push(
|
result.impl->finger.push(
|
||||||
impl->roots.getThreadSafeHandle().rootForVersion(version), ignored);
|
impl->roots.getThreadSafeHandle().rootForVersion(version), ignored);
|
||||||
if (result.impl->finger.backNode() == 0) {
|
if (result.impl->finger.backNode() == 0) {
|
||||||
|
Reference in New Issue
Block a user