2017-12-21 02:31:32 +00:00
|
|
|
# How to use Address Sanitizer
|
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
Note: We use Address Sanitizer to run functional tests for every commit automatically.
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
mkdir build && cd build
|
2018-03-03 19:51:21 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
Note:
|
|
|
|
ENABLE_TCMALLOC=0 is optional.
|
|
|
|
CC=clang CXX=clang++ is strongly recommended.
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
CC=clang CXX=clang++ cmake -D CMAKE_BUILD_TYPE=ASan -D ENABLE_TCMALLOC=0 ..
|
|
|
|
make -j24
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
## Copy binary to your server
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2018-02-24 01:31:42 +00:00
|
|
|
scp ./dbms/src/Server/clickhouse yourserver:~/clickhouse-asan
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
## Start ClickHouse and run tests
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2018-03-03 14:42:45 +00:00
|
|
|
sudo -u clickhouse ./clickhouse-asan server --config /etc/clickhouse-server/config.xml
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
|
|
|
|
|
|
|
# How to use Thread Sanitizer
|
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
mkdir build && cd build
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
## Note: All parameters are mandatory.
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2018-02-24 01:31:42 +00:00
|
|
|
CC=clang CXX=clang++ cmake -D CMAKE_BUILD_TYPE=TSan -D ENABLE_TCMALLOC=0 ..
|
2017-12-21 02:31:32 +00:00
|
|
|
make -j24
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
## Copy binary to your server
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2018-02-24 01:31:42 +00:00
|
|
|
scp ./dbms/src/Server/clickhouse yourserver:~/clickhouse-tsan
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:51:21 +00:00
|
|
|
## Start ClickHouse and run tests
|
2017-12-21 02:31:32 +00:00
|
|
|
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
2018-03-03 14:42:45 +00:00
|
|
|
sudo -u clickhouse TSAN_OPTIONS='halt_on_error=1 suppressions=tsan_suppressions' ./clickhouse-tsan server --config /etc/clickhouse-server/config.xml
|
2018-03-03 19:50:02 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
# How to use Memory Sanitizer
|
|
|
|
|
|
|
|
First, build libc++ with MSan:
|
|
|
|
|
|
|
|
```
|
|
|
|
svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm
|
|
|
|
(cd llvm/projects && svn co http://llvm.org/svn/llvm-project/libcxx/trunk libcxx)
|
|
|
|
(cd llvm/projects && svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi)
|
|
|
|
|
|
|
|
mkdir libcxx_msan && cd libcxx_msan
|
|
|
|
cmake ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_USE_SANITIZER=Memory -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++
|
|
|
|
make cxx -j24
|
|
|
|
```
|
|
|
|
|
|
|
|
Then, build ClickHouse:
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir build && cd build
|
|
|
|
```
|
|
|
|
|
|
|
|
```
|
|
|
|
CC=clang CXX=clang++ cmake -D CMAKE_BUILD_TYPE=MSan -D LIBCXX_PATH=/home/milovidov/libcxx_msan ..
|
|
|
|
```
|