-
Notifications
You must be signed in to change notification settings - Fork 619
Testing
Peloton uses AddressSanitizer to detect memory errors including leaks. It's faster and more lightweight to execute than Valgrind, and is enabled on our automated testing infrastructure (i.e., TravisCI and Jenkins). If you are planning to contribute to Peloton, it is highly recommended to enable AddressSanitizer locally.
To build and run all tests:
cmake -DCMAKE_BUILD_TYPE=Debug -DUSE_SANITIZER=Address ..
make -j4 checkIf you are on macOS, you may need to disable container overflow checks due to false positives like so:
ASAN_OPTIONS=detect_container_overflow=0 make -j4 checkThe above commands perform parallel build and test. You can control the degree of parallelism by changing the value of the -j parameter with the number of cores you have.
Here's the command to build an individual test:
make $TEST_NAMEEXAMPLE:
make sample_testTo run an individual test using ctest, list the test cases:
ctest -NThen run it thus:
ctest -I 26,26 -VRefer to the README in the test subfolder: https://github.com/cmu-db/peloton/blob/master/test/README.md
ADVANCED: It is also possible to run tests using Valgrind. In order to do so, you must recompile Peloton and tests without address sanitization. AddressSanitizer and Valgrind are not compatible!
Here's the valgrind command to run an individual test (once it has already been built) :
valgrind "--trace-children=yes" "--leak-check=full" "--track-origins=yes" "--soname-synonyms=somalloc=*jemalloc*" "--error-exitcode=1" "--suppressions=/$LOCATION_OF_PELOTON_SOURCE_DIR/third_party/valgrind/valgrind.supp /$LOCATION_OF_PELOTON_BUILD_DIR/test/$TEST_NAMEEXAMPLE:
valgrind "--trace-children=yes" "--leak-check=full" "--track-origins=yes" "--soname-synonyms=somalloc=*jemalloc*" "--error-exitcode=1" "--suppressions=/home/parallels/git/peloton/third_party/valgrind/valgrind.supp" ./test/sample_test