Welcome to MSDN Blogs Sign in | Join | Help

So I have been working on coming up with a short checklist for testing device drivers. There are several tools in the WDK that are very useful to find bugs in device drivers. At a minimum, I think the below should ideally be run on every driver package (more details about all these tools are in the WDK documentation):

1.       Static Analysis tools:

a.       Prefast For Drivers (PFD) (%BASEDIR%\tools\pfd): This is a compile time static analysis tool that specifically looks for the potential presence of common device driver bugs. This works with both C and C++ code.

b.      Static Driver Verifier (SDV) (%BASEDIR%\tools\sdv): This is a rigorous static analysis tool for WDM only device drivers written in C.

c.       ChkINF (%BASEDIR%\tools\chkinf). Driver Installation errors are IMO very easy to run into. This is a very useful tool to figure out any potential problems in INF files even before attempting to use them to install a driver.

 

2.       Runtime tools: Using the below with Driver Verifier turned on would be most beneficial (ideally a mix of I/O, Pnp and Power management tests should be used). Also, early in the development process, it would help to use checked binaries for testing.

a.       Device Path Exerciser or dc2 (in %BASEDIR%\tools\dc2 directory in the Vista RTM WDK): This tool sends a bunch of valid and invalid I/Os to a driver and is a great security test. As the htm file in the dc2 directory in the WDK, “a comprehensive set of tests on your driver can be run using the command: dc2 /hct /dr your-driver-name”.  For drivers using IoCreateDeviceSecure with a restrictive SDDL string, the “-im” option may have to be used in addition.

b.      Pnpdtest (in  %BASEDIR%\tools\pnpdtest): This tool tests pnp implementation in a driver and running the stress test on your driver would be a very useful thing to do.

c.       WDTF Sleep_Stress_With_IO.wsf (in %BASEDIR%\tools\WDTF\%_BUILDARCH%fre\samplescripts): This cycles the system through different power states and also does some basic i/o testing. As an alternative, the pwrtest tool (in %BASEDIR%\tools\acpi\pwrtest) can also be run.

 

0 Comments
Filed under: ,

I am currently working as a Software Design Engineer in Test in the Windows Driver Foundation group. I have been in Microsoft for over 7 years now after graduating from Michigan State University. After joining Microsoft, I have worked as a Support Engineer in the DDK Developer Support team for about 3 years. During this time, I have primarily worked on storage drivers. I then moved to the Kernel Mode Driver Framework team initially as a Test Developer. I was the Test Lead for KMDF for over 3 years and worked on KMDF versions 1.0 through 1.5 (Details on how to get the latest version are available here)

I am planning to post some of my thoughts on how to test drivers in this blog.

-Ravi

 
Page view tracker