Skip to content

Commit

Permalink
Add new test case and amended assertion to repro issue #467
Browse files Browse the repository at this point in the history
  • Loading branch information
gapisback committed Oct 28, 2022
1 parent 7594c0c commit ce89116
Show file tree
Hide file tree
Showing 5 changed files with 620 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ TESTSRC := $(COMMON_TESTSRC) $(FUNCTIONAL_TESTSRC) $(UNIT_TESTSRC)
# run as fast as it can.
# - Skip tests that are to be invoked with specialized command-line arguments.
# These skipped tests which will have to be run stand-alone.
FAST_UNIT_TESTSRC := $(shell find $(UNIT_TESTSDIR) -name "*.c" | egrep -v -e"splinter_test|config_parse_test")
FAST_UNIT_TESTSRC := $(shell find $(UNIT_TESTSDIR) -name "*.c" | egrep -v -e"splinter_test|config_parse_test|large_inserts_bugs_stress")

EXAMPLES_SRC := $(shell find $(EXAMPLES_DIR) -name "*.c")

Expand Down Expand Up @@ -428,6 +428,10 @@ $(BINDIR)/$(UNITDIR)/task_system_test: $(UTIL_SYS)
$(OBJDIR)/$(FUNCTIONAL_TESTSDIR)/test_async.o \
$(LIBDIR)/libsplinterdb.so

$(BINDIR)/$(UNITDIR)/large_inserts_bugs_stress_test: $(UTIL_SYS) \
$(OBJDIR)/$(TESTS_DIR)/config.o \
$(LIBDIR)/libsplinterdb.so

########################################
# Convenience mini unit-test targets
unit/util_test: $(BINDIR)/$(UNITDIR)/util_test
Expand Down
9 changes: 7 additions & 2 deletions src/trunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -5458,8 +5458,13 @@ trunk_split_leaf(trunk_handle *spl,
trunk_max_key(spl, leaf),
trunk_key_size(spl));

platform_assert(num_leaves + trunk_num_pivot_keys(spl, parent)
<= spl->cfg.max_pivot_keys);
platform_assert((num_leaves + trunk_num_pivot_keys(spl, parent)
<= spl->cfg.max_pivot_keys),
"num_leaves=%u, trunk_num_pivot_keys()=%u"
", cfg.max_pivot_keys=%lu\n",
num_leaves,
trunk_num_pivot_keys(spl, parent),
spl->cfg.max_pivot_keys);

/*
* 3. Clear old bundles from leaf and put all branches in a new bundle
Expand Down
3 changes: 3 additions & 0 deletions tests/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
// Configs that are usually changed by different tests
#define TEST_CONFIG_DEFAULT_SEED 0
#define TEST_CONFIG_DEFAULT_NUM_INSERTS 0
#define TEST_CONFIG_DEFAULT_NUM_THREADS 8

// clang-format off
void
Expand Down Expand Up @@ -65,6 +66,7 @@ config_set_defaults(master_config *cfg)
.key_size = TEST_CONFIG_DEFAULT_KEY_SIZE,
.message_size = TEST_CONFIG_DEFAULT_MESSAGE_SIZE,
.num_inserts = TEST_CONFIG_DEFAULT_NUM_INSERTS,
.num_threads = TEST_CONFIG_DEFAULT_NUM_THREADS,
.seed = TEST_CONFIG_DEFAULT_SEED,
};
}
Expand Down Expand Up @@ -276,6 +278,7 @@ config_parse(master_config *cfg, const uint8 num_config, int argc, char *argv[])
// Test-execution configuration parameters
config_set_uint64("seed", cfg, seed) {}
config_set_uint64("num-inserts", cfg, num_inserts) {}
config_set_uint64("num-threads", cfg, num_threads) {}

config_set_else
{
Expand Down
1 change: 1 addition & 0 deletions tests/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ typedef struct master_config {
// Test-execution configuration parameters
uint64 seed;
uint64 num_inserts;
uint64 num_threads;
} master_config;


Expand Down
Loading

0 comments on commit ce89116

Please sign in to comment.