This chapter discusses three tools available with the WorkShop toolset:
“Determining the Thoroughness of Test Coverage with Tester”, which describes the Tester quality assurance tool.
“Recompiling with Build Manager”, describes the tool that lets you recompile programs without leaving the WorkShop environment.
“Making Quick Changes with Fix+Continue”, describes how to make minor changes to your code without recompiling and linking.
Tester is a software quality assurance toolset for measuring dynamic coverage over a set of tests. It tracks the execution of functions, individual source lines, arcs, blocks, and branches.
This section describes the user model for designing a single test. After you have your instrumentation file and your test directories set up, you can automate your testing and create larger test sets. Tester has both a command line interface (see Table 5-1) and a graphical user interface (see Figure 5-1). Typical steps for running Tester are shown below:
Plan your test.
Create (or reuse) an instrumentation file.
The instrumentation file defines the coverage data you want to collect in the test.
Apply the instrumention file to the target executable(s).
This creates a special executable file that is used for testing purposes. This file collects data as it runs.
Create a test directory to collect the data files.
Run the instrumented version of the executable to collect the coverage data.
Analyze the results.
Tester produces a wide variety of reports. Most are available through both the command line and the graphical user interfaces. The reports show the following types of information:
Arc coverage, that is, coverage of function calls
Argument tracing
Basic block counts
Call graphs indicating caller and callee functions and their counts
Count information for assembly language branches
Function coverage
Source and assembly line coverage
Summaries of overall coverage
Table 5-1. Tester Command Line Interface Summary
Command Category | Command Name | Description |
---|---|---|
general | cvcov cattest | Describes the test details for a test, test set, or test group |
| cvcov lsinstr | Displays the instrumentation information for a particular test |
| cvcov lstest | Lists the test directories in the current working directory |
| cvcov mktest | Creates a test directory |
| cvcov rmtest | Removes tests and test sets |
| cvcov runinstr | Adds code to the target executable to enable you to capture coverage data, according to the criteria you specify |
| cvcov runtest | Runs a test or a set of tests |
coverage analysis | cvcov lssum | Shows the overall coverage based on the user-defined weighted average over function, line, block, branch, and arc coverage |
| cvcov lsfun | Lists coverage information for the specified functions in the program that was tested |
| cvcov lsblock | Displays a list of blocks for one or more functions and the count information associated with each block |
| cvcov lsbranch | Lists coverage information for branches in the program, including the line number at which the branch occurs |
| cvcov lsarc | Shows arc coverage, that is, the number of arcs taken out of the total possible arcs |
| cvcov lscall | Lists the call graph for the executable with counts for each function |
| cvcov lsline | Lists coverage for native source lines |
| cvcov lssource | Displays the source annotated with line counts |
| cvcov lstrace | Shows the argument tracing information |
| cvcov diff | Shows the difference in coverage for different versions of the same program |
test set | cvcov mktset | Makes a test set |
| cvcov addtest | Adds a test or test set to a test set or test group |
| cvcov deltest | Removes a test or test set from a test set or test group |
| cvcov optimize | Selects the minimum set of tests that give the same coverage or meets the given coverage criteria as the given set |
test group | cvcov mktgroup | Creates a test group that can contain other tests or test groups; targets are either the target libraries or DSOs |
The following table details where to find more information about Tester in the ProDev WorkShop: Tester User's Guide.
Table 5-2. Tester Information Details
Topic | See ... |
---|---|
Command line interface tutorial | Chapter 2, “Tester Command Line Interface Tutorial” |
Graphical user interface tutorial | Chapter 4, “Tester Graphical User Interface Tutorial” |
Command line interface details | Chapter 3, “Tester Command Line Reference” |
Graphical user interface details | Chapter 5, “Tester Graphical User Interface Reference” |
The Build Manager lets you view file dependencies and compiler requirements, fix compile errors easily, and compile software without leaving the WorkShop environment. It provides the following views:
Build View--for compiling, viewing compile error lists, and accessing the code containing the errors in Source View or an editor of your choice.
Build Analyzer--for viewing build dependencies and recompilation requirements and accessing source files.
For more information about the Build Manager, see Appendix B, “Using the Build Manager,” in the ProDev WorkShop: Debugger User's Guide.
The Fix+Continue feature lets you make minor changes to your code from within WorkShop without having to recompile and link the entire system. You issue Fix+Continue commands in the Debugger Main View window, either by selecting them from the Fix+Continue menu or typing them in directly in the Debugger command line area.
Fix+Continue enables you to speed up your development cycle. This is because you are no longer required to rebuild a program each time you make changes to the code, but can instead replace bad code and simply continue with program execution in a fraction of the time. Fix+Continue lets you perform the following functions:
Redefine existing function definitions
Disable, re-enable, save, and delete redefinitions
Set breakpoints in and single-step within redefined code
View the status of changes
Examine differences between original and redefined functions
The basic model steps for using the Fix+Continue feature are as follows:
Invoke the Debugger as you normally would by typing:
cvd [-pid pid] [-host host] [executable [corefile]] [&] |
Find the function that you want to change.
You can find a function in numerous ways. You can select Search... from the Source menu, type func functionname at the Debugger command line, or scroll to the location.
Select Edit from the Fix+Continue menu.
This turns on edit mode and highlights the source code of the selected function. If line numbers are displayed, those in the selected function appear with a two-part number separated by a decimal point. The left part of the number represents the starting line number of the function in the source file before you selected Edit. The right part of the number is the renumbered source line within the function. This numbering scheme makes it easy to keep track of new lines that have been added.
Make your changes to the source code.
You can do this directly in the Main View or you can use an editor of your choice by selecting External Edit from the Fix+Continue menu.
Try your changes.
Selecting Parse And Load adds your changes to the executable file that you are debugging. The changed function will be executed the next time it is invoked. If you stopped in the edited function, the Debugger will let you continue from the corresponding line in the new function, barring certain restrictions.
If the changes are satisfactory, save them for later compiling.
Save File+Fixes As... saves current fixes in the current file. Update All Files... saves all fixes in the current session.
At any point, you can compare the new code to the old code. Show Difference displays the old and new source code in a side-by-side format. Edited<-->Compiled lets you toggle between the old and new executables making it easy to verify or demonstrate your bug fix.
The following table details where to find more information about Fix+Continue in the ProDev WorkShop: Debugger User's Guide.
Table 5-3. Fix+Continue Information Details
Topic | See ... |
---|---|
General information and tutorial | Chapter 8, “Debugging with Fix+Continue” |
Detailed command information | Appendix A, "Fix+Continue Menu” subsection |