Tuesday, June 19, 2007 6:34 PM
by
ravi_gollapudi
Checklist for testing device drivers ...
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.