wpdk / wdutf

Windows Driver Unit Test Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

Documentation

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

Sample code demonstrating the use of the unit test framework will be added in the near future.

Source Code

The source code can be obtained using:

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

Getting Started

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

Build the Detours library by opening a Developer Command Prompt for Visual Studio:

cd detours\src
nmake

The project can then be built using the Visual Studio solution WDUTF.sln.

Runtime Prerequisites

The Windows Driver Unit Test Framework has been tested with:

  • Visual Studio 2022
  • Windows Driver Kit (10.0.22621.0)
  • Windows SDK (10.0.22621.0)

The following Visual Studio individual components need to be installed:

  • C++ ATL for latest build tools
  • C++ ATL for latest build tools with Spectre Mitigations
  • C++ MFC for latest build tools with Spectre mitigations

It is also known to work with earlier versions of the Windows Driver Kit and Visual Studio.

In order to build the example projects, a couple of executables need to be copied into tools\bin. The README contains details.

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.

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:

  • Minimal support for the Kernel Mode Driver Framework.
  • Currently only x64 builds are supported.

Known Issues

  • None.

Unit Tests

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

Contributing

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

Dependencies

There are currently no external dependencies.

Acknowledgements

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

Core Maintainers

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

About

Windows Driver Unit Test Framework

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C++ 94.3%Language:C 5.4%Language:Assembly 0.3%