# How to Run Tests in RenoDX: CMake Build and CTest Execution Guide

> Learn how to run tests in RenoDX using CMake and CTest. This guide details configuring, building, and executing the regression test suite for clshortfuse/renodx.

- Repository: [Carlos Lopez/renodx](https://github.com/clshortfuse/renodx)
- Tags: how-to-guide
- Published: 2026-09-06

---

**RenoDX uses CMake with the `RENODX_BUILD_TESTS` cache variable and CTest to configure, build, and execute its regression test suite.**

RenoDX is a graphics modification framework that relies on CMake for its build system. Learning how to run tests in renodx requires understanding the optional test suite activation mechanism and the CTest integration implemented in the clshortfuse/renodx repository.

## Enable the Test Build Option

According to the clshortfuse/renodx source code, the test suite is controlled by the **RENODX_BUILD_TESTS** cache variable defined at lines 57-60 of the top-level [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt). When this option is set to `ON`, CMake includes the `test` subdirectory and generates build rules for all test binaries.

Pass this flag during the configuration step:

```bash
cmake -B build -DRENODX_BUILD_TESTS=ON

```

## Configure with CMake Presets

RenoDX ships with several ready-made configurations in [`CMakePresets.json`](https://github.com/clshortfuse/renodx/blob/main/CMakePresets.json) for Ninja, Clang, and Visual Studio targeting both x64 and x86 architectures. Select a preset that matches your development environment to standardize compiler flags and build directories.

Configure using a preset:

```bash
cmake --preset ninja-x64-debug

```

Then re-run with the test flag enabled, or combine steps by ensuring the preset configuration includes the test variable.

## Build the Test Targets

After configuration, compile the test binaries using the standard CMake build command. The build configuration (Debug or Release) must match your preset selection to ensure binary compatibility with the runtime addons.

```bash
cmake --build build --config Debug

```

## Execute Tests with CTest

RenoDX registers tests with CTest via `add_test` calls in individual test CMake files. For example, in [`test/swapchain_proxy_barrier_states/CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/test/swapchain_proxy_barrier_states/CMakeLists.txt) (lines 63-70), the **swapchain_proxy_barrier_states_vulkan** test registers itself with CTest along with its specific runtime requirements.

Run all tests from the build directory:

```bash
ctest --test-dir build -C Debug

```

Alternatively, navigate to the build directory and execute `ctest` directly. CTest will discover the registered tests, launch the required runtime addons, and report success or failure.

### Running a Specific Test

To execute a single test case instead of the full suite, use the `-R` flag with a regex matching the test name:

```bash
ctest -R swapchain_proxy_barrier_states_vulkan -C Debug

```

## Key Source Files and Implementation

Understanding how to run tests in renodx requires familiarity with these specific source locations:

- **[`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt)** (lines 57-60): Declares the `RENODX_BUILD_TESTS` option and conditionally includes the `test` subdirectory.
- **[`test/swapchain_proxy_barrier_states/CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/test/swapchain_proxy_barrier_states/CMakeLists.txt)** (lines 63-70): Demonstrates the `add_test` registration pattern and test-specific build rules used throughout the codebase.
- **[`CMakePresets.json`](https://github.com/clshortfuse/renodx/blob/main/CMakePresets.json)**: Defines build configurations for Ninja, Clang, and Visual Studio across 32-bit and 64-bit architectures.
- **Individual test [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt) files**: Each test directory contains its own CMake configuration that compiles the addon and registers it with CTest.

## Summary

- **RENODX_BUILD_TESTS** must be set to `ON` in the top-level [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt) to enable compilation of the test suite.
- Use **CMake presets** from [`CMakePresets.json`](https://github.com/clshortfuse/renodx/blob/main/CMakePresets.json) to maintain consistent build environments across different compilers and architectures.
- Tests are registered via **CTest** using `add_test` calls found in individual test directory CMake files like [`test/swapchain_proxy_barrier_states/CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/test/swapchain_proxy_barrier_states/CMakeLists.txt).
- Execute specific tests using `ctest -R` followed by the test name regex, or run the full suite with `ctest` from the build directory.

## Frequently Asked Questions

### How do I enable test building in renodx?

Set the **RENODX_BUILD_TESTS** cache variable to `ON` when configuring the project. This variable is declared at lines 57-60 of the top-level [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt). Pass it via command line using `-DRENODX_BUILD_TESTS=ON` or enable it through the CMake GUI.

### What CMake presets are available for testing?

RenoDX provides presets for Ninja, Clang, and Visual Studio generators in [`CMakePresets.json`](https://github.com/clshortfuse/renodx/blob/main/CMakePresets.json), supporting both x64 and x86 architectures. Choose a preset like `ninja-x64-debug` or an equivalent Visual Studio preset to match your toolchain and target architecture.

### How do I run a specific test instead of the entire suite?

Use the `ctest -R` command with a regular expression matching the test name. For example, `ctest -R swapchain_proxy_barrier_states_vulkan -C Debug` runs only the Vulkan swapchain barrier states test defined at lines 63-70 of [`test/swapchain_proxy_barrier_states/CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/test/swapchain_proxy_barrier_states/CMakeLists.txt).

### Where are the test definitions located in the source code?

Test definitions reside in the `test/` directory, with each subdirectory containing its own [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt) that calls `add_test()` to register with CTest. The top-level [`CMakeLists.txt`](https://github.com/clshortfuse/renodx/blob/main/CMakeLists.txt) (lines 57-60) controls whether these tests are included in the build through the `RENODX_BUILD_TESTS` option.