Skip to content
This repository has been archived by the owner on Jan 6, 2020. It is now read-only.

Linux Apple run sanitize tests

justinemclevy edited this page Jan 16, 2014 · 3 revisions

Address Santiser

AddressSanitizer is a fast memory error detector. It consists of a compiler instrumentation module and a run-time library. The tool can detect the following types of bugs:

  • Out-of-bounds accesses to heap, stack and globals
    
  • Use-after-free
    
  • Use-after-return (to some extent)
    
  • Double-free, invalid free
    

Typical slowdown introduced by AddressSanitizer is 2x.

Documentation is found here. This is built if clang has been included as per this document and is automatically available.

To run this checker :

cmake ../ -DCMAKE_CXX_FLAGS=-fsanitize=address-full (from your build directory)

Then run any or all tests that you wish to check for the above errors.

Assuming your build directory is MaidSafe/<build dir name> then output of the sanity check can be de-mangled using : ./TESTsomething 2>&1 | ../tools/clang/asan_symbolize.py

Thread sanitiser

ThreadSanitizer is a tool that detects data races. It consists of a compiler instrumentation module and a run-time library. Typical slowdown introduced by ThreadSanitizer is about 5x-15x. Typical memory overhead introduced by ThreadSanitizer is about 5x-10x.

Documentation is found here. This is built if clang has been included as per this document and is automatically available.

To run this checker :

cmake ../ -DCMAKE_CXX_FLAGS=-fsanitize=thread (from your build directory)

Then run any or all tests that you wish to check for the above errors.

Assuming your build directory is MaidSafe/<build dir name> then output of the sanity check can be de-mangled using : ./TESTsomething 2>&1 | ../tools/clang/asan_symbolize.py

Memory sanitiser

MemorySanitizer is a detector of uninitialized reads. It consists of a compiler instrumentation module and a run-time library.

Typical slowdown introduced by MemorySanitizer is 3x.

Documentation is found here. This is built if clang has been included as per this document and is automatically available.

To run this checker :

cmake ../ -DCMAKE_CXX_FLAGS=-fsanitize=memory (from your build directory)

Then run any or all tests that you wish to check for the above errors.

Assuming your build directory is MaidSafe/<build dir name> then output of the sanity check can be de-mangled using : ./TESTsomething 2>&1 | ../tools/clang/asan_symbolize.py

Undefined behaviour

To run this checker :

cmake ../ -DCMAKE_CXX_FLAGS=-fsanitize=undefined (from your build directory)

Then run any or all tests that you wish to check for the above errors.

Assuming your build directory isMaidSafe/<build dir name> then output of the sanity check can be de-mangled using : ./TESTsomething 2>&1 | ../tools/clang/asan_symbolize.py