Home

Awesome

Windows Driver Unit Test Framework

The Windows Driver Unit Test Framework (WDUTF) enables the unit testing of Windows kernel drivers using the Microsoft Unit Testing Framework for C++, which runs in user space.

Running unit tests against code written for the Windows Kernel environment is hard. There have been a few projects that try to embed a unit test framework in the kernel, but they suffer from the compexity of having to load a driver, collect the output and handle crashes. We wanted to do something better; to create a user space environment where kernel code can run unmodified and tests can be examined using the Visual Studio debugger.

The initial version of the project consisted of a user space library implementing portions of the kernel infrastructure. This has now been extended to allow binary code built for the kernel to be loaded into the unit test environment and executed. Much of the kernel functionality is stubbed out, but the framework is sufficient to allow credible tests to be performed.

Our experience has been that bringing the simplicity and flexibility of user space development to kernel drivers can significantly reduce development time and improve project outcomes. The project is being contributed to the Windows Platform Development Kit to enable others to benefit from it.

rtegrity is leading the ongoing development of the project, which grew out of work done by DataCore to develop and test a world class, high-performance, storage stack running on Windows.

In this ReadMe

<a id="documentation"></a>

Documentation

Further information about the design and implementation can be found in the project documentation. This is still a work in progress.

Basic sample code demonstrating the use of the unit test framework can be found in examples. The unit tests in test provide more advanced examples of using the framework.

<a id="source"></a>

Source Code

The source code can be obtained using git:

git clone --recurse-submodules https://github.com/wpdk/wdutf

<a id="prereq"></a>

Runtime Prerequisites

The Windows Driver Unit Test Framework has been tested on both x64 and arm64 with Visual Studio Community 2022.

The following Visual Studio workloads need to be installed:

The following Visual Studio individual components are also needed (for either x64 or arm64 as appropriate):

The following are also required (installed in the following order):

The Windows Driver Unit Test Framework may work with earlier versions of the Windows Driver Kit and Visual Studio.

In order to build the example projects, an executable needs to be copied into tools\bin. The tools\bin\README contains details.

<a id="start"></a>

Getting Started

The project is designed to be used in conjunction with Visual Studio and the Windows Driver Kit.

The Windows Driver Unit Test Framework project can be built using the Visual Studio solution WDUTF.sln. Ensure that the configuration is set to the correct processor architecture before building. The Test Explorer can be opened with the menu entry Test/Test Explorer.

<a id="status"></a>

Current Status

The project has been in use for many years. It is considered to be stable, but is currently limited to the kernel features required by DataCore's own driver stack.

<a id="limitations"></a>

Limitations

The scope of the project is currently limited to supporting the kernel features used by DataCore drivers, but it is being made available to the community as a resource that can be developed and further extended.

In particular:

<a id="issues"></a>

Known Issues

<a id="unit"></a>

Unit Tests

The Windows Driver Unit Test Framework includes a set of unit test to validate the framework. These can be found in test.

<a id="contrib"></a>

Contributing

Contributions are welcome and needed! In these initial stages of the project, please email the maintainers directly.

<a id="depend"></a>

Dependencies

There are currently no external dependencies.

<a id="acknowledge"></a>

Acknowledgements

rtegrity is leading the ongoing development of the Windows Driver Unit Test Framework, which has been contributed by DataCore.

<a id="core"></a>

Core Maintainers

The core maintainers primary responsibility is to provide technical oversight for the WDUTF Project. The current list includes: