View on GitHub


A Small, Portable Lock-Free API

Test Suite

Mintomic comes with a test suite which you can build and run yourself. The only requirement is CMake. This test suite helps ensure that Mintomic was implemented correctly on each platform, while bringing the library to life with a working set of examples. Here’s what its output looks like on an iPhone 4S:

Every test case with a _fail suffix on its name contains an intentional bug. These tests are allowed to fail, and in general, designed to do so. The point is to show how incorrect lock-free code may succeed on certain platforms out of luck, depending on things like compiler ordering, machine word size and hardware memory model.

How to Build

First, you must generate the projects using CMake. Open a command prompt in the tests folder, and do the following.

mkdir build
cd build
cmake .. 

cmake takes an optional -G argument to specify which project generator to use. For example, the following command will use the Visual Studio 2012 generator. A complete list of available generators can be found by running cmake with no arguments.

cmake -G "Visual Studio 11" ..

On a Unix-like OS, to generate a makefile that builds the release configuration:

cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" ..

To generate projects for iOS devices, use the following.

cmake -DCMAKE_TOOLCHAIN_FILE=../../cmake/iOS.cmake -G "Xcode" ..

To build the project, simply use the generated project files as you would normally. On some platforms, you can use CMake to perform the build step, too. For example, on Windows, you can use the command:

cmake --build . --config Release