Setting Up the Application Verifier Tool to Test a Driver (Windows Embedded CE 6.0)
1/6/2010
You can use the Application Verifier tool to test a driver. For information about testing an application, see Testing an Application with the Application Verifier Tool.
There are two methods of testing a driver with Application Verifier that are likely to be used: with KITL for general developer testing, and without KITL for expanded field testing.
Note
It is strongly recommended that you test with KITL first. A KITL connection will provide valuable feedback in the debug window regarding the status of Application Verifier to indicate that setup has been accomplished correctly.
To set up the Application Verifier tool to test drivers with KITL
Perform a clean build to generate a baseline Flat Release Directory (FRD).
Open a build window and set the following environment variables:
- VERIFY_MODULES=<file names of modules to test>
Must be set to the DLL that contains your driver binaries; if helper DLLs are involved, they should also be specifically called out. If multiple modules are specified, leave a space between module names. - VERIFY_OPTIONS=<options>
Common options for drivers include: EnableFanOutNoMapFilesIgnoreNullFree - VERIFY_SHIMS=<shims to apply>
Optional. The default value is shim_*.dll. For drivers, the likely shims desired are shim_heap.dll and shim_hleak.dll. - IMGSHIMENABLE=1
- VERIFY_MODULES=<file names of modules to test>
Shims and supporting files must be found in the FRD at the time the device is booted. They can be easily copied to the FRD by running the command Getappverif_cetk.bat, which is at <Platform Builder installation path>\Cepb\Wcetk\Ddtk\Desktop. This command requires the _FLATRELEASEDIR environment variable to be set in order to know where to copy the files. In **
Run makeimg. This will result in the creation of a file called verify.txt in the FRD that specifies the shimming options to the shim autoloader. It will also cause the signing of all Application Verifier related binaries, a critical step in the Application Verifier process.
Boot the device if it is configured to boot from the FRD. Otherwise, flash the created image to the device and boot with a Platform Builder (PB) connection to the device. In the debug window of PB you should see early indications of shims autoloading.
Application Verifier shims were designed to compare resource allocation at the time of entry to the time of exit. Because drivers never exit, it is necessary to establish test points manually. shim_heap.dll and shim_hleak.dll support commands for this purpose.
After booting, utilize the target command window in PB to enter the following command lines, depending on the shims specified in the VERIFY_SHIMS environment variable in step 2:
- loadext shim_heap.dll: Attach a command interface to the heap shim
- loadext shim_hleak.dll: Attach a command interface to the hleak shim
- heapverif * chk: Establish a check point on all modules for the heap shim
- hleak * chk: Establish a check point on all modules for the hleak shim
You are now ready to exercise your driver.
Perform device functions that fully exercise the driver or a targeted functionality.
Enter the following commands:
- heapverif * delta*(A logfile named* heapverif_interim.log is created in the FRD)
- hleak * deltalog*(A logfile is created in the FRD; the name of the file is displayed in the command window)*
Use avlogview.exe to view the logs. This application can be found at <Platform Builder installation path>\CEPB\wcetk\DDTK\DESKTOP
To set up the Application Verifier tool to test drivers without KITL
Make the binaries and verify.txt available early in the boot process on the device image.
- To begin testing immediately after a clean boot, these files must be on the image at build time.
- If testing immediately after a clean boot is not required, copy the files to persistent storage at \Windows before rebooting the device.
Use appverif.exe (found at <Platform Builder installation path>CEPB\wcetk\DDTK\<target CPU>\) to enter the commands establishing test points onto the device.
This utility acts as a command interface into the shims. However, since it has no UI component, commands must be passed as parameters to appverif.exe. This is easily accomplished by creating links to the command:
- Use ActiveSync to copy appverif.exe to \Windows on the device.
- Create a folder on the device at \Windows\Start Menu\Debug Apps\.
- Create link files on your desktop or other known location using Notepad.exe or a similar editor.
- Use ActiveSync to place the link files into the newly-created Debug Apps folder.
For instance, create a file called HeapChk.lnk as a raw txt file with the following contents:
appverif.exe -cmd heapverif * chk
Next, create a file called HeapDelta.lnk with the following contents:
appverif.exe -cmd heapverif * delta
Copy these files onto the device, and these two commands will be available from the UI of the device by going to Start Menu | Debug Apps.
In this example, the Delta command will create a log file called HeapDelta.log at the root of the device, which will contain the same information as can be seen in the command window of the device when using KITL. It will also create heapverif_interim.log at this location. These files can be extracted from the device with ActiveSync.