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)
|
||||
target_compile_options(driver PRIVATE ${TEST_FLAGS})
|
||||
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})
|
||||
get_filename_component(hash ${TEST} NAME)
|
||||
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()
|
||||
|
||||
add_executable(bench Bench.cpp)
|
||||
target_compile_options(bench PRIVATE ${TEST_FLAGS})
|
||||
target_link_libraries(bench PRIVATE ${PROJECT_NAME} nanobench)
|
||||
set_target_properties(bench PROPERTIES SKIP_BUILD_RPATH ON)
|
||||
|
||||
# symbol visibility tests
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
12
Facade.h
12
Facade.h
@@ -44,9 +44,6 @@ struct Facade {
|
||||
return result;
|
||||
}
|
||||
|
||||
static const uint8_t zero_[] = {0};
|
||||
static const String zero{zero_, 1};
|
||||
|
||||
if (reverse) {
|
||||
weaselab::VersionedMap::Iterator iter = versionedIter[1];
|
||||
weaselab::VersionedMap::Iterator endIter = versionedIter[0];
|
||||
@@ -123,13 +120,11 @@ struct Facade {
|
||||
m.type == weaselab::VersionedMap::Set || m.param2Len == 0
|
||||
? weaselab::VersionedMap::Key{m.param1, m.param1Len + 1}
|
||||
: weaselab::VersionedMap::Key{m.param2, m.param2Len};
|
||||
auto c = unversionedIter->first <=> mBegin;
|
||||
for (; unversionedIter != facade->unversioned.end() && c < 0 &&
|
||||
limit > 0;) {
|
||||
for (; unversionedIter != facade->unversioned.end() &&
|
||||
(unversionedIter->first <=> mBegin) < 0 && limit > 0;) {
|
||||
result.push_back(*unversionedIter);
|
||||
--limit;
|
||||
++unversionedIter;
|
||||
c = unversionedIter->first <=> mBegin;
|
||||
}
|
||||
if (limit == 0) {
|
||||
return result;
|
||||
@@ -147,7 +142,8 @@ struct Facade {
|
||||
break;
|
||||
}
|
||||
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;
|
||||
}
|
||||
assert(unversionedIter ==
|
||||
|
@@ -596,7 +596,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
||||
|
||||
finger.clear();
|
||||
|
||||
bool ignored;
|
||||
bool ignored = false;
|
||||
finger.push(root, ignored);
|
||||
|
||||
for (;;) {
|
||||
@@ -810,7 +810,7 @@ struct __attribute__((__visibility__("hidden"))) VersionedMap::Impl {
|
||||
Finger finger;
|
||||
if (continueKey.len == 0) {
|
||||
// Set finger to last entry in tree
|
||||
bool ignored;
|
||||
bool ignored = false;
|
||||
finger.push(latestRoot, ignored);
|
||||
uint32_t c;
|
||||
while ((c = child<std::memory_order_relaxed>(finger.backNode(), true,
|
||||
@@ -1120,7 +1120,7 @@ VersionedMap::Iterator &VersionedMap::Iterator::operator--() {
|
||||
|
||||
// Handle decrementing end
|
||||
if (impl->finger.searchPathSize() == 0) {
|
||||
bool ignored;
|
||||
bool ignored = false;
|
||||
impl->finger.push(
|
||||
impl->map->roots.getThreadSafeHandle().rootForVersion(impl->version),
|
||||
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->version = version;
|
||||
|
||||
bool ignored;
|
||||
bool ignored = false;
|
||||
result.impl->finger.push(
|
||||
impl->roots.getThreadSafeHandle().rootForVersion(version), ignored);
|
||||
if (result.impl->finger.backNode() == 0) {
|
||||
|
Reference in New Issue
Block a user