Getting Started 🔗
Welcome to the online documentation for the Audition testing framework. Offline documentation is available for Linux users via the Audition man page which you can access by typing man audition
in your shell after installing Audition.
Audition is a modern xUnit testing framework for C11 and beyond. It provides numerous quality-of-life improvements over other C unit testing frameworks, including automatic test registration and generic assertion macros. Additionally, Audition features a robust mocking system and a sandbox mode for running tests in an isolated address space.
Before you begin using Audition you must first install it. The remainder of this page will guide you through the installation processes. Once you’ve installed Audition you’re ready to learn the basics.
Supported Platforms and Compilers 🔗
Audition is tested on real hardware running Windows, Linux, Apple Silicon, and emulation via QEMU and Virtual Box. It has been tested in the following environments:
Architecture | Environment | Compilers |
---|---|---|
AArch32 | Linux 5.15 | GCC 11 |
AArch64 | Linux 5.15 | GCC 11 |
AArch64 | macOS 13.6 | Clang 14 |
AArch64 | macOS 15.1 | Clang 14 |
MIPS | Linux 5.15 | GCC 11 |
MIPS 64 | Linux 5.15 | GCC 11 |
RISC-V 32 | Linux 5.15 | GCC 11 |
RISC-V 64 | Linux 5.15 | GCC 11 |
x86 | Linux 5.15 | Clang 12, GCC 11 |
x86 | Windows 10 | MSVC 2019, Clang-CL 14 |
x86 | Windows 10 | MSVC 2022 |
AMD64 | FreeBSD 13.1 | Clang 13 |
AMD64 | Ubuntu 22.04 LTS | Clang 14, GCC 11 |
AMD64 | Ubuntu 24.04 LTS | GCC 13 |
AMD64 | Fedora 40 | GCC 14 |
AMD64 | Fedora 41 | GCC 14 |
AMD64 | NetBSD 9.3 | GCC 7.5 |
AMD64 | Windows 10 | MSVC 2019, Clang-CL 14 |
AMD64 | Windows 10 | MSVC 2022 |
AMD64 | Windows 10 | MinGW GCC 11, Clang 14 |
The binary releases of Audition are limited to Windows, macOS, the latest long-term support releases of Ubuntu, and the maintained releases of Fedora Workstation. To build for other operating systems and architectures, you must license the Audition source code.
Installing Audition 🔗
The section will guide you through the installation of Audition on your system and its configuration with your C environment
Once Audition is installed you can integrate it with your C project by following the Discovering Audition guide.
Installing Audition On Windows 🔗
The simplest way to install Audition on Windows is to use the .msi
installer available from the downloads page. The install does not require administrative privileges. By default, the installer will place Audition into your %LOCALAPPDATA%
directory.
After installing Audition, you can discover it with CMake or by passing flags to your C compiler to discover the Audition library and header in the installation directory.
You can also download Audition for Windows as an archive (i.e. a zip file) which includes the Audition library and header.
Installing Audition On macOS 🔗
To install Audition on macOS first download the latest .dmg
from the downloads page. After you have downloaded it, double click the dmg to mount it and then drag-and-drop Audition.framework
into the Frameworks
folder to install.
You can now discover Audition.framework
from Xcode just as you would any other framework. You can also discover Audition with CMake.
Installing Audition On Linux 🔗
The binary release of Audition is available for both Ubuntu LTS and Fedora Workstations.
To install Audition on your Linux system download and install the deb (Ubuntu users) or rpm (Fedora users) from the downloads page.
Audition is built as a generic Linux binary and links against glibc which Ubuntu and Fedora both use. If you need to link against another version of libc or you want to use Audition on a different Linux distribution, then you will need the full source code of Audition which is obtained by purchasing a business license.
Discovering Audition 🔗
This section outlines the various ways Audition can be discovered and integrated with your projects after being installed on your computer.
Discovering Audition with CMake 🔗
To discover Audition with CMake you must first install Audition using an installer program (i.e. msi
, deb
, rpm
, dmg
). If you’ve downloaded Audition via an archive (i.e. a zip file), then the approach documented here will not work and you must manually configure it with CMake. That means using find_library
and friends.
Assuming you did install Audition with an installer program, you can use CMake’s find_package
command to find Audition as demonstrated in the CMake snippet below:
find_package(Audition REQUIRED)
You can then use the AUDITION_INCLUDE_DIR
and AUDITION_LIBRARY
variables to refer to the Audition library. The following CMake snippet would set the linker and compiler flags for executables subsequently added with add_executable.
include_directories(${AUDITION_INCLUDE_DIR})
link_libraries(${AUDITION_LIBRARY})
One “gotcha” to watch out for is that Audition requires C11 and Visual Studio, at the time of this writing, defaults to C89. You must change the version of the C standard MSVC uses by setting the CMAKE_C_STANDARD
variable in your CMakeLists.txt
as shown below:
set(CMAKE_C_STANDARD 11)
Discovering Audition with pkg-config 🔗
If you’re on Linux and have pkg-config
installed, you can execute the following command in your terminal to discover the Audition library and header.
$ pkg-config audition --cflags --libs
You can run this command from your build system of choice (e.g. your Makefile, Autotools, etc.) to discover Audition.
Discovering Audition with Visual Studio 🔗
This section explores how to manually setup Audition with your Visual Studio project. If you generated your Visual Studio project with CMake, then you can disregard this section because CMake configures it for you.
To configure Audition with your Visual Studio project, start by opening the property page of your test runner project. Once opened, navigate to Configuration Properties 🠞 General 🠞 C Language Standard and set the C standard to C11 or newer. This is necessary because, Visual Studio defaults to C89, but Audition requires C11 or newer.
Next, under Configuration Properties 🠞 C/C++ 🠞 General add to the Additional Include Directories the path where the Audition header file resides. If you installed Audition to its default directory with the Windows installer, then set this property to:
$(LOCALAPPDATA)\Programs\Audition
If you downloaded Audition as a zip file, then set the property to the location you extracted the audition.h
header file.
Next, under Configuration Properties 🠞 Linker 🠞 Input, add to the Additional Dependencies property the path to the audition.lib
file. If you installed Audition to its default directory with the Windows installer, then set this property to:
$(LOCALAPPDATA)\Programs\Audition\audition.lib
If you downloaded Audition as a zip file, then you must set the property to the location of the audition.lib
file.
Lastly, if you downloaded Audition as a zip, you need to copy the Audition.dll
to the location of your test runner executable or add it the directory in which it resides to your PATH variable. This step isn’t necessary if you installed Audition with the Windows installer.
Discovering Audition with Xcode 🔗
This section explores how to manually configure Audition with your Xcode project. If you generated your Xcode project with CMake, then you can disregard this section because CMake configures it for you.
Firstly, you must ensure your test runner target is configured as a command line program. So if you’re creating a new project (or target) be sure you create it as a Command Line Tool.
Once you have your target created, you must link it with the Audition.framework
. You can link it by clicking the “plus” icon under General 🠞 Frameworks and Libraries and then searching for “Audition” in the frameworks search box. If you cannot find Audition in the list, then you can add it manually by clicking Add Other... 🠞 Add Files... or by dragging Audition.framework
into the Xcode user interface.
This guide assumes you’ll add Audition as a reference rather than copying it into the project. Also, be sure that the Embed column has Do Not Embed selected.
Now that the Audition framework is linked, you must ensure your test runner executable can find the framework at runtime. If you fail to perform this step, you will receive a runtime error:
Library not loaded: @rpath/Audition.framework/Versions/A/Audition
To ensure Audition is discoverable at runtime, you must set the Build Settings 🠞 Runpath Search Paths and Framework Search Paths to the directory where Audition.framework
is located. If you installed the Audition framework by dragging it into the “Frameworks” directory, as instructed by the DMG, then it will be located in “/Library/Frameworks”.
You’re now ready to use Audition on macOS! However, there is one “gotcha” and that is you will need to include the audition.h
header file in a way that’s different from other platforms: On macOS framework headers are referenced by specifying the frameworks name first as a directory, then the header like so:
#include <Audition/audition.h>
Right now, this is how you need to include the Audition header file. If instead you want to include the Audition header directly as
#include "audition.h"
as it's included on non-macOS platforms, then you must update the Build Settings 🠞 Header Search Path option to reference the Audition header directory.