Skip to content

Commit c3ed566

Browse files
authored
turn on more tests (#645)
Turn on nightly tests in CI Fix one bug in splinter: * make it so that clockcache_batch_start_writeback cannot fail Fix a few exposed bugs and issues in the tests themselves: * properly wait for I/O quiescence in io_apis_test.c * fix uninit variable in splinter test * shrink some tests to reduce running time * throttle progress output * delete more leftover db files in tests * don't use --db-location w/ unit tests
1 parent ecd4156 commit c3ed566

File tree

7 files changed

+206
-147
lines changed

7 files changed

+206
-147
lines changed

.github/workflows/run-tests.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,38 +22,66 @@ jobs:
2222
compiler_mode: [gcc, clang, gcc-asan, clang-msan]
2323
build_mode: [release, debug]
2424
target: [all] # Just compile most configs
25+
include_slow_tests: ['true']
26+
run_nightly_tests: ['false']
2527
exclude:
2628
# Don't do a compile job on these, since we will do run-tests on them below
2729
- compiler_mode: gcc-asan
2830
build_mode: release
2931
target: all
32+
include_slow_tests: 'true'
33+
run_nightly_tests: 'false'
3034
- compiler_mode: clang-msan
3135
build_mode: release
3236
target: all
37+
include_slow_tests: 'true'
38+
run_nightly_tests: 'false'
3339
- compiler_mode: clang
3440
build_mode: debug
3541
target: all
42+
include_slow_tests: 'true'
43+
run_nightly_tests: 'false'
44+
- compiler_mode: gcc
45+
build_mode: release
46+
target: all
47+
include_slow_tests: 'true'
48+
run_nightly_tests: 'false'
3649
include:
3750
# Compile and run tests on these configs
3851
- compiler_mode: gcc-asan
3952
build_mode: release
4053
target: run-tests
54+
include_slow_tests: 'true'
55+
run_nightly_tests: 'false'
4156
- compiler_mode: clang-msan
4257
build_mode: release
43-
sanitizer: msan
4458
target: run-tests
59+
include_slow_tests: 'true'
60+
run_nightly_tests: 'false'
4561
- compiler_mode: clang
4662
build_mode: debug
4763
target: run-tests
48-
name: ${{ matrix.target == 'all' && 'Compile' || 'Run' }} ${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }}
64+
include_slow_tests: 'true'
65+
run_nightly_tests: 'false'
66+
- compiler_mode: gcc
67+
build_mode: release
68+
target: run-tests
69+
include_slow_tests: 'false'
70+
run_nightly_tests: 'true'
71+
name: >
72+
${{ matrix.target == 'all' && 'Compile' || 'Run' }}
73+
${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }}
74+
${{ matrix.target == 'run-tests' && matrix.include_slow_tests == 'true' && '(slow tests)' || '' }}
75+
${{ matrix.target == 'run-tests' && matrix.run_nightly_tests == 'true' && '(nightly tests)' || '' }}
4976
runs-on: ubuntu-latest
5077
env:
5178
CC: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
5279
LD: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
5380
BUILD_MODE: ${{ matrix.build_mode }}
5481
BUILD_ASAN: ${{ endsWith(matrix.compiler_mode, 'asan') && 1 || 0 }}
5582
BUILD_MSAN: ${{ endsWith(matrix.compiler_mode, 'msan') && 1 || 0 }}
56-
INCLUDE_SLOW_TESTS: true
83+
INCLUDE_SLOW_TESTS: ${{ matrix.include_slow_tests }}
84+
RUN_NIGHTLY_TESTS: ${{ matrix.run_nightly_tests }}
5785
steps:
5886
- name: Maximize build space
5987
uses: easimon/maximize-build-space@master

src/clockcache.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,11 @@ clockcache_batch_start_writeback(clockcache *cc, uint64 batch, bool32 is_urgent)
963963
&& clockcache_try_set_writeback(cc, next_entry_no, is_urgent));
964964

965965

966-
async_io_state *state = TYPED_MALLOC(cc->heap_id, state);
967-
platform_assert(state != NULL);
966+
async_io_state *state;
967+
while ((state = TYPED_MALLOC(cc->heap_id, state)) == NULL) {
968+
clockcache_wait(cc);
969+
}
970+
968971
state->cc = cc;
969972
state->outstanding_pages = NULL;
970973
io_async_state_init(state->iostate,

test.sh

Lines changed: 97 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ function nightly_functionality_stress_tests() {
179179
--num-tables ${ntables} \
180180
--cache-capacity-gib ${cache_size} \
181181
--db-location ${dbname}
182+
rm ${dbname}
182183

183184
# ----
184185
ntables=2
@@ -190,6 +191,7 @@ function nightly_functionality_stress_tests() {
190191
--num-tables ${ntables} \
191192
--cache-capacity-gib ${cache_size} \
192193
--db-location ${dbname}
194+
rm ${dbname}
193195

194196
# ----
195197
cache_size=1 # GiB
@@ -206,6 +208,7 @@ function nightly_functionality_stress_tests() {
206208
--num-tables ${ntables} \
207209
--cache-capacity-gib ${cache_size} \
208210
--db-location ${dbname}
211+
rm ${dbname}
209212

210213
# ----
211214
ntables=4
@@ -217,6 +220,8 @@ function nightly_functionality_stress_tests() {
217220
--num-tables ${ntables} \
218221
--cache-capacity-gib ${cache_size} \
219222
--db-location ${dbname}
223+
rm ${dbname}
224+
220225
# ----
221226
cache_size=512 # MiB
222227
test_descr="${nrows_h} rows, ${ntables} tables, ${cache_size} MiB cache"
@@ -238,6 +243,7 @@ function nightly_unit_stress_tests() {
238243
local n_mills=10
239244
local num_rows=$((n_mills * 1000 * 1000))
240245
local nrows_h="${n_mills} mil"
246+
local dbname="splinterdb_unit_tests_db"
241247

242248
# ----
243249
local n_threads=32
@@ -252,6 +258,8 @@ function nightly_unit_stress_tests() {
252258
--num-inserts ${num_rows} \
253259
--num-memtable-bg-threads 8 \
254260
--num-normal-bg-threads 20
261+
rm ${dbname}
262+
255263
}
256264

257265
# #############################################################################
@@ -298,7 +306,7 @@ function nightly_sync_perf_tests() {
298306
--tree-size-gib 4 \
299307
--db-capacity-gib 60 \
300308
--db-location ${dbname} \
301-
--verbose-progress
309+
--verbose-progress \
302310
${Use_shmem}
303311
rm ${dbname}
304312

@@ -353,6 +361,7 @@ function nightly_cache_perf_tests() {
353361
"$BINDIR"/driver_test cache_test --perf \
354362
--db-location ${dbname} \
355363
${Use_shmem}
364+
rm ${dbname}
356365

357366
cache_size=6 # GiB
358367
test_descr="${cache_size} GiB cache"
@@ -377,13 +386,16 @@ function nightly_async_perf_tests() {
377386
local npthreads=20
378387
local nbgthreads=20
379388
local nasync=10
389+
local tree_size=5
380390
local test_descr="${npthreads} pthreads,bgt=${nbgthreads},async=${nasync}"
381391
local dbname="splinter_test.perf.db"
382392
run_with_timing "Parallel Async Performance test ${test_descr}" \
383393
"$BINDIR"/driver_test splinter_test --parallel-perf \
384-
--num-bg-threads ${nbgthreads} \
385394
--max-async-inflight ${nasync} \
386395
--num-pthreads ${npthreads} \
396+
--tree-size-gib ${tree_size} \
397+
--num-normal-bg-threads ${nbgthreads} \
398+
--num-memtable-bg-threads 2 \
387399
--db-capacity-gib 60 \
388400
--db-location ${dbname}
389401
rm ${dbname}
@@ -397,7 +409,7 @@ function run_nightly_perf_tests() {
397409

398410
nightly_cache_perf_tests
399411

400-
# nightly_async_perf_tests
412+
nightly_async_perf_tests
401413
}
402414

403415
# #############################################################################
@@ -692,6 +704,7 @@ function run_slower_forked_process_tests() {
692704
msg="Splinter tests using ${num_forked_procs} forked child processes"
693705
run_with_timing "${msg}" "$BINDIR"/unit/splinterdb_forked_child_test \
694706
--num-processes ${num_forked_procs}
707+
rm splinterdb_unit_tests_db
695708

696709
# ---- Run large_inserts_stress_test with small configuration as a quick check
697710
# using forked child process execution.
@@ -934,71 +947,6 @@ testRunStartSeconds=$SECONDS
934947
echo "$(TZ="America/Los_Angeles" date) **** SplinterDB${run_type}Test Suite Execution Times **** " > "${test_exec_log_file}"
935948
echo >> "${test_exec_log_file}"
936949

937-
# ---- Nightly Stress and Performance test runs ----
938-
if [ "$RUN_NIGHTLY_TESTS" == "true" ]; then
939-
940-
set +e
941-
run_with_timing "Check limits, error conditions." nightly_test_limitations
942-
943-
run_nightly_stress_tests
944-
945-
Use_shmem="" run_nightly_perf_tests
946-
Use_shmem="--use-shmem" run_nightly_perf_tests
947-
set -e
948-
949-
record_elapsed_time ${testRunStartSeconds} "Nightly Stress & Performance Tests"
950-
cat_exec_log_file
951-
exit 0
952-
fi
953-
954-
# ---- Fast running Smoke test runs ----
955-
if [ "$INCLUDE_SLOW_TESTS" != "true" ]; then
956-
957-
# For some coverage, exercise --help, --list args for unit test binaries
958-
set -x
959-
"$BINDIR"/unit_test --help
960-
"$BINDIR"/unit_test --list
961-
"$BINDIR"/unit_test --list splinterdb_quick
962-
"$BINDIR"/unit/btree_test --help
963-
"$BINDIR"/unit/splinterdb_quick_test --list
964-
set +x
965-
966-
echo " "
967-
echo "NOTE: **** Only running fast unit tests ****"
968-
echo "To run all tests, set the env var, and re-run: $ INCLUDE_SLOW_TESTS=true ./$Me"
969-
echo " "
970-
971-
# Exercise config-parsing test case. Here, we feed-in a set of
972-
# --config-params that the test code knows to "expect" and validates.
973-
# These options can come in any order.
974-
set -x
975-
run_with_timing "Config-params parsing test"
976-
"$BINDIR"/unit/config_parse_test --log \
977-
--num-inserts 20 \
978-
--rough-count-height 11 \
979-
--stats \
980-
--verbose-logging \
981-
--verbose-progress
982-
set +x
983-
984-
start_seconds=$SECONDS
985-
986-
run_with_timing "Smoke tests" run_fast_unit_tests ""
987-
988-
Use_shmem="--use-shmem"
989-
run_with_timing "Smoke tests using shared memory" run_fast_unit_tests
990-
991-
if [ "$RUN_MAKE_TESTS" == "true" ]; then
992-
run_with_timing "Basic build-and-test tests" test_make_run_tests
993-
fi
994-
995-
cat_exec_log_file
996-
exit 0
997-
fi
998-
999-
# ---- Rest of the coverage runs included in CI test runs ----
1000-
UNIT_TESTS_DB_DEV="unit_tests_db"
1001-
1002950
# ------------------------------------------------------------------------
1003951
# Fast-path execution support. You can invoke this script specifying the
1004952
# name of one of the functions to execute a specific set of tests. If the
@@ -1039,29 +987,94 @@ if [ $# -ge 1 ]; then
1039987
exit 0
1040988
fi
1041989

1042-
# Run all the unit-tests first, to get basic coverage
1043-
run_with_timing "Fast unit tests" "$BINDIR"/unit_test
990+
#
991+
# Fast tests
992+
#
1044993

1045-
# ------------------------------------------------------------------------
1046-
# Run mini-unit-tests that were excluded from bin/unit_test binary:
1047-
# ------------------------------------------------------------------------
1048-
Use_shmem=""
1049-
run_slower_unit_tests
994+
# For some coverage, exercise --help, --list args for unit test binaries
995+
set -x
996+
"$BINDIR"/unit_test --help
997+
"$BINDIR"/unit_test --list
998+
"$BINDIR"/unit_test --list splinterdb_quick
999+
"$BINDIR"/unit/btree_test --help
1000+
"$BINDIR"/unit/splinterdb_quick_test --list
1001+
set +x
1002+
1003+
# Exercise config-parsing test case. Here, we feed-in a set of
1004+
# --config-params that the test code knows to "expect" and validates.
1005+
# These options can come in any order.
1006+
set -x
1007+
run_with_timing "Config-params parsing test"
1008+
"$BINDIR"/unit/config_parse_test --log \
1009+
--num-inserts 20 \
1010+
--rough-count-height 11 \
1011+
--stats \
1012+
--verbose-logging \
1013+
--verbose-progress
1014+
set +x
10501015

1051-
if [ -f ${UNIT_TESTS_DB_DEV} ]; then rm ${UNIT_TESTS_DB_DEV}; fi
1016+
run_with_timing "Smoke tests" run_fast_unit_tests ""
10521017

1053-
run_splinter_functionality_tests
1018+
Use_shmem="--use-shmem"
1019+
run_with_timing "Smoke tests using shared memory" run_fast_unit_tests
10541020

1055-
run_splinter_perf_tests
1021+
if [ "$RUN_MAKE_TESTS" == "true" ]; then
1022+
run_with_timing "Basic build-and-test tests" test_make_run_tests
1023+
fi
10561024

1057-
run_btree_tests
1025+
#
1026+
# Slow tests
1027+
#
1028+
1029+
if [ "$INCLUDE_SLOW_TESTS" == "true" ]; then
1030+
1031+
# ---- Rest of the coverage runs included in CI test runs ----
1032+
UNIT_TESTS_DB_DEV="unit_tests_db"
1033+
1034+
# Run all the unit-tests first, to get basic coverage
1035+
run_with_timing "Fast unit tests" "$BINDIR"/unit_test
1036+
1037+
# ------------------------------------------------------------------------
1038+
# Run mini-unit-tests that were excluded from bin/unit_test binary:
1039+
# ------------------------------------------------------------------------
1040+
Use_shmem=""
1041+
run_slower_unit_tests
1042+
1043+
if [ -f ${UNIT_TESTS_DB_DEV} ]; then rm ${UNIT_TESTS_DB_DEV}; fi
1044+
1045+
run_splinter_functionality_tests
1046+
1047+
run_splinter_perf_tests
1048+
1049+
run_btree_tests
1050+
1051+
run_other_driver_tests
1052+
1053+
record_elapsed_time ${testRunStartSeconds} "Tests without shared memory configured"
1054+
# ------------------------------------------------------------------------
1055+
# Re-run a collection of tests using shared-memory.
1056+
Use_shmem="--use-shmem" run_tests_with_shared_memory
1057+
1058+
fi
1059+
1060+
# ---- Nightly Stress and Performance test runs ----
1061+
if [ "$RUN_NIGHTLY_TESTS" == "true" ]; then
1062+
1063+
set +e
1064+
run_with_timing "Check limits, error conditions." nightly_test_limitations
1065+
1066+
run_nightly_stress_tests
1067+
1068+
Use_shmem="" run_nightly_perf_tests
1069+
Use_shmem="--use-shmem" run_nightly_perf_tests
1070+
set -e
1071+
1072+
record_elapsed_time ${testRunStartSeconds} "Nightly Stress & Performance Tests"
1073+
cat_exec_log_file
1074+
exit 0
1075+
fi
10581076

1059-
run_other_driver_tests
10601077

1061-
record_elapsed_time ${testRunStartSeconds} "Tests without shared memory configured"
1062-
# ------------------------------------------------------------------------
1063-
# Re-run a collection of tests using shared-memory.
1064-
Use_shmem="--use-shmem" run_tests_with_shared_memory
10651078

10661079
record_elapsed_time ${testRunStartSeconds} "All Tests"
10671080
echo ALL PASSED

0 commit comments

Comments
 (0)