Custom Search

Tuesday, January 19, 2010

Driver Testing Tips

1. Introduction
As we know, Windows drivers can run and work in either user mode or kernel mode.
Kernel-mode drivers run as part of the operating system and possess the privileged abilities. The drivers reviewed below are the drivers of kernel level. As any software testing procedure, driver testing includes automatic and manual testing, but in this article we will focus mainly on the last one.
Later we will review testing process for the followings types of drivers:
•    File System Filter Drivers
•    Network Redirection Drivers
•    Virtual Storage Drivers
•    USB Client Device Drivers
2. General aspects of driver testing
First of all, I would like to say ?Don?t install the driver to be tested on your working system!? However, there are some exceptions on this occasion, for example:
•    You are looking for a reason to reinstall your system...
•    You don?t want to waste time on searching bugs on the clean test systems...
•    You are sure that the driver is stable...
•    You have to test the work of the connected devices...
Secondly, driver tester must have a virtual machine installed on the working computer and at least one real test computer.
Thirdly, before starting the testing procedure, it is necessary:
1. To define the number of operating systems for which it is necessary to check the driver functionality. Usually, first of all you use the OS confirmed by the specification. Let?s suppose that a driver must successfully work under Windows 2000/XP/Server 2003/Vista accordingly to the requirements. Applying our experience in driver testing, we extend this list to the following:
•    Windows 2000
•    Windows 2000 sp4
•    Windows XP_sp0
•    Windows XP_sp1
•    Windows XP_sp2
•    Windows XP_(Windows is installed on FAT32) (obligatory system)
•    Windows Server 2003 Standard Edition
•    Windows Server 2003 Enterprise Edition
•    Windows Vista
Additionally:
•    Windows Server 2003 Small Business
•    Windows Server 2003 Enterprise EditionSp1
At that, it is desirable for all of these systems to be Checked Build versions. Using the Checked version slows down Windows functioning, but multiplies probability of finding bug in the driver functioning. If there is no a single Checked Windows, it is necessary to purchase the Checked version of at least one system, for example from the Windows XP series.
Thus Windows XP_Chk is added to the OS list. But you shouldn?t limit you work only to this list: the more the number of OS, under which driver passed the complete testing successfully, the better quality of product guaranteed.
2. If possible, select test computers with as different hardware and configurations as possible. I recommend obligatory test on machines with single processor, single processor with Hyper-Threading, two-core processor and dual processor machines.
3. To make the following settings for each OS where driver testing will be performed: in System Properties\Advanced\Startup and Recovery Settings\Write debugging information it?s necessary to select Kernel memory dump or Complete memory dump, and uncheck Automatically restart option for the case of you won?t be nearby in the moment of Blue Screen appearance.
4. To set verification by standard Driver Verifier Manager of the system with all options, except for Low resource simulation. This is determined by the fact that at first you must obtain stable functioning of driver without the option of Low resource simulation, and then test the functioning with this option on smoke tests.
5. To select antivirus software with which it is desirable to test the driver performance. Usually it?s recommended to take the most commonly used antivirus programs, such as DrWeb, Kaspersky Antivirus, V3, Symantec Norton Antivirus, NOD32. The list is not limited to these names, of course. The more programs you will test, the better driver performance will be; this will only increase the quality of product.
6. To verify compatibility of your driver with other drivers, the system ones and the drivers by other producers. It is desirable for the last ones to be stable enough ? in this case it will be easier for you to discover reasons for improper work of the system or Blue Screen appearance, and to expose bugs in driver performance.
The next general aspect of driver testing is verification of driver loading and unloading, i.e. you set the group of tests that are relevant to each driver:
1.    Driver installation. The script for driver installation can be written by programmer, but the tester verifies whether it?s done correctly. Here we check the following:
a.    Has the system crashed after driver installation or not?
b.    Has *.sys file been written in the C:\WINDOWS\system32\drivers directory?
c.    Have necessary keys been registered in Registry, if they are presented in our case?
The driver installation not always supposes its start - it depends on implementation of driver. Some of them run after system restart and cannot be stopped during the process of work (usually these are File System Filter Drivers), therefore the following questions arise:
d.    Does system start correctly with installed driver?
e.    Does system crash when the driver is started manually?
2.    System Restart while the driver is working. System must be normally rebooted without Blue Screen; after system start, the driver and its settings must comply with the statuses described in the specification.
3.    System Reset while the driver is working. System must perform the Reset operation and start without Blue Screen; after system start the driver and its settings must comply with the statuses described in the specification.
4.    System shutdown while the driver is functioning. System must perform the Shut down operation successfully without Blue Screen.
5.    System Start with the pre-installed driver. System must be rebooted without Blue Screen; after the system starts, the driver and its settings must comply with the statuses described in the specification.
Further work of driver tester includes functional testing of the testing object and search of BSOD, which features depend on the type of testing driver.
3. File System Filter Drivers Testing
The drivers of this type are designed for enhancement of the file system functionality, for example for catching operations of OS in order to watch, forbid or permit certain processes, operations, files in certain disk space. The set of tests to verify the driver functionality is formed in accordance with the type of driver and here you have to pay special attention to the software products workings with network places.
Let?s consider an example when we use a database with the multi-users connection status. Let?s suppose that the real multi-users DB1 is on the computer N1 and we can work with DB1 on the computer N2 without problems. Let?s install some File System Filter Driver on the computer N1 and computer N2. When trying to get access to DB1 from the computer N2 we can get such results:
•    DB1 on the computer N1 is not accessible for the computer N2;
•    N1 computer has crashed with BSOD;
•    N2 computer has crashed with BSOD;
•    DB1 remained accessible for using on the computer N2.
It is necessary to test an access to Shared Folders from one machine to another. Thus you have to test standard operations of creation, deleting, copying, renaming, moving of small and large folders and files in Shared Folders.
An insidious test is the starting of some *.exe file both from network space and locally.
On the test system, it?s useful to run software products which perform file system indexing (for example, Google Desktop). BSOD or Dead Lock of system with installed File System Filter Driver can occur when such programs are started or functioning.
System can work inadequately after installation of new Virtual Storage Driver (these drivers are developed for creation of virtual encrypted disks) or while it?s functioning. BSOD or noticeable slow down in system performance can happen as a result of File System Filter Driver and Virtual Storage Driver interaction ? naturally, it?s not good.
In my opinion, this type of drivers is the hardest from the view of covering full set of tests, and the most unforeseeable in system crashes while driver is functioning.
4. Network Redirection Drivers Testing
Network Redirection Driver is a network file system which gives access to the resources of remote computer. In practice, such drivers are used for creation of network disks, and we will examine such drivers in this paragraph.
First of all, it?s necessary to select test data, so we will take:
•    Files and folders of small size (to 10?b);
•    Files and folders of large size(more than 600?b);
•    Folders containing some nested files and folders (one folder for one file);
•    Folders containing a great number of nested files and folders (nesting is equal to 5; the number of files (size to 1?) is more than 100 in each folder).
In this case main tests are divided into the followings groups:
Group #1 is "Verification of network disk displaying". After connecting network disk that is implemented on the base of Network Redirection Driver, this disk must be displayed in all of the file managers.
Group #2 is "Verification of functionality"
1.    Testing the standard operations (opening, change, hiding, creation, deleting and other) with files and folders on a network disk.
2.    Testing the operations of copying, saving files and folders to/from a network disk from/to a local disk. It?s necessary to pay special attention to all of applications included in MSOffice package, MindManager and also to verify saving project of MS Visial Studio from local space to a network disk and compiling this project.
3.    Testing the operations of copying when size of copied files is changed and also when an operation of copying/saving files is interrupted incorrectly.
4.    Testing software product on the different language versions of OS, for example under English and Korean OS, and performing tests from the first three points of Group #2. The driver must automatically pick up the language of the system and successfully perform all available operations with files and folders.
5.    Testing search function on a network disk.
6.    Checking the data integrity when moving them from a local disk to a network one and vice versa.
Group #3 is "Verification of data exchange speed"
1.    Testing speed on every set from the group of test data when downloading to Network Disk from Local Disk.
2.    Testing speed on every set from the group of test data when unloading from Network Disk to Local Disk.
At that, it is necessary to take into account the capabilities of data transfer over the local network and capabilities of network protocols both with data cashing and without it. If you can get an analogue product, then compare its speed with the speed of your product.
Group #4 is "Disconnect"
1.    Checking the reaction of the system to disconnecting the network cable with the network disk connected:
a.    during uploading of each set from the group of test data;
b.    during downloading of each set from the group of test data.
2.    Testing the reconnect of network disk after plugging connecting network cable to the computer.
Group #5 is "Users sessions"
1.    Testing network disk performance for different users in the terminal session of Windows Server2003.
2.    Testing network disk performance for different users with Switch option on Windows XP.
3.    Testing network disk performance for different users with Login switching on Windows Server2003.
5. Virtual Storage Drivers Testing
Virtual Storage Driver is virtual data storage (for example, it can use random-access memory or file). Usually it is used for implementation of virtual encrypted disks.
Main points when testing this type of drivers are:
1.    Standard operations (opening, change, hiding, creation, deleting and other) over files and folders on a virtual disk.
2.    Creation of image of maximum possible size; its formatting.
3.    Data safety when working with different encrypting algorithms.
4.    Driver speed (reading ? writing to/from a virtual disk).
5.    Place of images localization (USB memory, Network Disk, Local Disk) and ability to access it.
6.    Data integrity on repeated connection of image after incorrectly disabled access to image had happened.
6. USB Client Device Drivers Testing
USB Client Device Driver manages USB device, interacts with it by means of USB packages (URB), for example, for redirecting requests to another computer. The real USB devices are always involved in testing of such drivers; therefore the critical errors occur mostly during interaction between the driver that is tested and devices? drivers. For example, BSOD can happen on a computer with USB Client Device Driver installed when the following actions are performed:
a.    connecting new USB device;
b.    correct removing of USB device;
c.    incorrect removing of USB device;
d.    installing drivers for USB devices;
e.    working with USB device.
7. Conclusion
Remember that correctly chosen set of tests for the certain type of driver helps your to improve the quality of your product.