License
Build Status
codecov
Total alerts

SortChecker++ is an extension of SortChecker tool
to C++ sorting APIs like std::sort or std::binary_search.
It verifies that comparators satisfy the Strict Weak Ordering
axioms.

It is currently work in progress.

How to build

To use, first install dependencies:

$ sudo apt install libclang-dev llvm-dev

We only support LLVM 10 for now (default on Ubuntu 20.04).
Then build the tool

$ make clean all

How to use

SortChecker works by instrumenting, i.e. inserting additional checking code,
into the source file. You can run it manually:

$ SortChecker file.cpp -- $CXXFLAGS

and then compile via

$ g++ file.cpp $CXXFLAGS -Ipath/to/sortcheck.h

You could also use compiler wrappers in scripts/ folder to combine instrumentation and compilation:

$ PATH=path/to/scripts:$PATH make clean all

Instrumented program may be controlled with environment variables:

  • SORTCHECK_VERBOSE – verbosity
  • SORTCHECK_SYSLOG – dump messages to syslog (in addition to stderr)
  • SORTCHECK_ABORT_ON_ERROR – call abort() on detected error
  • SORTCHECK_EXIT_CODE – call exit(CODE) on detected error

TODO

  • apply to test packages
  • integrate to old sortcheck (?)

GitHub

View Github