Writing Device Drivers

Device Driver Testing

This section provides some hints for driver testing.


The driver should be able to sustain heavy driver activity, followed by module unload, without errors or memory leaks. This can be loop tested as follows (using C shell):

% while 1
<run driver test>
modunload -i  <module number>
> end


% while 1

add_drv  driver name
<run driver test>
rem_drv driver name
> end

Suspend/Resume Testing

Start up a test on your driver and simultaneously run:

# uadmin 3 8
in a loop to test Suspend/Resume. The driver test should check for data corruption or unexpected loss of state.

You can also test Suspend/Resume by generating I/O to your device, and then pressing the top-right button on the keyboard to suspend the machine. Then resume the machine; there should be no panics, error messages, or data corruption.

If you have access to a server system that supports Dynamic Reconfiguration, you may also want to test your driver on this configuration.