A device driver is a component of an operating system that enables the OS to recognize a certain device and communicate with it. Testing a device driver normally requires either the physical device or a software-emulated version of the device. Physical and simulated devices are intended to work correctly, e.g., they do not generally behave in an unexpected manner. This means that during testing, it is difficult or impossible to verify if the driver is able to handle unexpected behavior of a device, e.g., device behavior that is not supposed to arise in common usage but nevertheless does.

Per the techniques of this disclosure, the driver-under-test is run within a virtual machine (VM). The driver communicates with a mock device controlled by programs running outside the VM. The mock device includes no actual operational logic; rather, it is scripted to simply react to driver actions, e.g., by triggering interrupts, reading/writing registers, etc. Outlier test cases of a driver, e.g., triggered by erroneous device behavior, can be tested by causing the mock device to behave in a scripted manner.

Creative Commons License

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 License.