Exercise copyChildrenAndKeyFrom for Node{48,256} to itself
All checks were successful
Tests / Clang total: 1092, passed: 1092
Clang |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / SIMD fallback total: 1092, passed: 1092
Tests / Release [gcc] total: 1092, passed: 1092
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 817, passed: 817
Tests / Coverage total: 819, passed: 819
weaselab/conflict-set/pipeline/head This commit looks good

This commit is contained in:
2024-04-17 17:13:22 -07:00
parent 64a98c529c
commit c15d296432
3 changed files with 25 additions and 0 deletions

View File

@@ -263,6 +263,10 @@ if(BUILD_TESTING)
# find.
if(NOT CMAKE_CROSSCOMPILING)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/test_conflict_set.py)
execute_process(
COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/test_conflict_set.py
list OUTPUT_VARIABLE SCRIPT_TESTS)

View File

@@ -1146,8 +1146,14 @@ void freeAndMakeCapacityAtLeast(Node *&self, int capacity,
// capacity.
void maybeDecreaseCapacity(Node *&self, NodeAllocators *allocators,
ConflictSet::Impl *impl) {
const int maxCapacity =
(self->numChildren + int(self->entryPresent)) * (self->partialKeyLen + 1);
#if DEBUG_VERBOSE && !defined(NDEBUG)
fprintf(stderr, "maybeDecreaseCapacity: current: %d, max: %d, key: %s\n",
self->getCapacity(), maxCapacity,
getSearchPathPrintable(self).c_str());
#endif
if (self->getCapacity() <= maxCapacity) {
return;
}

View File

@@ -66,6 +66,21 @@ def test_inner_full_words():
cs.check(read(1, b"\x21", b"\xc2"))
def test_decrease_capacity():
# make a Node48, then a Node256
for count in (17, 49):
with DebugConflictSet() as cs:
for i in range(count):
cs.addWrites(1, write(bytes(([0] * 99) + [i])))
# lower its partial key length
cs.addWrites(2, write(bytes([0] * 98)))
# create work for setOldestVersion
for i in range(3, 1000):
cs.addWrites(i)
# setOldestVersion should decrease the capacity
cs.setOldestVersion(1)
if __name__ == "__main__":
# budget "pytest" for ctest integration without pulling in a dependency. You can of course still use pytest in local development.
import argparse