Install Guide

From Sources

The framework strongly depends on the libclang library. As far as I know there is no usable binary distribution of the library and it must be built manually.

There are some needed dependencies:

If you work on Debian Stretch all of them but the cmake are in the system repository with an appropriate version.

If you want to compile the examples one of them depends on:

Building Clang

  • Download llvm and clang in version 7.X.X from the LLVM project site (different version will work very unlikely).
  • Unpack both archives. The unpacked clang must be placed just next the unpacked LLVM and must be renamed to clang.
  • Create another directory (for example build) and change current working dir to.
  • Run cmake:
    $ cmake -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS=clang -DLLVM_USE_LINKER=gold <path_to_llvm>
    

    Note: don’t attempt to compile the Debug build type unless you’ve got really much RAM.

  • Then build the libraries:
    $ make
    
  • At the end install the clang somewhere
    $ cmake -DCMAKE_INSTALL_PREFIX=<somewhere_path> -P cmake_install.cmake
    

    Be sure the installation location is inside the searching path list of the cmake’s find_package directive. Otherwise, cmake won’t be able to find it and compilation of OTest2 will fail.

Building OTest2

  • Download and unpack the OTest2 sources:
  • Create another directory (for example build) and change current working directory to.
  • Run cmake:
    $ cmake <path_to_otest2>
    
  • Then build the framework:
    $ make
    
  • Optionally, but strongly recommended, run the self-test suite
    $ make check
    
  • Install the framework:
    $ cmake -DCMAKE_INSTALL_PREFIX=<somewhere_path> -P cmake_install.cmake
    

    If you intent to use the otest2 with the cmake building system (strongly recommended) be sure the installation path is inside the searching list of the cmake’s find_package directive.

Binary Packages

There are prepared binary packages for 64-bits Linux. Download any binary package from GitHub.

Configuration

The OTest2 pre-processor needs to know locations of header files installed in the system. Most of them is able to find itself but there are some locations which must be configured1.

The pre-processor searches for configuration files at

  1. /etc/otest2_includes.conf
  2. ${HOME}/.otest2_includes
  3. ${PWD}/.otest2_includes

The configuration file is a simple text file: one include path per line.

On a gcc-based system you can create the configuration file by a simple script otest2_discovery.sh which prints default include paths:

$ otest2_discover.sh > ~/.otest2_includes

The generated testing binaries have some dependencies on libraries which must be installed in the system:

  1. in my case it cannot find the stdarg.h header because it’s located in a gcc specific path.