Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 29 additions & 43 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,66 +19,52 @@ jobs:
run-test-matrix:
strategy:
matrix:
compiler_mode: [gcc, clang, gcc-asan, clang-msan]
build_mode: [release, debug]
target: [all] # Just compile most configs
include_slow_tests: ['true']
run_nightly_tests: ['false']
compiler_mode: [clang-msan, gcc-asan, clang, gcc]
build_mode: [debug, release]
target: [run-tests]
tests_function: [cache_tests_1, cache_tests_2, cache_tests_3, functionality_tests, parallel_perf_test_1, parallel_perf_test_2, parallel_perf_test_3, parallel_perf_test_4, perf_tests_1, perf_tests_2, splinter_misc_tests_1, splinter_misc_tests_2, large_insert_stress_tests_1, large_insert_stress_tests_2, large_insert_stress_tests_3, misc_tests, filter_tests, unit_tests]
exclude:
# Don't do a compile job on these, since we will do run-tests on them below
- compiler_mode: gcc-asan
build_mode: release
target: all
build_mode: debug
target: run-tests
- compiler_mode: clang-msan
build_mode: release
target: all
- compiler_mode: clang
build_mode: debug
target: all
- compiler_mode: gcc
build_mode: release
target: all
target: run-tests
# The following tests are excluded because they take too long to run with sanitizers
- build_mode: debug
tests_function: large_insert_stress_tests_2
- build_mode: debug
tests_function: large_insert_stress_tests_3
- compiler_mode: gcc-asan
tests_function: large_insert_stress_tests_2
- compiler_mode: gcc-asan
tests_function: large_insert_stress_tests_3
- compiler_mode: clang-msan
tests_function: large_insert_stress_tests_2
- compiler_mode: clang-msan
tests_function: large_insert_stress_tests_3
include:
# Compile and run tests on these configs
- compiler_mode: gcc-asan
build_mode: release
target: run-tests
include_slow_tests: 'true'
run_nightly_tests: 'false'
build_mode: debug
target: all
- compiler_mode: clang-msan
build_mode: release
target: run-tests
include_slow_tests: 'true'
run_nightly_tests: 'false'
- compiler_mode: clang
build_mode: debug
target: run-tests
include_slow_tests: 'true'
run_nightly_tests: 'false'
- compiler_mode: gcc
build_mode: release
target: run-tests
include_slow_tests: 'false'
run_nightly_tests: 'true'
name: >
${{ matrix.target == 'all' && 'Compile' || 'Run' }}
${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }}
${{ matrix.target == 'run-tests' && matrix.include_slow_tests == 'true' && '(slow tests)' || '' }}
${{ matrix.target == 'run-tests' && matrix.run_nightly_tests == 'true' && '(nightly tests)' || '' }}
target: all
name: ${{ matrix.compiler_mode }} ${{ matrix.build_mode }} ${{ matrix.target }} ${{ matrix.tests_function }}
runs-on: ubuntu-latest
env:
CC: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
LD: ${{ startsWith(matrix.compiler_mode, 'gcc') && 'gcc' || 'clang' }}
BUILD_MODE: ${{ matrix.build_mode }}
BUILD_ASAN: ${{ endsWith(matrix.compiler_mode, 'asan') && 1 || 0 }}
BUILD_MSAN: ${{ endsWith(matrix.compiler_mode, 'msan') && 1 || 0 }}
INCLUDE_SLOW_TESTS: ${{ matrix.include_slow_tests }}
RUN_NIGHTLY_TESTS: ${{ matrix.run_nightly_tests }}
TESTS_FUNCTION: ${{ matrix.tests_function }}
steps:
- name: Maximize build space
uses: easimon/maximize-build-space@master
uses: rtjohnso/maximize-build-space@master
with:
root-reserve-mb: 2048
root-reserve-mb: 4096
temp-reserve-mb: 4096
swap-size-mb: 1
remove-dotnet: true
remove-android: true
Expand All @@ -90,4 +76,4 @@ jobs:
with:
packages: libxxhash-dev libaio-dev libconfig-dev gcc clang-19 clang-format-19
- name: make ${{ matrix.target }}
run: pwd; make ${{ matrix.target }}
run: df -h; make ${{ matrix.target }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ run-tests: all-tests
BINDIR=$(BINDIR) ./test.sh

test-results: all-tests
INCLUDE_SLOW_TESTS=true BINDIR=$(BINDIR) ./test.sh 2>&1 | tee ./test-results
BINDIR=$(BINDIR) ./test.sh 2>&1 | tee ./test-results

run-examples: all-examples
for i in $(EXAMPLES_BINS); do $$i || exit; done
Expand Down
4 changes: 0 additions & 4 deletions ci/steps.lib.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,6 @@ config:
run:
path: sh
args: ["-c", "cd /splinterdb && ./test.sh"]
params:
INCLUDE_SLOW_TESTS: "true"
#@ end

---
Expand Down Expand Up @@ -96,8 +94,6 @@ config:
params:
CC: #@ compiler
LD: #@ compiler
INCLUDE_SLOW_TESTS: #@ str(not quick).lower()
RUN_NIGHTLY_TESTS: #@ str(test_nightly).lower()
BUILD_VERBOSE: "1"
VERBOSE: "3"

Expand Down
20 changes: 4 additions & 16 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,16 @@ _Audience: All users and contributors._


## Testing Overview
In CI, we execute these tests against the following build modes
- All tests on optimized and debug builds using clang
- All tests on optimized and debug builds using gcc
- All tests using address-sanitizer debug builds using the clang compiler
- All tests using memory-sanitizer debug builds using the gcc compiler
- clang-format checks
- [shellcheck](https://www.shellcheck.net) and shfmt checks run against shell scripts

To run a small collection of unit-tests to give you a very quick
baseline stability of the library, do: `$ make run-tests`
To run the full test-suite, do: `$ make run-tests` or `$make test-results`. The former runs the tests and outputs the results to the terminal. The `test-results` target generates a file with the test results.

The [`make run-tests`](../Makefile#:~:text=run%2Dtests) target invokes the
underlying [`test.sh`](../test.sh) script to run quick tests.

To execute a larger set of tests, including functional and performance tests,
you can do one of the following:

To execute a smaller set of tests, you can do the following:
```shell
$ make test-results
$ INCLUDE_SLOW_TESTS=true make run-tests
$ INCLUDE_SLOW_TESTS=true ./test.sh
$ TESTS_FUNCTION=<func> make <test-results | run-tests>
```
See `test.sh` for valid values for `TESTS_FUNCTION`.

In CI, all test execution is driven by the top-level [test.sh](../test.sh)
script, which exercises individual build artifacts produced for testing, as
Expand Down
8 changes: 0 additions & 8 deletions docs/unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,6 @@ unit-test binary with the `--list` argument.
----
## How To Run unit-tests

Quick **smoke-tests** run of unit tests: `$ make run-tests`

This runs a small subset of unit tests, which execute very quickly, so that you
get a quick turnaround on the overall stability of your changes.

You can achieve the same result by executing the following test driver script
[test.sh](../test.sh#:~:text=if%20\[%20"$INCLUDE%5FSLOW%5FTESTS"%20!=%20"true"%20\]): `$ ./test.sh`

To **run** all the unit-test suites: `$ bin/unit_test`

To run a specific suite, optionally filtering on a specific test case:
Expand Down
10 changes: 0 additions & 10 deletions include/splinterdb/splinterdb.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,6 @@ splinterdb_get_version();
* for all structures (default), or choose to setup a shared segment
* which will be used for shared structures.
*
* ******************* EXPERIMENTAL FEATURES ********************
*
* - use_shmem: Support for shared memory segments:
* This flag will configure a shared memory segment. All (most) run-time
* memory allocation will be done from this shared segment. Currently,
* we do not support free(), so you will likely run out of shared memory
* and run into shared-memory OOM errors. This functionality is
* solely meant for internal development uses.
*
* ******************* EXPERIMENTAL FEATURES ********************
*/
typedef struct splinterdb_config {
// required configuration
Expand Down
4 changes: 1 addition & 3 deletions src/clockcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,9 +1223,7 @@ clockcache_get_free_page(clockcache *cc,
* not give up after 3 passes on the cache. At least wait for the
* max latency of an IO and keep making passes.
*/
while (num_passes < 3
|| (blocking && !io_max_latency_elapsed(cc->io, wait_start)))
{
while (num_passes < 3 || blocking) {
uint64 start_entry = cc->per_thread[tid].free_hand * CC_ENTRIES_PER_BATCH;
uint64 end_entry = start_entry + CC_ENTRIES_PER_BATCH;
for (entry_no = start_entry; entry_no < end_entry; entry_no++) {
Expand Down
1 change: 0 additions & 1 deletion src/platform_linux/platform_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ struct iovec;
#define IO_DEFAULT_FLAGS (O_RDWR | O_CREAT)
#define IO_DEFAULT_PERMS (0755)
#define IO_DEFAULT_KERNEL_QUEUE_SIZE (256)
#define IO_DEFAULT_FILENAME "db"
#define IO_DEFAULT_ASYNC_QUEUE_DEPTH (256)

/*
Expand Down
2 changes: 2 additions & 0 deletions src/shard_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ shard_log_write(log_handle *logh, key tuple_key, message msg, uint64 generation)
page = cache_get(cc, thread_data->addr, TRUE, PAGE_TYPE_LOG);
uint64 wait = 1;
while (!cache_try_claim(cc, page)) {
cache_unget(cc, page);
platform_sleep_ns(wait);
wait = wait > 1024 ? wait : 2 * wait;
page = cache_get(cc, thread_data->addr, TRUE, PAGE_TYPE_LOG);
}
cache_lock(cc, page);
}
Expand Down
Loading