1

I have an existing kernel-mode device driver that implements a installable file system (IFS) for Windows. As there are several parts of the driver that should not require operating inside the kernel for their functionality, I would like to write a test framework around them to debug and validate their functionality. There are a few source files, in particular, which just manipulate the data structures for the file system as read from the disk that I think would be good candidates. They should have little to no calls into the kernel that would need to be mocked out unlike the rest of the driver. What is the best approach for applying test-driven development principles to a kernel-mode Windows driver or is this even a feasible tasks?

As a test, I tried created a bare, command-line project which compiles and prints "Hello" successfully, and then adding one C file from the driver-side of the project that I believe should be mostly independent. However, it died on build errors due to memset() and memcpy() being undeclared and defaulting to the erroneous return type of int. They were being pulled in and used in an inline function from the km\wdm.h header. It's not even clear to me how that header is being pulled in. I tried adding an include for string.h to that source file but it did not seem to fix it.

It is reasonable to be able to compile parts of a driver in user space to be run in a test fixture outside of the kernel or is this not likely a feasible approach?

I have tried to compile a source file from the kernel-mode driver both as an additional source to a fresh, command-line VC++ project as well as from the command-line using cl.exe which a limited set of options with various errors preventing it from compiling to an object file. I would like to be able to compile it to a point where it can be tested without needing access to real-world resources and causing instability.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.